wugg 1 سال پیش
والد
کامیت
490204ffa1
2فایلهای تغییر یافته به همراه62 افزوده شده و 240 حذف شده
  1. 2 151
      app/controller/CustomerOrg.php
  2. 60 89
      app/controller/Headquarters.php

+ 2 - 151
app/controller/CustomerOrg.php

@@ -25,20 +25,10 @@ class CustomerOrg extends BaseController
         ]);
 
         if ($val->check($param) == false) return json_show(1004, $val->getError());
-//        $name = isset($this->post['name']) && $this->post['name'] !== "" ? trim($this->post['name']) : "";
-//        if ($name == "") {
-//            return json_show(1003, "公司名称不能为空");
-//        }
-//        $weight = isset($this->post['weight']) && $this->post['weight'] !== "" ? trim($this->post['weight']) : "0";
-//        $pid = isset($this->post['pid']) && $this->post['pid'] !== "" ? trim($this->post['pid']) : "0";
-//        if ($pid === "") {
-//            return json_show(1002, "父级id不能为空");
-//        }
         if ($param['pid'] != 0) {
             $spid = Db::name($this->table_name)
                 ->where(['id' => $param['pid'], 'is_del' => 0])
                 ->findOrEmpty();
-            //var_dump( Db::name($this->table_name)->getLastSql());
             if (empty($spid)) return json_show(1004, "父级不能为空");
 
         }
@@ -47,18 +37,8 @@ class CustomerOrg extends BaseController
             ->where(['is_del' => 0, 'name' => $param['name'], 'pid' => $param['pid']])
             ->findOrEmpty();
         if (!empty($rename)) return json_show(1002, "组织名称已存在");
-
-//        $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
-//        if($token==''){
-//            return json_show(105,"参数token不能为空");
-//        }
-//        $user =GetUserInfo($token);
-//        if(empty($user)||$user['code']!=0){
-//            return json_show(1002,"创建人数据不存在");
-//        }
         $createrid = $param['uid'];//isset($user["data"]['id']) ?  $user["data"]['id'] : "";
         $creater = $param['uname'];//isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
-//        $level = isset($this->post['level']) && $this->post['level'] !== "" ? trim($this->post['level']) : "1";
         Db::startTrans();
         try {
             $date = date('Y-m-d H:i:s');
@@ -76,25 +56,22 @@ class CustomerOrg extends BaseController
                 "createrid" => $createrid
             ];
             $t = Db::name($this->table_name)->insert($tada, true);
-            //var_dump(Db::name($this->table_name)->getLastSql());
             if ($t > 0) {
                 if (isset($spid)) $depart_link = $spid['depart_link'] . "{$t}-";
                 else $depart_link = "{$t}-";
 
                 $level = explode('-', $depart_link);
-                //  var_dump($level);
                 $level = array_filter($level);
                 $level = count($level);
                 $k = ['depart_link' => $depart_link, 'level' => $level];
                 $u = Db::name($this->table_name)->where(['id' => $t])->save($k);
-                // var_dump( Db::name($this->table_name)->getLastSql());
                 if ($u) {
                     Db::commit();
                     return json_show(0, "新建成功");
                 }
             }
-            throw new Exception('新建失败');
-        } catch (Exception $e) {
+            throw new \Exception('新建失败');
+        } catch (\Exception $e) {
             Db::rollback();
             return json_show(1003, $e->getMessage());
         }
