all(),[ 'corpid' => 'required|string', 'config_list' => 'required|array' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $adminId = $request->input('admin_id'); $configList = $request->input('config_list'); $sysGroupId = $request->input('sys_group_id'); $errNo = BatchAddCustomerService::editConfig($corpid, $adminId, $configList, $sysGroupId); return self::returnValue([], $errNo); } /** * 获取企业配置信息 * */ public function configInfo(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $sysGroupId = $request->input('sys_group_id'); $adminId = $request->input('admin_id'); # 获取企业配置自动提醒 $configInfo = array(); $errno = BatchAddCustomerService::configInfo($corpid, $sysGroupId, $adminId, $configInfo); if($errno) return self::returnValue([], $errno); return self::returnValue($configInfo); } /** * 给未完成客户添加工作的成员发送消息提醒 * */ public function noticeUser(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'user_ids' => 'required|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $userIds = $request->input('user_ids'); $errno = BatchAddCustomerService::noticeUser($corpid, $userIds); return self::returnValue([], $errno); } /** * 查看已分配的客户列表 * */ public function customerList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'user_id' => 'required|string', 'token' => 'required|string', 'timestamp' => 'required', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $userId = $request->input('user_id'); $token = $request->input('token'); $timestamp = $request->input('timestamp'); $addStatus = $request->input('add_status'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 50); $errno = 0; list($list, $count, $customerTotal) = BatchAddCustomerService::getCustomerList( $corpid, $userId, $token, $timestamp, $addStatus, $page, $pageSize, $errno ); if($errno) return self::returnValue([], $errno); return self::returnPageValue(['list' => $list, 'customer_total' => $customerTotal], $count, $pageSize, $page); } /** * 客服添加客户数据上报 * */ public function dataReporting(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'user_id' => 'required|string', 'record_id' => 'required|int', 'phone' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $phone = $request->input('phone'); $userId = $request->input('user_id'); $recordId = $request->input('record_id'); # 数据上报 $errno = BatchAddCustomerService::dataReporting($corpid, $phone, $userId, $recordId); return self::returnValue([], $errno); } /** * 数据概览 * */ public function dataSummary(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'start_date' => 'required|date_format:Y-m-d', 'end_date' => 'required|date_format:Y-m-d', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $sysGroupId = $request->input('sys_group_id'); $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); # 获取数据概览 $data = BatchAddCustomerService::dataSummary($corpid, $startDate, $endDate, $sysGroupId); return self::returnValue($data); } /** * 好友添加统计列表 * */ public function statistic(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'start_date' => 'required|date_format:Y-m-d', 'end_date' => 'required|date_format:Y-m-d', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $userId = $request->input('user_id'); $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 50); list($list, $count) = BatchAddCustomerService::statistic($corpid, $userId, $startDate, $endDate, $sysGroupId, $page, $pageSize); return self::returnPageValue($list, $count, $pageSize, $page); } }