wang jun 3 anos atrás
pai
commit
628d9d960f

+ 3 - 0
application/admin/controller/AdminBase.php

@@ -7,6 +7,7 @@ use think\Controller;
 class AdminBase extends Controller
 {
     protected $param;
+    protected $webuserid;
     protected function initialize()
     {
         $url = request()->baseUrl();
@@ -50,6 +51,8 @@ class AdminBase extends Controller
             $str = backjson2(0, '登录失效', $result['data']);
             exit($str);
         }
+        $data = $result['data'];
+        $this->webuserid = $data['id'];
     }
     /**
      * 设置请求数据规则

+ 18 - 0
application/admin/controller/Company.php

@@ -8,10 +8,16 @@
 namespace app\admin\controller;
 
 use app\admin\logic\companylogic;
+use app\admin\logic\webuserloglogic;
 use think\Controller;
 
 class Company extends AdminBase
 {
+    /**
+     * 企业审核
+     * 20220209
+     * wj
+     */
     public function audit()
     {
         $param = request()->param();
@@ -20,8 +26,20 @@ class Company extends AdminBase
         if (1 != $result['status']) {
             return backjson2(0, $result['msg']);
         }
+        $data = $result['data'];
+        $param['ids'] = $data['successIds'];
+        $param['wuid'] = $this->webuserid;
+        $param['type'] = 2;
+        $param['tablename'] = 'company';
+        $l_wl = new webuserloglogic();
+        $l_wl->addauditlog($param);
         return backjson2(200, $result['msg'], $result['data']);
     }
+    /**
+     * 获取企业列表
+     * 20220209
+     * wj
+     */
     public function getlistbywhere()
     {
         $param = request()->param();

+ 11 - 6
application/admin/logic/companylogic.php

@@ -27,8 +27,7 @@ class companylogic extends baselogic
             'getlistbywhere' => [
                 ['name' => 'ispass', 'title' => 'ispass', 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'],
                 ['name' => 'companyname', 'title' => 'companyname', 'type' => 'string'],
-                ['name' => 'starttime', 'title' => 'starttime', 'type' => 'datetime'],
-                ['name' => 'endtime', 'title' => 'starttime', 'type' => 'datetime'],
+                ['name' => 'createdate', 'title' => 'createdate', 'type' => 'array'],
                 ['name' => 'page', 'title' => 'page', 'type' => 'numeric'],
                 ['name' => 'size', 'title' => 'size', 'type' => 'numeric'],
             ],
@@ -52,6 +51,7 @@ class companylogic extends baselogic
         }
         $ispass = $arr['ispass'];
         $m_c = new companymodel();
+        $successIds = [];
         foreach ($ids as $key => $value) {
             $where = ['id' => $value];
             $info = $m_c->getInfo($where);
@@ -60,11 +60,15 @@ class companylogic extends baselogic
                 continue;
             }
             if ($ispass != $info['ispass']) {
+                $successIds[] = $value;
                 $update = ['ispass' => $ispass];
                 $m_c->updateinfo($where, $update);
             }
         }
-        return backarr(1, "操作成功");
+        $data = [
+            'successIds' => $successIds,
+        ];
+        return backarr(1, "操作成功", $data);
     }
     /**
      * 获取公司列表
@@ -84,9 +88,10 @@ class companylogic extends baselogic
         if (isset($arr['companyname'])) {
             $where[] = ['companyname', 'like', '%' . $arr['companyname'] . '%'];
         }
-        if (isset($arr['starttime']) && isset($arr['endtime'])) {
-            $where[] = ['create_time', '>=', $arr['starttime']];
-            $where[] = ['create_time', '<=', $arr['endtime']];
+        if (isset($arr['createdate'])) {
+            $createdate = $arr['createdate'];
+            $where[] = ['create_time', '>=', $createdate[0]];
+            $where[] = ['create_time', '<=', $createdate[1]];
         }
         $m_c = new companymodel();
         $count = $m_c->getList($where, 'count');

+ 39 - 0
application/admin/logic/webuserloglogic.php

@@ -98,4 +98,43 @@ class webuserloglogic
         ];
         return backarr(1, "查询成功", $data);
     }
+    /***
+     * 加审核日志
+     * 20220209
+     * wj
+     */
+    public function addauditlog($param)
+    {
+        $ids = $param['ids'];
+        if (count($ids) <= 0) {
+            return false;
+        }
+        $wuid = $param['wuid'];
+        $type = $param['type'];
+        $tablename = $param['tablename'];
+        $ispass = $param['ispass'];
+        $node = "";
+        switch ($ispass) {
+            case 1:
+                $node = "审核成功";
+                break;
+            case 2:
+                $node = "审核失败";
+                break;
+        }
+        if (isset($param['node']) && is_string($param['node']) && !empty($param['node'])) {
+            $node .= "-" . $param['node'];
+        }
+        $tablename = 'company';
+        foreach ($ids as $key => $value) {
+            $wldata = [
+                'wuid' => $wuid,
+                'node' => $node,
+                'type' => $type,
+                'refid' => $value,
+                'tablename' => $tablename,
+            ];
+            $this->addlog($wldata);
+        }
+    }
 }

+ 0 - 15
application/index/controller/Company.php

@@ -88,19 +88,4 @@ class Company extends Base
         }
         return backjson(200, $result['data']);
     }
-    /**
-     * 审核公司
-     * 20220208
-     * wj
-     */
-    public function auditcompany()
-    {
-        $param = request()->param();
-        $l_c = new companylogic();
-        $result = $l_c->auditcompany($param);
-        if (1 != $result['status']) {
-            return backjson(0, $result['msg']);
-        }
-        return backjson(200, $result['data']);
-    }
 }

+ 1 - 1
application/index/model/companymodel.php

@@ -113,7 +113,7 @@ class companymodel extends Model
      */
     public function getcountbyparty($partyid)
     {
-        $str = "select count(*) as count from t_company as c join t_partyrecord as pr on pr.company_id =c.id where pr.party_id='" . $partyid . "'";
+        $str = "select count(*) as count from t_company as c join t_partyrecord as pr on pr.company_id =c.id where c.ispass=1 and pr.party_id='" . $partyid . "'";
         $result = $this->query($str);
         return $result[0]['count'];
     }

+ 1 - 1
application/index/model/inventmodel.php

@@ -114,7 +114,7 @@ class inventmodel extends Model
         $str = "select count(i.id) as count from t_invent as i
         join t_company as c on c.id=i.company_id
         join t_partyrecord as pr on pr.company_id =c.id
-        where i.active_state=1 and pr.party_id='" . $partyid . "'";
+        where c.ispass=1 and i.active_state=1 and pr.party_id='" . $partyid . "'";
         //$str = "select count(*) as count from t_company as c join t_partyrecord as pr on pr.company_id =c.id where pr.party_id='" . $partyid . "'";
         $result = $this->query($str);
         return $result[0]['count'];