zxhxx 3 vuotta sitten
vanhempi
commit
9057b610cc

+ 8 - 0
application/admin/controller/company/Company.php

@@ -66,6 +66,14 @@ class Company extends Backend
     {
         parent::import();
     }
+    public function add()
+    {
+        if(is_array(is_sys_admin()))
+        {
+            $where[] = is_sys_admin();
+        }
+        if($where) $this->error('非管理员不能创建!');
+    }
 
     /**
      * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法

+ 32 - 0
application/admin/controller/help/Family.php

@@ -29,6 +29,38 @@ class Family extends Backend
     {
         parent::import();
     }
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                $data = $this->selectpage()->getData();
+                return $data;
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            /**
+             * 获取企业信息
+             */
+            $where1  = is_sys_admin();
+            $list = $this->model
+                ->where($where)->where($where1)
+                ->order($sort, $order)
+                ->paginate($limit);
+            foreach ($list as $k => $v) {
+                $v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
+                $v->hidden(['password', 'salt']);
+            }
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
 
     /**
      * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法

+ 35 - 0
application/admin/controller/help/Help.php

@@ -30,7 +30,42 @@ class Help extends Backend
     {
         parent::import();
     }
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                $data = $this->selectpage()->getData();
+                if(!$this->request->request('keyValue')) {
+                    $data['list'] = array_merge([['id' => 0, 'title' => '无', 'pid' => 0]], $data['list']);
+                    $data['total']++;
+                }
+                return $data;
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            /**
+             * 获取企业信息
+             */
+            $where1  = is_sys_admin();
+            $list = $this->model
+                ->where($where)->where($where1)
+                ->order($sort, $order)
+                ->paginate($limit);
+            foreach ($list as $k => $v) {
+                $v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
+                $v->hidden(['password', 'salt']);
+            }
+            $result = array("total" => $list->total(), "rows" => $list->items());
 
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
     /**
      * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
      * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑

+ 1 - 0
application/api/controller/Article.php

@@ -6,6 +6,7 @@ use liuniu\UtilService;
 use think\Request;
 class Article extends Api
 {
+    protected $noNeedLogin = ['*'];
     protected $noNeedRight = ['*'];
     public function ify(Request $request)
     {

+ 1 - 0
application/api/controller/Help.php

@@ -99,6 +99,7 @@ class Help extends Api
         $where = UtilService::getMore(
             [
                 ['user_id',$this->auth->getUserinfo()['id']],
+                ['user_id_1',$this->auth->getUserinfo()['id']],
                 ['page',1],
                 ['limit',10],
                 ['status',-2],

+ 7 - 4
application/common/model/Help.php

@@ -62,9 +62,12 @@ class Help extends BaseModel
     {
         self::beginTrans();
         try {
-            $res = self::create($where);
-            $where['help_id'] = $res['id'];
-            $res1 = HelpExt::create($where);
+            list($help['cid'],$help['category_id'],$help['user_id'],$help['full_name'],$help['contact'],$help['id_card'],$help['title'],$help['info'],$help['userimage'],$help['userimages'],$help['status']) =
+                [$where['cid'],$where['category_id'],$where['user_id'],$where['full_name'],$where['contact'],$where['id_card'],$where['title'],$where['info'],$where['userimage'],$where['userimages'],0];
+            $res = self::create($help);
+            list($HelpExt['cid'],$HelpExt['help_id'],$HelpExt['sex'],$HelpExt['politics'],$HelpExt['birthday'],$HelpExt['address'],$HelpExt['company'],$HelpExt['unit_nature'],$HelpExt['monthly_income'],$HelpExt['annual_household_income'],$HelpExt['annual_household_income_average'],$HelpExt['identity'],$HelpExt['marriage'],$HelpExt['medical_insurance'],$HelpExt['object_features'],$HelpExt['reason']) =
+                [$where['cid'],$res['id'],$where['sex'],$where['politics'],$where['birthday'],$where['address'],$where['company'],$where['unit_nature'],$where['monthly_income'],$where['annual_household_income'],$where['annual_household_income_average'],$where['identity'],$where['marriage'],$where['medical_insurance'],$where['object_features'],$where['reason']];
+            $res1 = HelpExt::create($HelpExt);
             foreach ($where['family'] as $v)
             {
                 $v['cid'] = $where['cid'];
@@ -79,7 +82,7 @@ class Help extends BaseModel
 
         }catch (Exception $e)
         {
-            self::setErrorInfo($e->getMessage(),true);
+            self::setErrorInfo($e->getLine().'--'.$e->getMessage(),true);
         }
     }
     public static function lst($where)