@@ -104,62 +81,23 @@ class CustomerOrg extends BaseController
     {
 
         $param = $this->request->only(['pid' => 0, 'companyNo' => '', 'creater' => '', 'name' => '', 'start' => '', 'end' => '', 'status' => '', 'company_name' => ''], 'post', 'trim');
-//        $pid =  isset($this->post['pid']) &&$this->post['pid']!=="" ?intval($this->post['pid']): "0";
         $where = [['ci.is_del', "=", 0]];
 
         $condition = [['co.is_del', "=", 0]];
         if (intval($param['pid']) !== "") $condition[] = ["co.pid", "=", intval($param['pid'])];
-
-//        $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !=="" ? trim($this->post['companyNo']):"";
         if ($param['companyNo'] !== "") $where[] = ['ci.companyNo', "like", '%' . $param['companyNo'] . '%'];
-
-//        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
         if ($param['creater'] !== "") $where[] = ['ci.creater', "like", '%' . $param['creater'] . '%'];
-
-//        $name= isset($this->post['name'])&&$this->post['name']!=="" ? trim($this->post['name']):"";
         if ($param['name'] != "") $condition[] = ["co.name", "like", "%{$param['name']}%"];
-
-//        $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
         if ($param['start'] != "") $where[] = ["ci.addtime", '>=', $param['start']];
-
-//        $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
         if ($param['end'] != "") $where[] = ["ci.addtime", '<=', $param['end'] . ' 23:59:59'];
-
-//        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
         if ($param['status'] !== "") $where[] = ['ci.status', "=", $param['status']];
-
-//        $count = Db::name($this->table_name)->where($condition)->count();
-//        $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
-//        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
-//        if($creater !==""){
-//            $condition[] = ['co.creater',"like","%$creater%"];
-//        }
-//        $name= isset($this->post['name'])&&$this->post['name']!=="" ? trim($this->post['name']):"";
-//        if($name!=""){
-//            $condition[]=["co.name","like","%{$this->post['name']}%"];
-//        }
-//        $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
-//        if ($start != "") {
-//            $condition[] = ["co.addtime", '>=', $start];
-//        }
-//        $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
-//        if ($end != "") {
-//            $condition[] = ["co.addtime", '<=', $end];
-//        }
-//        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
-//        if($status!==""){
-//            $condition[] = ['co.status',"=",$status];
-//        }
-//        $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($param['company_name'] !== "") {
-//            $company_ids = get_company_item_user_by_name($param['company_name']);
             $where[] = ['c.name', "like", '%' . $param['company_name'] . '%'];
             $condition[] = ['c.name', "like", '%' . $param['company_name'] . '%'];
         }
 
         $pidlist = Db::name("customer_org1")
             ->alias('co')
-//            ->leftJoin("depart_user u", "u.uid=co.createrid AND u.is_del=0")
             ->where($condition)
             ->group('co.pid')
             ->column("co.pid");
@@ -179,58 +117,15 @@ class CustomerOrg extends BaseController
             ->order("co.addtime", 'desc')
             ->select()
             ->toArray();
-
-//        $all_createrid = array_column($list,'createrid');
-//        $all_item = get_company_name_by_uid($all_createrid);
-
-//        $var=[];
-//        foreach ($list as $item) {
-//            $iten=[];
-//            $iten['name']=$item['name'];
-////            $iten['code']="";
-//            $iten['id']=$item['id'];
-//            $iten['creater']=$item['creater'];
-//            $iten['status']=$item['status'];
-//            $iten['addtime']=$item['addtime'];
-//            $iten['kh']=0;//组织架构
-//            $iten['company_name'] = $all_item[$item['createrid']]??'';
-//
-//            $var[]=$iten;
-//        }
         $itm = Db::name('customer_info')
             ->alias('ci')
             ->field('ci.id,ci.companyName name,ci.companyNo code,ci.status,ci.creater,ci.addtime,1 kh,c.name company_name')
-//            ->leftJoin("depart_user u", "u.nickname=ci.creater AND u.is_del=0")
             ->leftJoin('account_item b', 'b.account_id=ci.createrid')
             ->leftJoin('company_item c', 'c.id=b.itemid')
             ->where($where)
             ->order("ci.addtime desc")
             ->select()
             ->toArray();
-
-//        foreach ($itm as $vat){
-//            $inm=[];
-//            $inm['name']=$vat['companyName'];
-//            $inm['id']=$vat['id'];
-//            $inm['code']=$vat['companyNo'];
-////            $inm['companyName']=$vat['companyName'];
-////            $inm['invoice_bank']=$vat['invoice_bank'];
-////            $inm['invoice_bankNo']=$vat['invoice_bankNo'];
-////            $inm['invoice_code']=$vat['invoice_code'];
-////            $inm['invoice_people']=$vat['invoice_people'];
-////            $inm['invoice_mobile']=$vat['invoice_mobile'];
-////            $inm['invoice_addr']=$vat['invoice_addr'];
-////            $inm['parent']=$vat['parent'];
-////            $inm['branch']=$vat['branch'];
-////            $inm['middle']=$vat['middle'];
-////            $inm['country']=$vat['country'];
-//            $inm['status']=$vat['status'];
-//            $inm['creater']=$vat['creater'];
-//            $inm['addtime']=$vat['addtime'];
-//            $inm['kh']=1;//客户
-//            $inm['company_name'] = '待处理';
-//            $var[]=$inm;
-//        }
         return json_show(0, "获取成功", array_merge($list, $itm));
     }
 
