all(),[ 'corpid' => 'required', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); list($res, $code) = wechatWorkService::getCorCustomerList($corpid); return self::returnValue($res, $code); } //(废弃) public function transferCustomer(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'handover_userid' => 'required', 'takeover_userid' => 'required', 'external_userid_list' => 'required|array', 'type' => 'required|in:1,2', 'select_all' => 'nullable|in:0,1' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $handoverUserId = $request->input('handover_userid'); $takeoverUserId = $request->input('takeover_userid'); $externalUserIdList = $request->input('external_userid_list'); $transferSuccessMsg = $request->input('transfer_success_msg'); $type = $request->input('type'); $selectAll = $request->input('select_all',0); list($data, $code) = CustomerService::addCustomerAssignment($corpid, $handoverUserId, $takeoverUserId, $externalUserIdList, $transferSuccessMsg, $type, $selectAll); return self::returnValue($data, $code); } // 客户迁移 public function transferCustomerNew(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'takeover_userid' => 'required', 'external_user_list' => 'nullable|array', 'type' => 'required|in:1,2', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $takeoverUserId = $request->input('takeover_userid'); $externalUserList = $request->input('external_user_list'); $transferSuccessMsg = $request->input('transfer_success_msg'); $type = $request->input('type'); $portraitInheritance = $request->input('portrait_inheritance', 1); $selectAll = $request->input('select_all',0); $filterCustomerList = $request->input('filter_customer_list'); $params['customer_name'] = $request->input('customer_name'); // 客户名关键字 $params['user_id_list'] = $request->input('user_id_list'); // 所属客服 $params['add_date_start'] = $request->input('add_date_start'); // 起始添加日期 $params['add_date_end'] = $request->input('add_date_end'); // 截止添加日期 $params['add_way'] = $request->input('add_way'); // 添加渠道 $params['pay_status'] = $request->input('pay_status'); // 付费状态 $params['pay_num_min'] = $request->input('pay_num_min'); // 最小付费次数 $params['pay_num_max'] = $request->input('pay_num_max'); // 最高付费次数 $params['tag_type'] = $request->input('tag_type', 0); // 标签筛选类型 0未筛选 1满足其一 2同时满足 3无标签 $params['tag_id_list'] = $request->input('tag_id_list'); // 标签列表 list($data, $code) = CustomerService::addCustomerAssignmentNew($corpid, $takeoverUserId, $externalUserList, $transferSuccessMsg, $type, $portraitInheritance, $selectAll, $filterCustomerList, $params); return self::returnValue($data, $code); } // 待分配的离职成员客户列表 public function unassignedCustomerList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'user_id_list' => 'nullable|array', 'add_date_start' => 'nullable|date', 'add_date_end' => 'nullable|date', 'add_way' => 'nullable|in:0,1,3,4,5,6,8,9,10,201,202', 'pay_status' => 'nullable|in:0,1', 'pay_num_min' => 'nullable|numeric|min:0', 'pay_num_max' => 'nullable|numeric', 'tag_type' => 'required|in:0,1,2,3', 'tag_id_list' => 'nullable|array|required_if:tag_type,1,2', 'page' => 'required|numeric|min:1', 'page_size' => 'required|numeric' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $customerName = $request->input('customer_name'); // 客户名关键字 $userIdList = $request->input('user_id_list'); // 所属客服 $addDateStart = $request->input('add_date_start'); // 起始添加日期 $addDateEnd = $request->input('add_date_end'); // 截止添加日期 $addWay = $request->input('add_way'); // 添加渠道 $payStatus = $request->input('pay_status'); // 付费状态 $payNumMin = $request->input('pay_num_min'); // 最小付费次数 $payNumMax = $request->input('pay_num_max'); // 最高付费次数 $tagType = $request->input('tag_type', 0); // 标签筛选类型 0未筛选 1满足其一 2同时满足 3无标签 $tagIdList = $request->input('tag_id_list'); // 标签列表 $corpid = $request->input('corpid'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($data, $count) = CustomerService::unassignedCustomerList($customerName, $userIdList, $addDateStart, $addDateEnd, $addWay, $payStatus, $payNumMin, $payNumMax, $tagType, $tagIdList, $corpid, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } // 客户来源检索框列表 public function addWayList(Request $request) { $data = CustomerService::addWayList(); return self::returnValue($data); } // 客户管理列表 public function customerList(Request $request) { ini_set('memory_limit', '-1'); $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'user_id_list' => 'nullable|array', 'add_date_start' => 'nullable|date', 'add_date_end' => 'nullable|date', 'last_pay_time_start' => 'nullable|date', 'last_pay_time_end' => 'nullable|date', 'pay_status' => 'nullable|in:0,1', 'pay_num_min' => 'nullable|numeric|min:0', 'pay_num_max' => 'nullable|numeric', 'tag_type' => 'required|in:0,1,2,3', 'tag_id_list' => 'nullable|array|required_if:tag_type,1,2', 'page' => 'required|numeric|min:1', 'page_size' => 'required|numeric', 'is_new_customer_no_loss' => 'nullable|in:0,1', 'can_receive' => 'nullable|in:0,1', 'retained_status' => 'nullable|in:0,1', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['customer_name'] = $request->input('customer_name'); // 客户名关键字 $params['user_id_list'] = $request->input('user_id_list'); // 所属客服 $params['add_date_start'] = $request->input('add_date_start'); // 起始添加日期 $params['add_date_end'] = $request->input('add_date_end'); // 截止添加日期 $params['last_pay_time_start'] = $request->input('last_pay_time_start'); // 最近一次充值时间起始 $params['last_pay_time_end'] = $request->input('last_pay_time_end'); // 最近一次充值时间截止 $params['add_way'] = $request->input('add_way'); // 添加渠道 $params['gender'] = $request->input('gender'); // 客户性别 $params['pay_status'] = $request->input('pay_status'); // 付费状态 $params['pay_num_min'] = $request->input('pay_num_min'); // 最小付费次数 $params['pay_num_max'] = $request->input('pay_num_max'); // 最高付费次数 $params['tag_type'] = $request->input('tag_type', 0); // 标签筛选类型 0未筛选 1满足其一 2同时满足 3无标签 $params['tag_id_list'] = $request->input('tag_id_list'); // 标签列表 $params['loss_status'] = $request->input('loss_status'); // 客户流失状态 $params['corpid'] = $request->input('corpid'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $source = $request->input('source', 1); $params['loss_time_start'] = $request->input('loss_time_start'); $params['loss_time_end'] = $request->input('loss_time_end'); $params['is_new_customer_no_loss'] = $request->input('is_new_customer_no_loss');# 是否为新用户 0复粉 1新用户 $params['can_receive'] = $request->input('can_receive'); // 是否可正常接收群发消息 0否 1是 $params['retained_status'] = $request->input('retained_status'); // 是否在当前主体内还有留存 0否 1是 list($data, $count, $extra) = CustomerService::customerList($params, $page, $pageSize, $source); return self::returnPageValue($data, $count, $pageSize, $page, $extra); } /** * 客服客户数统计(筛选数据项同客户列表保持一致) * @param Request $request */ public static function customerCountStat(Request $request) { ini_set('memory_limit', '-1'); $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'user_id_list' => 'nullable|array', 'add_date_start' => 'nullable|date', 'add_date_end' => 'nullable|date', 'last_pay_time_start' => 'nullable|date', 'last_pay_time_end' => 'nullable|date', 'pay_status' => 'nullable|in:0,1', 'pay_num_min' => 'nullable|numeric|min:0', 'pay_num_max' => 'nullable|numeric', 'tag_type' => 'required|in:0,1,2,3', 'tag_id_list' => 'nullable|array|required_if:tag_type,1,2', 'is_new_customer_no_loss' => 'nullable|in:0,1', 'can_receive' => 'nullable|in:0,1', 'retained_status' => 'nullable|in:0,1', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['customer_name'] = $request->input('customer_name'); // 客户名关键字 $params['user_id_list'] = $request->input('user_id_list'); // 所属客服 $params['add_date_start'] = $request->input('add_date_start'); // 起始添加日期 $params['add_date_end'] = $request->input('add_date_end'); // 截止添加日期 $params['last_pay_time_start'] = $request->input('last_pay_time_start'); // 最近一次充值时间起始 $params['last_pay_time_end'] = $request->input('last_pay_time_end'); // 最近一次充值时间截止 $params['add_way'] = $request->input('add_way'); // 添加渠道 $params['gender'] = $request->input('gender'); // 客户性别 $params['pay_status'] = $request->input('pay_status'); // 付费状态 $params['pay_num_min'] = $request->input('pay_num_min'); // 最小付费次数 $params['pay_num_max'] = $request->input('pay_num_max'); // 最高付费次数 $params['tag_type'] = $request->input('tag_type', 0); // 标签筛选类型 0未筛选 1满足其一 2同时满足 3无标签 $params['tag_id_list'] = $request->input('tag_id_list'); // 标签列表 $params['loss_status'] = $request->input('loss_status'); // 客户流失状态 $params['corpid'] = $request->input('corpid'); $params['loss_time_start'] = $request->input('loss_time_start'); $params['loss_time_end'] = $request->input('loss_time_end'); $params['is_new_customer_no_loss'] = $request->input('is_new_customer_no_loss');# 是否为新用户 0复粉 1新用户 $params['can_receive'] = $request->input('can_receive'); // 是否可正常接收群发消息 0否 1是 $params['retained_status'] = $request->input('retained_status'); // 是否在当前主体内还有留存 0否 1是 $data = CustomerService::customerCountStat($params); return self::returnValue($data); } // 客户详情概览 public function customerDetail(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'customer_id' => 'required|integer', 'user_id' => 'required|string' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerId = $request->input('customer_id'); $userId = $request->input('user_id'); list($data, $code) = CustomerService::customerDetail($corpid, $customerId, $userId); return self::returnValue($data, $code); } // 客户详情概览 public function customerDetails(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'customer_id' => 'required|integer', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerId = $request->input('customer_id'); list($data, $code) = CustomerService::customerDetails($corpid, $customerId); return self::returnValue($data, $code); } // 客户订单列表 public function customerOrderList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'customer_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerId = $request->input('customer_id'); $page = $request->input('page'); $pageSize = $request->input('page_size'); list($data, $count) = CustomerService::customerOrderList($corpid, $customerId, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } // 客户详情编辑 public function customerInfoUpdate(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'customer_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerId = $request->input('customer_id'); $params['e_address'] = $request->input('e_address'); $params['e_age'] = $request->input('e_age'); $params['e_birthday'] = $request->input('e_birthday'); $params['e_desc'] = $request->input('e_desc'); $params['e_email'] = $request->input('e_email'); $params['e_phone'] = $request->input('e_phone'); $params['e_position'] = $request->input('e_position'); $params['e_qq'] = $request->input('e_qq'); $params['e_source'] = $request->input('e_source'); $params['e_company'] = $request->input('e_company'); $params['e_weibo'] = $request->input('e_weibo'); list($data, $code) = CustomerService::customerInfoUpdate($corpid, $customerId, $params); return self::returnValue($data, $code); } // 将客户加入黑名单 public function moveCustomerToBlackList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'customer_id' => 'required|integer', 'user_id' => 'required|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerId = $request->input('customer_id'); $userId = $request->input('user_id'); $reason = $request->input('reason'); list($res, $code) = CustomerService::moveCustomerToBlackList($corpid, $customerId, $userId, $reason); return self::returnValue($res, $code); } // 将客户移除黑名单 public function removeCustomerFromBlackList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'customer_id' => 'required|integer', 'user_id' => 'required|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerId = $request->input('customer_id'); $userId = $request->input('user_id'); list($res, $code) = CustomerService::removeCustomerFromBlackList($corpid, $customerId, $userId); return self::returnValue($res, $code); } // 黑名单列表 public function blackList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'add_way' => 'nullable|in:0,1,3,4,5,6,8,9,10,201,202', 'page' => 'required|numeric|min:1', 'page_size' => 'required|numeric' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $customerName = $request->input('customer_name'); // 客户名关键字 $addWay = $request->input('add_way'); // 添加渠道 $corpid = $request->input('corpid'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $adminId = $request->input('admin_id'); list($data, $count) = CustomerService::blackList($corpid, $addWay, $customerName, $adminId, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } // 黑名单列表 public function blackListNew(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'add_way' => 'nullable|in:0,1,3,4,5,6,8,9,10,201,202', 'page' => 'required|numeric|min:1', 'page_size' => 'required|numeric' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $customerName = $request->input('customer_name'); // 客户名关键字 $addWay = $request->input('add_way'); // 添加渠道 $corpid = $request->input('corpid'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $adminId = $request->input('admin_id'); list($data, $count) = CustomerService::blackListNew($corpid, $addWay, $customerName, $adminId, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } // 流失客户列表 public function lossCustomerList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'user_id_list' => 'nullable|array', 'add_date_start' => 'nullable|date', 'add_date_end' => 'nullable|date', 'loss_date_start' => 'nullable|date', 'loss_date_end' => 'nullable|date', 'add_duration_min' => 'nullable|numeric', 'add_duration_max' => 'nullable|numeric', 'page' => 'required|numeric|min:1', 'page_size' => 'required|numeric' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $userIdList = $request->input('user_id_list'); // 所属客服 $addDateStart = $request->input('add_date_start'); // 起始添加日期 $addDateEnd = $request->input('add_date_end'); // 截止添加日期 $lossDateStart = $request->input('loss_date_start'); $lossDateEnd = $request->input('loss_date_end'); $addDurationMin = $request->input('add_duration_min'); $addDurationMax = $request->input('add_duration_max'); $corpid = $request->input('corpid'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($data, $count) = CustomerService::lossCustomerList($userIdList, $addDateStart, $addDateEnd, $lossDateStart, $lossDateEnd, $addDurationMin, $addDurationMax, $corpid, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } public function customerAssignmentRecordList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'handover_userid' => 'nullable|string', 'takeover_userid' => 'nullable|string', 'assignment_date_start' => 'nullable|date', 'assignment_date_end' => 'nullable|date', 'assignment_status' => 'nullable|in:1,2,3,-1', 'type' => 'nullable|in:1,2', 'page' => 'required|numeric|min:1', 'page_size' => 'required|numeric' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $handoverUserId = $request->input('handover_userid'); // 迁出客服 $takeoverUserId = $request->input('takeover_userid'); // 接替客服 $assignmentDateStart = $request->input('assignment_date_start'); // 起始添加日期 $assignmentDateEnd = $request->input('assignment_date_end'); // 截止添加日期 $assignmentStatus = $request->input('assignment_status'); $type = $request->input('type'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $operatorId = $request->input('operator_id'); list($data, $count) = CustomerService::customerAssignmentRecordList($corpid, $handoverUserId, $operatorId , $takeoverUserId, $assignmentDateStart, $assignmentDateEnd, $assignmentStatus, $type, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } // 客户分配列表 public function customerAssignmentList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'record_id' => 'required|integer', 'customer_name' => 'nullable|string', 'assignment_date_start' => 'nullable|date', 'assignment_date_end' => 'nullable|date', 'assignment_status' => 'nullable|in:1,2,3,4,5,-1', 'page' => 'required|numeric|min:1', 'page_size' => 'required|numeric' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerName = $request->input('customer_name'); $recordId = $request->input('record_id'); // 所属客服 $assignmentDateStart = $request->input('assignment_date_start'); // 起始添加日期 $assignmentDateEnd = $request->input('assignment_date_end'); // 截止添加日期 $assignmentStatus = $request->input('assignment_status'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($data, $count) = CustomerService::customerAssignmentList($corpid, $customerName, $recordId, $assignmentDateStart, $assignmentDateEnd, $assignmentStatus, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } // 客户动态列表 public function customerDynamicList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'customer_id' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerId = $request->input('customer_id'); $data = CustomerService::customerDynamicList($corpid, $customerId); return self::returnValue($data); } // 客户详情标签展示(编辑时使用) public function customerDetailTagList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'customer_id' => 'required|int', 'user_id' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $customerId = $request->input('customer_id'); $userId = $request->input('user_id'); $data = CustomerService::customerDetailTagList($corpid, $customerId, $userId); return self::returnValue($data); } // 客户详情标签编辑 public function customerDetailTagUpdate(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'external_userid' => 'required', 'user_id' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $externalUserId = $request->input('external_userid'); $userId = $request->input('user_id'); $selectedTagIdList = $request->input('selected_tag_id_list'); list($res, $code) = CustomerService::customerDetailTagUpdate($corpid, $externalUserId, $userId, $selectedTagIdList); return self::returnValue($res, $code); } // 批量添加客户导入 public function batchAddCustomerImport(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'user_id_list' => 'required|array', 'customer_tag_list' => 'nullable|array', 'original_file_name' => 'required', 'ext' => 'required', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $userIdList = $request->input('user_id_list'); $customerTagList = $request->input('customer_tag_list'); $originalFileName = $request->input('original_file_name'); $ext = $request->input('ext'); $newFileName = $request->input('new_file_name'); $sysGroupId = $request->input('sys_group_id'); $res = AddCustomerService::batchAddCustomerImport($originalFileName, $newFileName, $ext, $corpid, $userIdList, $customerTagList, $sysGroupId); return self::returnValue($res['info'], $res['code']); } // 批量添加客户导入二次确认 public function batchAddCustomerImportConfirm(Request $request) { // 处理验证失败信息,不要直接抛异常 $validator = \Validator::make($request->all(), [ 'corpid' => 'required|string', 'confirm' => 'required|in:1,0', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $corpid = $request->input('corpid'); $confirm = $request->input('confirm'); $newFileName = $request->input('new_file_name'); $sysGroupId = $request->input('sys_group_id'); $res = AddCustomerService::batchAddCustomerImportConfirm($corpid, $confirm, $newFileName, $sysGroupId); return self::returnValue($res['info'], $res['code']); } // 批量添加客户导入列表 public function batchAddCustomerDetailsList(Request $request) { // 处理验证失败信息,不要直接抛异常 $validator = \Validator::make($request->all(), [ 'corpid' => 'required|string', 'add_status' => 'nullable|in:1,2,3,4' ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $corpid = $request->input('corpid'); $addStatus = $request->input('add_status'); $keyword = $request->input('keyword'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $startTime = $request->input('start_time'); $endTime = $request->input('end_time'); $sysGroupId = $request->input('sys_group_id'); list($data, $count) = AddCustomerService::batchAddCustomerDetailsList($corpid, $addStatus, $keyword, $startTime, $endTime, $page, $pageSize, $sysGroupId); return self::returnPageValue($data, $count, $pageSize, $page); } // 批量添加客户导入记录列表 public function batchAddCustomerRecordList(Request $request) { // 处理验证失败信息,不要直接抛异常 $validator = \Validator::make($request->all(), [ 'corpid' => 'required|string', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $corpid = $request->input('corpid'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $sysGroupId = $request->input('sys_group_id'); list($data, $count) = AddCustomerService::batchAddCustomerRecordList($corpid, $page, $pageSize, $sysGroupId); return self::returnPageValue($data, $count, $pageSize, $page); } // 批量添加客户导入记录详情 public function batchAddCustomerRecordDetail(Request $request) { // 处理验证失败信息,不要直接抛异常 $validator = \Validator::make($request->all(), [ 'corpid' => 'required|string', 'record_id' => 'required', 'add_status' => 'nullable|in:1,2,3,4' ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $corpid = $request->input('corpid'); $addStatus = $request->input('add_status'); $keyword = $request->input('keyword'); $recordId = $request->input('record_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $sysGroupId = $request->input('sys_group_id'); list($data, $count) = AddCustomerService::batchAddCustomerRecordDetail($corpid, $addStatus, $keyword, $recordId, $page, $pageSize, $sysGroupId); return self::returnPageValue($data, $count, $pageSize, $page); } // 批量分配客户 public function batchDistributionCustomer(Request $request) { // 处理验证失败信息,不要直接抛异常 $validator = \Validator::make($request->all(), [ 'corpid' => 'required|string', 'add_status' => 'nullable|in:1,2,3,4', 'select_all' => 'nullable|in:0,1', 'select_id_list' => 'nullable|array', 'exclude_id_list' => 'nullable|array', 'user_id_list' => 'required|array', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $corpid = $request->input('corpid'); $addStatus = $request->input('add_status'); $keyword = $request->input('keyword'); $startTime = $request->input('start_time'); $endTime = $request->input('end_time'); $selectAll = $request->input('select_all', 0); $selectIdList = $request->input('select_id_list'); $excludeIdList = $request->input('exclude_id_list'); $userIdList = $request->input('user_id_list'); $sysGroupId = $request->input('sys_group_id'); list($res, $code) = AddCustomerService::batchDistributionCustomer($corpid, $addStatus, $keyword, $startTime, $endTime, $selectAll, $selectIdList, $excludeIdList, $userIdList, $sysGroupId); return self::returnValue($res, $code); } // 删除导入记录(单个删除) public function deleteRecord(Request $request) { // 处理验证失败信息,不要直接抛异常 $validator = \Validator::make($request->all(), [ 'corpid' => 'required|string', 'record_id' => 'required', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $corpid = $request->input('corpid'); $recordId = $request->input('record_id'); $sysGroupId = $request->input('sys_group_id'); list($res, $code) = AddCustomerService::deleteRecord($corpid, $recordId, $sysGroupId); return self::returnValue($res, $code); } // 删除导入客户 public function deleteDetail(Request $request) { // 处理验证失败信息,不要直接抛异常 $validator = \Validator::make($request->all(), [ 'corpid' => 'required|string', 'add_status' => 'nullable|in:1,2,3,4', 'select_all' => 'nullable|in:0,1', 'select_id_list' => 'nullable|array', 'exclude_id_list' => 'nullable|array', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $corpid = $request->input('corpid'); $addStatus = $request->input('add_status'); $keyword = $request->input('keyword'); $startTime = $request->input('start_time'); $endTime = $request->input('end_time'); $selectAll = $request->input('select_all', 0); $selectIdList = $request->input('select_id_list'); $excludeIdList = $request->input('exclude_id_list'); $sysGroupId = $request->input('sys_group_id'); list($res, $code) = AddCustomerService::deleteDetail($corpid, $addStatus, $keyword, $startTime, $endTime, $selectAll, $selectIdList, $excludeIdList, $sysGroupId); return self::returnValue($res, $code); } // 批量提醒(add_status为待添加以及待通过) public function batchRemind(Request $request) { // 处理验证失败信息,不要直接抛异常 $validator = \Validator::make($request->all(), [ 'corpid' => 'required|string', 'add_status' => 'required|in:1,2', 'select_all' => 'nullable|in:0,1', 'select_id_list' => 'nullable|array', 'exclude_id_list' => 'nullable|array', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $corpid = $request->input('corpid'); $addStatus = $request->input('add_status'); $keyword = $request->input('keyword'); $startTime = $request->input('start_time'); $endTime = $request->input('end_time'); $selectAll = $request->input('select_all', 0); $selectIdList = $request->input('select_id_list'); $excludeIdList = $request->input('exclude_id_list'); $sysGroupId = $request->input('sys_group_id'); list($res, $code) = AddCustomerService::batchRemind($corpid, $addStatus, $keyword, $startTime, $endTime, $selectAll, $selectIdList, $excludeIdList, $sysGroupId); return self::returnValue($res, $code); } /** * 安卓客户端获取待邀请入群的新用户列表 * */ public function waitInvite(Request $request) { $validator = \Validator::make($request->all(), [ 'device_id' => 'required|string', 'begin_time' => 'required|date_format:Y-m-d H:i:s', 'end_time' => 'required|date_format:Y-m-d H:i:s', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $deviceId = $request->input('device_id'); $beginTime = $request->input('begin_time'); $endTime = $request->input('end_time'); $retry = $request->input('retry', 0); $requestCorpId = $request->input('corpid'); $customerNumber = $request->input('customer_number'); # 获取待邀请入群的新用户 $userList = CustomerService::waitInvite($deviceId, $beginTime, $endTime, $retry, $requestCorpId, $customerNumber); Log::logInfo('邀请新用户入群请求日志', [ 'device_id' => $deviceId, 'begin_time' => $beginTime, 'end_time' => $endTime, 'retry' => $retry, 'customer_number' => $customerNumber, 'corp_id' => $requestCorpId, 'response' => $userList ], 'WaitInvite'); return self::returnValue(['list' => $userList]); } /** * 安卓客户端获取待共享的新用户列表 * */ public function waitShare(Request $request) { $validator = \Validator::make($request->all(), [ 'device_id' => 'required|string', 'begin_time' => 'required|date_format:Y-m-d H:i:s', 'end_time' => 'required|date_format:Y-m-d H:i:s', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $deviceId = $request->input('device_id'); $beginTime = $request->input('begin_time'); $endTime = $request->input('end_time'); # 获取待邀请入群的新用户 $userList = CustomerService::waitShare($deviceId, $beginTime, $endTime); Log::logInfo('新用户共享请求日志', [ 'device_id' => $deviceId, 'begin_time' => $beginTime, 'end_time' => $endTime, 'response' => $userList ], 'waitShare'); return self::returnValue(['list' => $userList]); } /** * 安卓客户端获取待补充邀请入群的用户列表-按群模板随机补拉 * @param Request $request */ public function waitSupplementaryInvite(Request $request) { $validator = \Validator::make($request->all(), [ 'device_id' => 'required|string', 'begin_time' => 'required|date_format:Y-m-d H:i:s', 'end_time' => 'required|date_format:Y-m-d H:i:s', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $deviceId = $request->input('device_id'); $beginTime = $request->input('begin_time'); $endTime = $request->input('end_time'); # 获取待邀请入群的新用户 $userList = CustomerService::waitSupplementaryInvite($deviceId, $beginTime, $endTime); Log::logInfo('退群用户补充邀请入群请求日志', [ 'device_id' => $deviceId, 'begin_time' => $beginTime, 'end_time' => $endTime, 'response' => $userList ], 'waitSupplementaryInvite'); return self::returnValue(['list' => $userList]); } /** * 安卓客户端获取待补充邀请入群的用户列表-将用户拉回指定群 */ public function waitInviteTargetGroup(Request $request) { $validator = \Validator::make($request->all(), [ 'device_id' => 'required|string', 'begin_time' => 'required|date_format:Y-m-d H:i:s', 'end_time' => 'required|date_format:Y-m-d H:i:s', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $deviceId = $request->input('device_id'); $beginTime = $request->input('begin_time'); $endTime = $request->input('end_time'); # 获取待邀请入群的新用户 $userList = CustomerService::waitInviteTargetGroup($deviceId, $beginTime, $endTime); Log::logInfo('退群用户补充邀请入群请求日志', [ 'device_id' => $deviceId, 'begin_time' => $beginTime, 'end_time' => $endTime, 'response' => $userList ], 'waitInviteTargetGroup'); return self::returnValue(['list' => $userList]); } public function inviteNewUser(Request $request) { $validator = \Validator::make($request->all(), [ 'device_id' => 'required|string', 'begin_time' => 'required|date_format:Y-m-d H:i:s', 'end_time' => 'required|date_format:Y-m-d H:i:s', ]); if ($validator->fails()) { return self::returnValue(['error' => $validator->errors()], 1102); } $deviceId = $request->input('device_id'); $beginTime = $request->input('begin_time'); $endTime = $request->input('end_time'); # 获取待邀请入群的新用户 $userList = CustomerService::inviteNewUser($deviceId, $beginTime, $endTime); Log::logInfo('退群用户补充邀请入群请求日志', [ 'device_id' => $deviceId, 'begin_time' => $beginTime, 'end_time' => $endTime, 'response' => $userList ], 'waitInviteTargetGroup'); return self::returnValue(['list' => $userList]); } }