Browse Source

编辑客户资料

lizhen_gitee 6 months ago
parent
commit
0795fbfc85
1 changed files with 29 additions and 2 deletions
  1. 29 2
      application/company/controller/Usercompany.php

+ 29 - 2
application/company/controller/Usercompany.php

@@ -55,7 +55,7 @@ class Usercompany extends Apic
 
     //添加客户
     public function add(){
-        $mobile = input('mobile','');
+        $mobile = input('user_mobile','');
         if(empty($mobile)){
             $this->error('手机号必填');
         }
@@ -67,7 +67,7 @@ class Usercompany extends Apic
         }
 
         //注册到用户表
-        $nickname = input('nickname','');
+        $nickname = input('user_nickname','');
         if(empty($nickname)){
             $this->error('客户名称必填');
         }
@@ -141,6 +141,33 @@ class Usercompany extends Apic
             $this->error('没找到该信息,请刷新重试');
         }
 
+        //修改用户
+        $mobile = input('user_mobile','');
+        if(empty($mobile)){
+            $this->error('手机号必填');
+        }
+
+        //检查用户
+        $find = Db::name('user')->where('mobile',$mobile)->where('id','!=',$info['user_id'])->find();
+        if($find){
+            $this->error('该手机号已被注册为客户');
+        }
+
+        //修改昵称
+        $nickname = input('user_nickname','');
+        if(empty($nickname)){
+            $this->error('客户名称必填');
+        }
+        $extend = [
+            'nickname' => $nickname,
+            'mobile'   => $mobile,
+        ];
+        $update_rs = Db::name('user')->where('id',$info['user_id'])->update($extend);
+        if($update_rs === false){
+            $this->error('操作失败');
+        }
+
+        //
         $zuobiao = input('zuobiao','','trim');
         $zuobiao = explode(',',$zuobiao);