@@ -250,25 +145,13 @@ class CustomerOrg extends BaseController
         ]);
 
         if ($val->check($param) == false) return json_show(1004, $val->getError());
-
-//        $id = isset($this->post['id'])?intval($this->post['id']):"";
-//        if($id===""){
-//            return json_show(1004,"参数id不能为空");
-//        }
         $sid = Db::name($this->table_name)
             ->field('id,status')
             ->where("id", $param['id'])
             ->findOrEmpty();
-        // var_dump(Db::name($this->table_name)->getLastSql());
         if (empty($sid)) return json_show(1004, "公司不存在");
 
         if ($sid['status'] == 1) return json_show(1002, "状态是启用状态,无法编辑");
-
-//        $pid = isset($this->post['pid']) && $this->post['pid'] !=="" ? intval($this->post['pid']):"";
-//        if($pid===""){
-//            return json_show(1004,"父级id不能为空");
-//        }
-
         if ($param['pid'] != 0) {
             $fpid = Db::name($this->table_name)
                 ->field('id,depart_link')
@@ -276,20 +159,11 @@ class CustomerOrg extends BaseController
                 ->findOrEmpty();
             if (empty($fpid)) return json_show(1004, "父级不能为空");
         }
-
-//        $weight = isset($this->post['weight']) && $this->post['weight'] !==""? intval($this->post['weight']):"0";
-
-//      $level = isset($this->post['level']) && $this->post['level'] !==""? intval($this->post['level']):"";
-//        $name = isset($this->post['name'])? trim($this->post['name']):"";
-//        if($name==""){
-//            return json_show(1004,"公司名称不能为空");
-//        }
         $repeat_name = Db::name($this->table_name)
             ->field('id')
             ->where(["is_del" => 0, "name" => $param['name'], 'pid' => $param['pid']])
             ->where("id", "<>", $param['id'])
             ->findOrEmpty();
-        // echo Db::name($this->table_name)->getLastSql();
         if (!empty($repeat_name)) return json_show(1004, "部门名称已存在");
 
         if (isset($fpid)) $depart_link = $fpid['depart_link'] . $param['id'] . "-";
@@ -310,11 +184,6 @@ class CustomerOrg extends BaseController
         $org = Db::name($this->table_name)->save($vir);
 
         return $org ? json_show(0, "更新成功") : json_show(1004, "更新失败");
-//        if($org)
-//            return json_show(0,"更新成功");
-//        else{
-//            return json_show(1004,"更新失败");
-//        }
     }
 
     public function info()
@@ -368,24 +237,6 @@ class CustomerOrg extends BaseController
         ]);
 
         if ($val->check($param) == false) return json_show(1004, $val->getError());
-//        $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']):"";
-//        if($id==""){
-//            return json_show(1002,"参数id不能为空");
-//        }
-//        $info =  Db::name("customer_org1")->where([["id","=",$id]])->find();
-//        if(!$info){
-//            return json_show(1002,"未找到对应数据");
-//        }
-//        $status =  isset($this->post['status']) && $this->post['status']!==""? intval($this->post['status']):"";
-//        if($status===""){
-//            return json_show(1002,"参数status不能为空");
-//        }
-//        if(!in_array($status,[0,1])){
-//            return json_show(1002,"参数status无效");
-//        }
-//        $info['status']=$status;
-//        $info['updatetime']=date("Y-m-d H:i:s");
-//        $msg = $status==1?"启用":"禁用";
         $update = Db::name("customer_org1")
             ->where(['is_del' => 0, 'id' => $param['id']])
             ->where('status', '<>', $param['status'])

+ 60 - 89
app/controller/Headquarters.php

@@ -8,6 +8,7 @@ use app\model\AccountCompany;
 use think\Exception;
 use think\facade\Db;
 use think\facade\Validate;
+use think\facade\Cache;
 
 //【公司汇总】
 class Headquarters extends BaseController
@@ -88,11 +89,11 @@ class Headquarters extends BaseController
                     'addtime' => date('Y-m-d H:i:s'),
                     'updater' => $post['updater'],
                     'updaterid' => $post['updaterid'],
