all(),[ 'corpid' => 'required|string', 'title' => 'required|string', 'type' => ['required', Rule::in([1, 2])], 'filter_type' => ['required', Rule::in([1, 2])], 'new_owner' => 'required|string', 'condition' => 'required', 'transfer_type' => ['required', Rule::in([1, 2])], 'transfer_at' => 'required|date_format:Y-m-d H:i:s', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $configId = $request->input('config_id'); $params['sys_group_id'] = $request->input('sys_group_id'); $params['admin_id'] = $request->input('admin_id'); $params['corpid'] = $request->input('corpid'); $params['title'] = $request->input('title'); $params['type'] = $request->input('type'); // 转移类型 1在职迁移 2离职迁移 $params['filter_type'] = $request->input('filter_type'); // 筛选方式 1按群聊 2按群主 $params['condition'] = $request->input('condition'); // 筛选条件 $params['new_owner'] = $request->input('new_owner'); // 新群主id $params['transfer_type'] = $request->input('transfer_type'); // 分配方式 1立即分配 2定时分配 $params['transfer_at'] = $request->input('transfer_at'); // 执行分配时间 # 创建/编辑 客户群分配规则 $errno = ChatGroupTransferService::editConfig($configId, $params); return self::returnValue([], $errno); } /** * 客户群分配配置列表 * */ public function configList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'status' => ['nullable', Rule::in([0, 1, 2, 3])], ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $sysGroupId = $request->input('sys_group_id'); $corpid = $request->input('corpid'); $keyword = $request->input('keyword'); $newOwner = $request->input('new_owner'); $status = $request->input('status'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($list, $count) = ChatGroupTransferService::configList($sysGroupId, $corpid, $keyword, $newOwner, $status, $page, $pageSize); return self::returnPageValue($list, $count, $pageSize, $page); } /** * 客户群分配配置详情 * */ public function configDetail(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'config_id' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $sysGroupId = $request->input('sys_group_id'); $corpid = $request->input('corpid'); $configId = $request->input('config_id'); # 获取配置详情 $errno = 0; $detail = ChatGroupTransferService::getConfigDetail($sysGroupId, $corpid, $configId, $errno); return self::returnValue($detail, $errno); } /** * 修改配置状态 * */ public function changeStatus(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'config_id' => 'required|int', 'status' => ['required', Rule::in([0, 1])], ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $sysGroupId = $request->input('sys_group_id'); $corpid = $request->input('corpid'); $status = $request->input('status'); $configId = $request->input('config_id'); # 变更配置状态 $errno = ChatGroupTransferService::changeConfigStatus($sysGroupId, $corpid, $status, $configId); return self::returnValue([], $errno); } /** * 客户群分配记录 * */ public function record(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'config_id' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $configId = $request->input('config_id'); $page = $request->input('page', 1); # 获取分配记录 list($list, $count) = ChatGroupTransferService::getTransferRecord($corpid, $configId, $page); return self::returnPageValue($list, $count, 100, $page); } }