wugg 1 year ago
parent
commit
2706098f63
1 changed files with 1 additions and 31 deletions
  1. 1 31
      app/controller/Headquarters.php

+ 1 - 31
app/controller/Headquarters.php

@@ -204,16 +204,12 @@ class Headquarters extends BaseController
         ]);
 
         if (!$val->check($param)) return json_show(1004, $val->getError());
-
         Db::startTrans();
-
         try {
             $date = date('Y-m-d H:i:s');
-
             $codes = [];
             switch ($param['type']) {
                 case 1:
-
                     $where = [['is_del', '=', 0], ['id', 'in', $param['ids']]];
                     $codes = Db::name('business')->where($where)->column('companyNo');
                     Db::name('business')->where($where)->update(['is_del' => 1, 'updatetime' => $date]);
@@ -222,7 +218,6 @@ class Headquarters extends BaseController
                     $where = [['is_del', '=', 0], ['id', 'in', $param['ids']]];
                     $temp = Db::name('customer_info')->field('id,companyNo')->where($where)->where('status', 1)->findOrEmpty();
                     if (!empty($temp)) throw new Exception($temp['companyNo'] . '启用状态,不允许删除');
-
                     $codes = Db::name('customer_info')->where($where)->column('companyNo');
                     Db::name('customer_info')
                         ->where($where)
@@ -234,7 +229,6 @@ class Headquarters extends BaseController
                     Db::name('supplier')->where($where)->update(['is_del' => 1, 'updatetime' => $date]);
                     break;
             }
-
             Db::name('headquarters')
                 ->where('is_del', 0)
                 ->whereIn('code', $codes)
@@ -244,22 +238,18 @@ class Headquarters extends BaseController
                     'updaterid' => $param['updaterid'],
                     'updatetime' => date('Y-m-d H:i:s')
                 ]);
-
             Db::commit();
             return json_show(0, '删除成功');
         } catch (Exception $exception) {
             Db::rollback();
             return json_show(1005, '删除失败,' . $exception->getMessage());
         }
-
     }
 
     //启禁用
     public function status()
     {
-
         $param = $this->request->only(['id', 'type', 'status', 'updater', 'updaterid'], 'post', 'trim');
-
         $val = Validate::rule([
             'id' => 'require|number|gt:0',
             'type|类别' => 'require|number|in:1,2,3',
@@ -267,15 +257,10 @@ class Headquarters extends BaseController
             'updater|操作人' => 'require|max:255',
             'updaterid|操作人id' => 'require|number|gt:0',
         ]);
-
         if (!$val->check($param)) return json_show(1004, $val->getError());
-
         Db::startTrans();
-
         try {
-
             $date = date('Y-m-d H:i:s');
-
             $code = '';
             switch ($param['type']) {
                 case 1:
@@ -285,9 +270,7 @@ class Headquarters extends BaseController
                         ->findOrEmpty();
                     if (empty($tmp)) throw new Exception('未找到对应数据');
                     if ($tmp['status'] == $param['status']) throw new Exception('操作重复');
-
-
-                    Db::name('business')
+                   Db::name('business')
                         ->where(['id' => $param['id'], 'is_del' => 0])
                         ->where('status', '<>', $param['status'])
                         ->update([
@@ -387,32 +370,19 @@ class Headquarters extends BaseController
         if ($param['creater'] !== "") $where[] = ["a.creater", "like", '%' . $param['creater'] . '%'];
         if ($param['start'] !== "") $where[] = ["a.addtime", '>=', $param['start']];
         if ($param['end'] !== "") $where[] = ["a.addtime", '<=', $param['end'] . ' 23:59:59'];
-//       if ($param['company_name'] !== "")  $where[] = ["a.createrid", 'in', $param['company_name']];
-
         $count = Db::name('business')
             ->alias('a')
-//           ->leftJoin("depart_user u", "u.uid=a.createrid AND u.is_del=0")
             ->where($where)
             ->count('a.id');
 
         $list = Db::name('business')
             ->alias('a')
             ->field(true)
-//           ->field('a.*,u.itemid')
-//           ->leftJoin("depart_user u", "u.uid=a.createrid AND u.is_del=0")
             ->where($where)
             ->page($param['page'], $param['size'])
             ->order(['addtime' => 'desc', 'id' => 'desc'])
             ->select()
             ->toArray();
-
-//       $all_codes = Db::name('supplier_contact')
-//           ->whereIn('code', array_column($list, 'code'))
-//           ->column("id,contactor,mobile", 'code');
-
-        //获取开通账号的供应商
-//       $account = checkHasAccountBySupplierNos(array_column($list,'code'));
-
         foreach ($list as &$value) {
             $value['company_name'] = '';
         }