-                    'updater' => date('Y-m-d H:i:s'),
+                    'updatetime' => date('Y-m-d H:i:s'),
                 ]);
 
             Db::commit();
-
+			Cache::store("redis")->handler()->lpush("companycopy",$post);
             return json_show(0, '添加成功');
 
         } catch (Exception $e) {
@@ -138,11 +139,11 @@ class Headquarters extends BaseController
                     'remark' => $post['remark'],
                     'updater' => $post['updater'],
                     'updaterid' => $post['updaterid'],
-                    'updater' => date('Y-m-d H:i:s'),
+                    'updatetime' => date('Y-m-d H:i:s'),
                 ]);
 
             Db::commit();
-
+	        Cache::store("redis")->handler()->lpush("companycopy",json_encode($post,JSON_UNESCAPED_UNICODE));
             return json_show(0, '修改成功');
 
         } catch (Exception $e) {
@@ -457,6 +458,8 @@ class Headquarters extends BaseController
             ]);
 
             Db::commit();
+	        $param['type']=1;
+	        Cache::store("redis")->handler()->lpush("companycopy",json_encode($param,JSON_UNESCAPED_UNICODE));
             return json_show(0, '添加成功');
         } catch (Exception $exception) {
             Db::rollback();
@@ -510,6 +513,8 @@ class Headquarters extends BaseController
                 ]);
 
             Db::commit();
+	        $param['type']=1;
+	        Cache::store("redis")->handler()->lpush("companycopy",json_encode($param,JSON_UNESCAPED_UNICODE));
             return json_show(0, '修改成功');
         } catch (Exception $exception) {
             Db::rollback();
@@ -625,6 +630,8 @@ class Headquarters extends BaseController
             ]);
 
             Db::commit();
+	        $param['data']['type']=3;
+	        Cache::store("redis")->handler()->lpush("companycopy",json_encode($param['data'],JSON_UNESCAPED_UNICODE));
             return json_show(0, '添加成功', ['id' => $id]);
         } catch (Exception $exception) {
             Db::rollback();
@@ -702,6 +709,8 @@ class Headquarters extends BaseController
                 ]);
 
             Db::commit();
