cqp 1 месяц назад
Родитель
Сommit
0637f66fb1

+ 13 - 0
app/Http/Controllers/Api/WeixinController.php

@@ -87,4 +87,17 @@ class WeixinController extends BaseController
             return $this->json_return(201, $data);
         }
     }
+
+    public function delWxBind(Request $request)
+    {
+        $service = new WxEmployeeService();
+        $user = $request->userData;
+        list($status,$data) = $service->delWxBind($request->all(),$user);
+
+        if($status){
+            return $this->json_return(200,'',$data);
+        }else{
+            return $this->json_return(201,$data);
+        }
+    }
 }

+ 1 - 1
app/Model/CustomerSupply.php

@@ -10,7 +10,7 @@ class CustomerSupply extends UseScopeBaseModel
     const UPDATED_AT = 'upd_time';
     const employee_column = "crt_id";
 
-    public static $field = ['title','id','code','type','crt_time','account','crt_id','status','password'];
+    public static $field = ['title','id','code','type','crt_time','account','crt_id','status','password','mobile'];
 
     protected $dateFormat = 'U';
     const status_one = 1;

+ 1 - 0
app/Service/CustomerSupplyService.php

@@ -217,6 +217,7 @@ class CustomerSupplyService extends Service
 
         if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
         if(! empty($data['code'])) $model->where('code', 'LIKE', '%'.$data['code'].'%');
+        if(! empty($data['mobile'])) $model->where('mobile', 'LIKE', '%'.$data['mobile'].'%');
         if(! empty($data['type'])) $model->where('type', $data['type']);
         if(! empty($data['id'])) $model->whereIn('id', $data['id']);
         if(! empty($data['crt_id'])) $model->whereIn('crt_id', $data['crt_id']);

+ 11 - 0
app/Service/Weixin/WxEmployeeService.php

@@ -136,4 +136,15 @@ class WxEmployeeService extends Service
             }
         }
     }
+
+    public function delWxBind($data, $user){
+        if(empty($data['id'])) return [false, 'ID不能为空'];
+        if(empty($data['type'])) return [false, 'type不能为空'];
+
+        WxEmployeeOfficial::whereIn('employee_id', $data['id'])
+            ->where('type', $data['type'])
+            ->delete();
+
+        return [true, ''];
+    }
 }

+ 4 - 0
config/header/66.php

@@ -14,6 +14,10 @@ return [
         'key' =>'title',
         'value' => '名称',
     ],
+    [
+        'key' =>'mobile',
+        'value' => '手机号码',
+    ],
     [
         'key' =>'account',
         'value' => '微信公众号分配账号',

+ 3 - 0
routes/api.php

@@ -102,6 +102,9 @@ Route::group(['middleware'=> ['checkLogin']],function ($route){
     $route->any('customerSupplyDel', 'Api\CustomerSupplyController@customerSupplyDel');
     $route->any('customerSupplyDetail', 'Api\CustomerSupplyController@customerSupplyDetail');
 
+    //解除供应商绑定
+    $route->any('delWxBind', 'Api\WeixinController@delWxBind');
+
     //维度选项
     $route->any('dimensionList', 'Api\DimensionController@dimensionList');
     $route->any('dimensionEdit', 'Api\DimensionController@dimensionEdit');