member_id;//当前登陆的用户id $shared_by = $request->param('shared_by','');//共享人ID $name = $request->param('name','');////客户资源表-姓名 $phone_number = $request->param('phone_number','');//客户资源表-手机号 $campus_name = $request->param('campus_name','');//客户资源表-校区 // 新增搜索参数 $source = $request->param('source','');//来源类型 $source_channel = $request->param('source_channel','');//来源渠道 $attendance_type = $request->param('attendance_type','');//到课类型 $deal_type = $request->param('deal_type','');//成交类型 $valid_type = $request->param('valid_type','');//资源有效类型 $communication_status = $request->param('communication_status','');//沟通情况 $course_search = $request->param('course_search','');//课程检索 $shared_at_str = $request->param('shared_at_str','');//共享时间|[开始时间(Y-m-d),结束时间(Y-m-d)] $shared_at_arr = []; if(!empty($shared_at_str)){ $shared_at_arr = explode(' ~ ',$shared_at_str); $shared_at_arr[0] = "{$shared_at_arr[0]} 00:00:00"; $shared_at_arr[1] = "{$shared_at_arr[1]} 23:59:59"; } $where = [ 'shared_by'=>$shared_by, 'shared_at_arr'=>$shared_at_arr, 'name'=>$name, 'phone_number'=>$phone_number, 'campus_name' => $campus_name, 'source' => $source, 'source_channel' => $source_channel, 'attendance_type' => $attendance_type, 'deal_type' => $deal_type, 'valid_type' => $valid_type, 'communication_status' => $communication_status, 'course_search' => $course_search ]; $res = (new ResourceSharingService())->getList($where); return success($res); } //资源共享-详情 public function info(Request $request) { $resource_sharing_id = $request->param('resource_sharing_id','');//资源共享表id if(!$resource_sharing_id){ return fail('缺少参数'); } $where = [ 'id' => $resource_sharing_id ]; $res = (new ResourceSharingService())->info($where); if (!$res['code']) { return fail($res['msg']); } return success($res['data']); } //把资源分配给指定员工 public function assign(Request $request) { $id = $request->param('resource_sharing_id', '');//资源共享表 $shared_by = $request->param('shared_by', '');//共享人ID if (empty($id) || empty($shared_by)) { return fail('缺少必要参数'); } $where = [ 'id' => $id, ]; $data = [ 'shared_by' => $shared_by ]; $info = (new ResourceSharingService())->info($where);//获取详情 if (!$info['code']) { return fail($info['msg']); } else { if ($info['data']['shared_by'] > 0) { if ($info['data']['shared_by'] == $shared_by) { return success('当前资源已分享给该用户'); } else { return fail('该资源已被分享给其他用户'); } } } $res = (new ResourceSharingService())->editData($where, $data);//更新 if (!$res['code']) { return fail('操作失败'); } return success('操作成功'); } }