+	        $param['data']['type']=3;
+	        Cache::store("redis")->handler()->lpush("companycopy",json_encode($param['data'],JSON_UNESCAPED_UNICODE));
             return json_show(0, '修改成功', ['id' => $id]);
         } catch (Exception $exception) {
             Db::rollback();
@@ -751,7 +760,7 @@ class Headquarters extends BaseController
 
         $item = Db::name('customer_info')
             ->where($where)
-            ->field("id,companyNo,companyName,LENGTH(companyName) as weight")
+            ->field("id,companyNo,companyName,area,LENGTH(companyName) as weight")
             ->order(['weight' => 'asc', 'id' => 'desc'])
             ->page($param['page'], $param['size'])
             ->select()
@@ -763,27 +772,29 @@ class Headquarters extends BaseController
 
     public function cCreate()
     {
-        $param = $this->request->only(['companyName', 'parent' => 0, 'customer_member', 'uid', 'uname'], 'post', 'trim');
+        $param = $this->request->only([
+        	'companyName',
+        	'parent' => 0,
+        	'customer_member',
+        	'uid',
+        	'uname',
+        	'branch',
+        	'middle',
+        	'area',
+        	], 'post', 'trim');
 
         $val = Validate::rule([
-            'companyName' => 'require',
-            'customer_member' => 'require|array|max:100',
+            'companyName|客户名称' => 'require',
+            'customer_member|联系方式' => 'require|array|max:100',
             'uid' => 'require|number|gt:0',
-            'uname' => 'require',
+            'uname|创建人' => 'require',
+            'branch|省级' => 'require',
+            'middle|市级' => 'require',
+            'area|区域' => 'require',
         ]);
 
         if ($val->check($param) == false) return json_show(1004, $val->getError());
-
-//        $token = isset($this->post['token']) && $this->post['token'] != '' ? trim($this->post['token']) : "";
-//        if ($token == '') {
-//            return json_show(1005, "参数token不能为空");
-//        }
         $companyNo = makeNo("KH");
-//        $companyName = isset($this->post['companyName']) && $this->post['companyName'] !== "" ? $this->post['companyName'] : "";
-//        if ($companyName == "") {
-//            return json_show(1002, "参数companyName不能为空");
-//        }
-//        $parent = isset($this->post['parent']) && $this->post['parent'] !== "" ? intval($this->post['parent'] ) : "";
         $rename = Db::name('customer_org1')
             ->field('id')
             ->where(['is_del' => 0, 'id' => $param['parent']])
@@ -794,23 +805,6 @@ class Headquarters extends BaseController
             ->findOrEmpty();
 
         if (!empty($item)) return json_show(1002, "公司名称已存在");
-
-//        if ($parent === "") {
-//            return json_show(1002, "参数parent不能为空");
-//        }
-        //$itemid = isset($this->post['itemid']) && $this->post['itemid'] !== "" ? intval($this->post['itemid'] ) : "";
-//        $customer_member = isset($this->post['customer_member']) && $this->post['customer_member'] !== "" ? $this->post['customer_member'] : "";
-//        if ($customer_member == "") {
-//            return json_show(1002, "参数customer_member不能为空");
-//        }
-//        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
-//        if($status==""){
-//            return json_show(1002,"参数status不能为空");
-//        }
-//        $user = GetUserInfo($token);
-//        if (empty($user) || $user['code'] != 0) {
-//            return json_show(102, "创建人数据不存在");
-//        }
         $createrid = $param['uid'];//isset($user["data"]['id']) ? $user["data"]['id'] : "";
         $creater = $param['uname'];//isset($user["data"]['nickname']) ? $user["data"]['nickname'] : "";
         Db::startTrans();
@@ -823,31 +817,13 @@ class Headquarters extends BaseController
                 "companyName" => $param['companyName'],
                 "parent" => $param['parent'],
                 "itemid" => $param['parent'],
-                "area" => "",
-                "comdepart" => "",
-                "commobile" => "",
-                "comtel" => "",
-                "contactor" => "",
-                "depart" => "",
-                "mobile" => "",
-                "invoice_title" => "",
-                "invoice_people" => "",
-                "invoice_addr" => "",
-                "invoice_mobile" => "",
-                "invoice_code" => "",
-                "invoice_bank" => "",
-                "invoice_bankNo" => "",
-                "companyCode" => "",
+                "area" =>$param['area'],
                 "status" => 0,
-                "sales_name" => "",
-                "sales_depart" => "",
-                "branch" => "",
-                "middle" => "",
-                "country" => "",
+                "branch" =>$param['branch'],
+                "middle" =>$param['middle'],
                 "is_del" => 0,
                 "createrid" => $createrid,
                 "creater" => $creater,
-                "modifier" => "",
                 "addtime" => $date,
                 "updatetime" => $date,
             ];
@@ -893,6 +869,8 @@ class Headquarters extends BaseController
                     ]);
 
                 Db::commit();
