diff --git a/niucloud/app/api/controller/apiController/ResourceSharing.php b/niucloud/app/api/controller/apiController/ResourceSharing.php index e87b153c..b2eb8cc6 100644 --- a/niucloud/app/api/controller/apiController/ResourceSharing.php +++ b/niucloud/app/api/controller/apiController/ResourceSharing.php @@ -28,9 +28,10 @@ class ResourceSharing extends BaseApiService { $user_id = $this->member_id;//当前登陆的用户id - $page = $request->param('page','1');// - $limit = $request->param('limit','10');// $shared_by = $request->param('shared_by','');//共享人ID + $name = $request->param('name','');////客户资源表-姓名 + $phone_number = $request->param('phone_number','');//客户资源表-手机号 + $shared_at_str = $request->param('shared_at_str','');//共享时间|[开始时间(Y-m-d),结束时间(Y-m-d)] $shared_at_arr = []; if(!empty($shared_at_str)){ @@ -42,6 +43,8 @@ class ResourceSharing extends BaseApiService $where = [ 'shared_by'=>$shared_by, 'shared_at_arr'=>$shared_at_arr, + 'name'=>$name, + 'phone_number'=>$phone_number, ]; $res= (new ResourceSharingService())->getList($where); return success($res); diff --git a/niucloud/app/model/customer_resources/CustomerResources.php b/niucloud/app/model/customer_resources/CustomerResources.php index 30a93c58..cee4efec 100644 --- a/niucloud/app/model/customer_resources/CustomerResources.php +++ b/niucloud/app/model/customer_resources/CustomerResources.php @@ -89,7 +89,8 @@ class CustomerResources extends BaseModel 'updated_at' => '更新时间', 'deleted_at' => '逻辑删除时间', 'status' => '客户状态', - 'member_label' => '资源标签' + 'member_label' => '资源标签', + 'member_id' => '客户登录标识' ]; public function orderTable() diff --git a/niucloud/app/service/api/apiService/ResourceSharingService.php b/niucloud/app/service/api/apiService/ResourceSharingService.php index 7024ab7f..58a672f9 100644 --- a/niucloud/app/service/api/apiService/ResourceSharingService.php +++ b/niucloud/app/service/api/apiService/ResourceSharingService.php @@ -12,6 +12,7 @@ namespace app\service\api\apiService; use app\model\campus_person_role\CampusPersonRole; +use app\model\customer_resources\CustomerResources; use app\model\order_table\OrderTable; use app\model\resource_sharing\ResourceSharing; use core\base\BaseApiService; @@ -47,8 +48,25 @@ class ResourceSharingService extends BaseApiService ->distinct(true) ->column('person_id'); + $resource_id_arr = [];//客户资源表id + //客户资源表名字 + if(!empty($where['name'])){ + $resource_id = (new CustomerResources())->where('name', 'like', "%{$where['name']}%")->column('id'); + $resource_id_arr = array_merge($resource_id_arr,$resource_id); + } + //客户资源表手机号 + if(!empty($where['phone_number'])){ + $resource_id = (new CustomerResources())->where('phone_number', 'like', "%{$where['phone_number']}%")->column('id'); + $resource_id_arr = array_merge($resource_id_arr,$resource_id); + } + //去重 + $resource_id_arr = array_unique($resource_id_arr); + $model = $this->model; + if($resource_id_arr){ + $model = $model->whereIn('resource_id',$resource_id_arr); + } if ((!empty($where['shared_by']) || isset($where['shared_by'])) && $where['shared_by'] !== '') { $model = $model->where('shared_by', $where['shared_by']);