+	            $data['type']=2;
+	            Cache::store("redis")->handler()->lpush("companycopy",json_encode($data,JSON_UNESCAPED_UNICODE));
                 return json_show(0, "新建成功");
             } else throw new Exception('新建失败');
         } catch (Exception $e) {
@@ -904,23 +882,17 @@ class Headquarters extends BaseController
     public function cList()
     {
         $param = $this->request->only(['page' => 1, 'size' => 10, 'companyName' => '', 'status' => '', 'creater' => '', 'start' => '', 'end' => ''], 'post', 'trim');
-
-//        $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
-//        $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
         $where = [["a.is_del", "=", 0]];
-//        $companyName = isset($this->post['companyName']) && $this->post['companyName'] !== "" ? trim($this->post['companyName']) : "";
+
         if ($param['companyName'] != "") $where[] = ['b.companyName', "like", '%' . $param['companyName'] . '%'];
 
-//        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']) :"";
+
         if ($param['status'] !== "") $where[] = ['status', "=", $param['status']];
 
-//        $creater = isset($this->post['creater']) && $this->post['creater'] !== "" ? intval($this->post['creater']) : "";
         if ($param['creater'] != "") $where[] = ['a.creater', "like", '%' . $param['creater'] . '%'];
 
-//        $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
         if ($param['start'] !== "") $where[] = ['a.addtime', ">=", date('Y-m-d H:i:s', strtotime($param['start']))];
 
-//        $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
         if ($param['end'] !== "") $where[] = ['a.addtime', "<", date('Y-m-d H:i:s', strtotime($param['end']) + 24 * 3600)];
 
         $count = Db::name('customer_member')
@@ -936,7 +908,7 @@ class Headquarters extends BaseController
             ->where($where)
             ->page($page, $param['size'])
             ->order("addtime desc")
-            ->field("a.*,b.companyName,b.parent")
+            ->field("a.*,b.companyName,b.parent,b.area")
             ->select()
             ->toArray();
         return json_show(0, "获取成功", ['list' => $list, 'count' => $count]);
@@ -944,15 +916,29 @@ class Headquarters extends BaseController
 
     public function cEdit()
     {
-        $param = $this->request->only(['id', 'companyName', 'parent', 'customer_member', 'uid', 'uname'], 'post', 'trim');
+        $param = $this->request->only([
+        	'id',
+        	'companyName',
+        	'parent',
+        	'customer_member',
+        	'uid',
+        	'uname',
+        	'branch',
+        	'middle',
+        	'area',
+        	], 'post', 'trim');
 
         $val = Validate::rule([
             'id' => 'require|number|gt:0',
-            'companyName' => 'require',
+            'companyName|客户名称' => 'require',
             'parent' => 'require',
-            'customer_member' => 'require|array|max:100',
+            'customer_member|联系方式' => 'require|array|max:100',
             'uid' => 'require|number|gt:0',
-            'uname' => 'require',]);
+            'uname|修改人' => 'require',
+            'branch|省级'=> 'require',
+        	'middle|市级'=> 'require',
+        	'area|区域'=> 'require',
+            ]);
 
         if ($val->check($param) == false) return json_show(1004, $val->getError());
 
@@ -983,7 +969,9 @@ class Headquarters extends BaseController
             $data = [
                 "id" => $param['id'],
                 "companyName" => $param['companyName'],
-                //"companyNo" => $companyNo,
+                "area" =>$param['area'],
+                "branch" =>$param['branch'],
+                "middle" =>$param['middle'],
                 "parent" => $param['parent'],
                 "updatetime" => $date,
             ];
@@ -992,18 +980,10 @@ class Headquarters extends BaseController
             if ($datainfo) {
 
                 foreach ($param['customer_member'] as $value) {
-//                    $to = GetInfoById($token, ['id' => $value['ownerid']]);
-//
-//                    if (empty($to) || $to['code'] != 0) {
-//                        return json_show(1002, "数据拥有者信息不存在");
-//                    }
+
                     $item = [];
-//                    $info = $to['data'];
-//                    $item['owner'] = $info['nickname'];
-//                    $item['ownerid'] = $info['id'];
                     $item['commobile'] = isset($value['commobile']) ? $value['commobile'] : "";
                     $item['comtel'] = "";
-                    //  $item['id'] =isset($value['id']) ? $value['id'] : "";
                     isset($value['id']) && $value['id'] !== "" ? $item['id'] = $value['id'] : '';
                     $item['contactor'] = isset($value['contactor']) ? $value['contactor'] : "";
                     $item['position'] = isset($value['position']) ? $value['position'] : "";
@@ -1011,7 +991,6 @@ class Headquarters extends BaseController
                     $item['qqaccount'] = isset($value['qqaccount']) ? $value['qqaccount'] : "";
                     $item['email'] = isset($value['email']) ? $value['email'] : "";
                     $item['comdepart'] = isset($value['comdepart']) ? $value['comdepart'] : "";
-                    //   $item['is_private'] = isset($value['is_private']) ? $value['is_private'] : "";
                     $item['status'] = $value['status'];
                     $item['createrid'] = $createrid;
                     $item['creater'] = $creater;
@@ -1019,15 +998,8 @@ class Headquarters extends BaseController
                     $item['is_del'] = 0;
                     $item['addtime'] = $date;
                     $item['updatetime'] = $date;
-                    // $var[]=$item;
-
                     $vp = Db::name('customer_member')->save($item);
-
-//                  var_dump(Db::name('customer_member')->getLastSql());
-//                $var = array_diff($customer_member,$item);
-//                $jsn = json_encode($var);
                     if ($vp == false) throw new Exception('更新失败');
-
                 }
 
                 //更新汇总表
@@ -1039,7 +1011,6 @@ class Headquarters extends BaseController
                         'updaterid' => $param['uid'],
                         "updatetime" => $date,
                     ]);
-
                 Db::commit();
                 return json_show(0, "更新成功");
             } else throw new Exception("更新失败");