123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Http\Controllers\Controller;
- use App\Log;
- use App\Service\AndroidToolService;
- use App\Service\ChatGroup\ChatGroupMassMsgRuleService;
- use App\Service\ChatGroup\ChatGroupRuleService;
- use App\Service\ChatGroup\ChatGroupService;
- use Illuminate\Http\Request;
- use Illuminate\Validation\Rule;
- class ChatGroupController extends Controller
- {
-
- public function setChatGroupMassMsg(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'name' => 'required|string',
- 'send_type' => ['required', Rule::in([1, 2])],
- 'send_mode' => ['required', Rule::in([1, 2])],
- 'send_time' => 'required|date_format:Y-m-d H:i:s',
- 'content' => ['required_without:attachments', 'nullable'],
- 'attachments' => ['required_without:content', 'nullable'],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $params = array();
- $ruleId = $request->input('rule_id');
- $params['corpid'] = $request->input('corpid');
- $params['admin_id'] = $request->input('admin_id');
- $params['name'] = $request->input('name');
- $params['send_type'] = $request->input('send_type');
- $params['send_time'] = $request->input('send_time');
- $params['senders'] = $request->input('senders');
- $params['content'] = $request->input('content');
- $params['attachments'] = $request->input('attachments');
- $params['send_mode'] = $request->input('send_mode');
- $params['chat_groups'] = $request->input('chat_groups');
- $params['item_id'] = $request->input('item_id');
- $params['operate_type'] = $request->input('operate_type', 1);
-
- $errNo = ChatGroupRuleService::setChatGroupMassMsg($ruleId, $params);
- return self::returnValue([], $errNo);
- }
-
- public function groupList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $owner = $request->input('owner');
- $keyword = $request->input('keyword');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- if($pageSize == 500) $pageSize = 20000;
-
- list($list, $count) = ChatGroupRuleService::groupList($corpid, $owner, $keyword, $page, $pageSize);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
-
- public function uniqueMemberCount(Request $request)
- {
- $validator = \Validator::make($request->all(), [
- 'corpid' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $count = ChatGroupRuleService::getUniqueMemberCount($corpid);
- return self::returnValue(['member_count' => $count]);
- }
-
- public function condition(Request $request)
- {
- $validator = \Validator::make($request->all(), [
- 'corpid' => 'required|string',
- 'chat_id' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $chatId = $request->input('chat_id');
-
- $condition = ChatGroupRuleService::groupCondition($corpid, $chatId);
- return self::returnValue($condition);
- }
-
- public function memberList(Request $request)
- {
- $validator = \Validator::make($request->all(), [
- 'corpid' => 'required|string',
- 'chat_id' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $chatId = $request->input('chat_id');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- $status = $request->input('status');
- $keyword = $request->input('keyword');
- $joinTimeStart = $request->input('join_time_start');
- $joinTimeEnd = $request->input('join_time_end');
-
- list($list, $count) = ChatGroupRuleService::getMemberList($corpid, $chatId, $status, $keyword, $joinTimeStart
- , $joinTimeEnd, $page, $pageSize);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
-
- public function ruleLists(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'send_time_start' => 'nullable|date_format:Y-m-d H:i:s',
- 'send_time_end' => 'nullable|date_format:Y-m-d H:i:s',
- 'create_time_start' => 'nullable|date_format:Y-m-d H:i:s',
- 'create_time_end' => 'nullable|date_format:Y-m-d H:i:s',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $creatorId = $request->input('creator_id');
- $sendTimeStart = $request->input('send_time_start');
- $sendTimeEnd = $request->input('send_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- $ruleName = $request->input('rule_name');
- $createTimeStart = $request->input('create_time_start');
- $createTimeEnd = $request->input('create_time_end');
- $sortColumn = $request->input('sort_column','send_time');
- $sortMethod = $request->input('sort_method','desc');
-
- $errno = 0;
- list($list, $count) = ChatGroupMassMsgRuleService::ruleList(
- $corpid, $creatorId, $sendTimeStart, $sendTimeEnd, $createTimeStart,$createTimeEnd,$sortColumn,$sortMethod,
- $page, $pageSize, $errno, $ruleName
- );
- if($errno) return self::returnValue([], $errno);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
-
- public function ruleDetail(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $ruleId = $request->input('rule_id');
-
- $errno = 0;
- $detail = ChatGroupMassMsgRuleService::ruleDetailNew($corpid, $ruleId, $errno);
- return self::returnValue($detail, $errno);
- }
-
- public function updateStatus(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'status' => ['required', Rule::in([0, 1])],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $status = $request->input('status');
- $ruleId = $request->input('rule_id');
- $errno = ChatGroupMassMsgRuleService::updateRuleStatus($corpid, $ruleId, $status);
- return self::returnValue([], $errno);
- }
-
- public function noticeUser(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $ruleId = $request->input('rule_id');
- $errno = ChatGroupMassMsgRuleService::noticeUser($corpid, $ruleId);
- return self::returnValue([], $errno);
- }
-
- public function chatGroupReceiveDetail(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'rule_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $ruleId = $request->input('rule_id');
- $chatGroupName = $request->input('chat_group_name');
- $senderList = $request->input('sender_list');
- $status = $request->input('status');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- if($pageSize==500) $pageSize = 10000;
- $errno = 0;
- list($list, $count) = ChatGroupMassMsgRuleService::chatGroupReceiveDetailNew(
- $ruleId, $chatGroupName, $senderList, $status, $errno, $page, $pageSize
- );
- if($errno){
- return self::returnValue([], $errno);
- }
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
- public function chatGroupOwnerList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required',
- 'user_name' => 'nullable|string'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $userName = $request->input('user_name');
- $data = ChatGroupService::ownerList($corpid, $userName);
- return self::returnValue($data);
- }
-
- public function ownerListOfCompany(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'user_name' => 'nullable|string'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $userName = $request->input('user_name');
- $sysGroupId = $request->input('sys_group_id');
- $data = ChatGroupService::ownerListOfCompany($userName, $sysGroupId);
- return self::returnValue($data);
- }
-
- public function chatGroupList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required',
- 'start_time' => 'nullable|date_format:Y-m-d H:i:s',
- 'end_time' => 'nullable|date_format:Y-m-d H:i:s',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $keyword = $request->input('keyword');
- $startTime = $request->input('start_time');
- $endTime = $request->input('end_time');
- $owner = $request->input('owner');
- $isActive = $request->input('is_active', 0);
- $data = ChatGroupService::chatGroupList($corpid, $keyword, $startTime, $endTime, $owner, $isActive);
- return self::returnValue($data);
- }
-
- public function chatGroupOwnerIndex(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required',
- 'user_name' => 'nullable|string'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $userName = $request->input('user_name');
- $data = ChatGroupService::ownerIndex($corpid, $userName);
- return self::returnValue($data);
- }
-
- public function setInviteRule(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'title' => 'required|string',
- 'invite_config' => 'required|string',
- 'is_for_all' => ['required', Rule::in([0, 1])],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $params = array();
- $ruleId = $request->input('rule_id');
- $params['admin_id'] = $request->input('admin_id', 1);
- $params['sys_group_id'] = $request->input('sys_group_id');
- $params['corpid'] = $request->input('corpid');
- $params['is_for_all'] = $request->input('is_for_all');
- $params['users'] = $request->input('users');
- $params['title'] = $request->input('title');
- $params['join_type'] = $request->input('join_type', 1);
- $params['invite_config'] = $request->input('invite_config');
- $params['customer_filter'] = $request->input('customer_filter');
- $params['filter_type'] = $request->input('filter_type', 1);
- $params['add_time_st'] = $request->input('add_time_st');
- $params['add_time_et'] = $request->input('add_time_et');
- $params['add_time_later'] = $request->input('add_time_later');
- $params['invite_type'] = $request->input('invite_type');
- $params['invite_time'] = $request->input('invite_time');
- $params['owner_type'] = $request->input('owner_type');
- $params['announcement'] = $request->input('announcement');
- $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_screen_type'] = $request->input('tag_screen_type', 0);
- $params['tag_list'] = $request->input('tag_list');
- $params['gender'] = $request->input('gender');
- $params['upper_limit'] = $request->input('upper_limit');
- $params['continuously_attract_groups'] = $request->input('continuously_attract_groups', 0);
- $params['supplementary_invite_time'] = $request->input('supplementary_invite_time');
- $params['supplementary_invite'] = $request->input('supplementary_invite', 0);
- $params['supplementary_invite_cycle'] = $request->input('supplementary_invite_cycle', 1);
-
- $errNo = ChatGroupService::setInviteRule($ruleId, $params);
- Log::logInfo('配置邀请入群规则', [
- 'rule_id' => $ruleId, 'params' => $params, 'errno' => $errNo
- ], 'setInviteRule');
- return self::returnValue([], $errNo);
- }
-
- public function inviteRuleList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $corpid = $request->input('corpid');
- $userId = $request->input('user_id');
- $status = $request->input('status');
- $keyword = $request->input('keyword');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
-
- list($list, $count) = ChatGroupService::getInviteRuleList($corpid, $userId, $sysGroupId, $keyword, $status, $page, $pageSize);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
-
- public function inviteRuleDetail(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'rule_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $ruleId = $request->input('rule_id');
-
- $detail = ChatGroupService::inviteRuleDetail($ruleId, $sysGroupId);
- return self::returnValue($detail);
- }
-
- public function inviteRuleDel(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'rule_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $ruleId = $request->input('rule_id');
-
- $errno = ChatGroupService::inviteRuleDel($ruleId, $sysGroupId, $adminId);
- return self::returnValue([], $errno);
- }
-
- public function inviteRuleStatusChange(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'status' => ['required', Rule::in([0, 1])],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $status = $request->input('status');
- $ruleId = $request->input('rule_id');
- $errno = ChatGroupService::updateRuleStatus($ruleId, $adminId, $status, $sysGroupId);
- return self::returnValue([], $errno);
- }
- public function resetSupplementaryInviteTime(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $ruleId = $request->input('rule_id');
- $errno = ChatGroupService::resetSupplementaryInviteTime($ruleId, $adminId, $sysGroupId);
- return self::returnValue([], $errno);
- }
-
- public function chatGroupStatistic(Request $request)
- {
- $sysGroupId = $request->input('sys_group_id');
- $keyword = $request->input('keyword');
- $corpid = $request->input('corpid');
- $owner = $request->input('owner');
- $minMember = $request->input('min_member');
- $maxMember = $request->input('max_member');
- $ownerList = $request->input('owner_list');
- $createTimeSt = $request->input('create_time_st');
- $createTimeEt = $request->input('create_time_et');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
-
- list($list, $count) = ChatGroupService::chatGroupStatistic(
- $sysGroupId, $owner, $ownerList, $keyword, $corpid, $createTimeSt, $createTimeEt,
- $minMember, $maxMember, $page, $pageSize
- );
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
-
- public function chatGroupCondition(Request $request)
- {
- $sysGroupId = $request->input('sys_group_id');
- $owner = $request->input('owner');
- $ownerList = $request->input('owner_list');
- $corpid = $request->input('corpid');
- $createTimeSt = $request->input('create_time_st');
- $createTimeEt = $request->input('create_time_et');
- $minMember = $request->input('min_member');
- $maxMember = $request->input('max_member');
-
- $data = ChatGroupService::chatGroupCondition(
- $sysGroupId, $owner, $ownerList, $corpid, $createTimeSt, $createTimeEt, $minMember, $maxMember
- );
- return self::returnValue($data);
- }
- public static function syncCorpChatGroup(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- list($res, $code) = ChatGroupService::syncCorpChatGroup($corpid);
- return self::returnValue($res, $code);
- }
-
- public function receiveCreateChatGroupData(Request $request) {
- $validator = \Validator::make($request->all(), [
- 'device_id' => 'required|string',
- 'corpid' => 'required|string',
- 'user_name' => 'required|string',
- 'group_list' => 'required'
- ]);
- if ($validator->fails()) {
- return self::returnValue(['error' => $validator->errors()], 1102);
- }
- $deviceId = $request->input('device_id');
- $corpid = $request->input('corpid');
- $userName = $request->input('user_name');
- $groupList = $request->input('group_list');
- list($response, $errcode) = ChatGroupService::receiveCreateChatGroupData($deviceId, $corpid, $userName, $groupList);
- Log::logInfo('接收待创建群聊任务', [
- 'device_id' => $deviceId,
- 'corpid' => $corpid,
- 'user_name' => $userName,
- 'group_list' => $groupList,
- 'response' => $response
- ], 'receiveCreateChatGroupData');
- return self::returnValue($response, $errcode);
- }
- public function getCreateGroupTask(Request $request) {
- $validator = \Validator::make($request->all(), [
- 'device_id' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue(['error' => $validator->errors()], 1102);
- }
- $deviceId = $request->input('device_id');
- $taskList = ChatGroupService::getCreateGroupTask($deviceId);
- Log::logInfo('创建群聊任务返回', [
- 'device_id' => $deviceId,
- 'response' => $taskList
- ], 'getCreateGroupTask');
- return self::returnValue($taskList);
- }
-
- public function setWelcomeTemplate(Request $request) {
- $validator = \Validator::make($request->all(), [
- 'corpid' => 'required|string',
- 'name' => 'required|string',
- 'content' => ['required_without:attachments', 'nullable'],
- 'attachments' => ['required_without:content', 'nullable'],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $params = array();
- $params['corpid'] = $request->input('corpid');
- $params['admin_id'] = $request->input('admin_id');
- $params['sys_group_id'] = $request->input('sys_group_id');
- $params['template_id'] = $request->input('template_id');
- $params['name'] = $request->input('name');
- $params['content'] = $request->input('content');
- $params['attachments'] = $request->input('attachments');
- $error = 0;
- ChatGroupService::setWelcomeTemplate($params, $error);
- return self::returnValue('', $error);
- }
-
- public function welcomeTemplateList(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');
- $keyword = $request->input('keyword');
- $creatorId = $request->input('creator_id');
- $page = $request->input('page');
- $pageSize = $request->input('page_size');
- list($list, $count) = ChatGroupService::welcomeTemplateList($corpid, $sysGroupId, $keyword, $creatorId, $page, $pageSize);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
-
- public function welcomeTemplateDetail(Request $request) {
- $validator = \Validator::make($request->all(), [
- 'corpid' => 'required|string',
- 'template_id' => 'required',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $sysGroupId = $request->input('sys_group_id');
- $templateId = $request->input('template_id');
- $data = ChatGroupService::welcomeTemplateDetail($sysGroupId, $corpid, $templateId);
- return self::returnValue($data);
- }
-
- public function delWelcomeTemplate(Request $request) {
- $validator = \Validator::make($request->all(), [
- 'corpid' => 'required|string',
- 'template_id' => 'required',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $sysGroupId = $request->input('sys_group_id');
- $templateId = $request->input('template_id');
- $errcode = 0;
- ChatGroupService::delWelcomeTemplate($sysGroupId, $corpid, $templateId, $errcode);
- return self::returnValue('', $errcode);
- }
-
- public function forwardMemberList(Request $request) {
- $sysGroupId = $request->input('sys_group_id');
- $keyword = $request->input('keyword');
- $list = AndroidToolService::getForwardMemberList($sysGroupId, $keyword);
- return self::returnValue($list);
- }
-
- public function setForwardChatGroupCreateRule(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'title' => 'required|string',
- 'template_group_name' => 'required|string',
- 'group_num' => 'required',
- 'create_type' => 'required'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $params = array();
- $ruleId = $request->input('rule_id');
- $params['admin_id'] = $request->input('admin_id', 1);
- $params['sys_group_id'] = $request->input('sys_group_id');
- $params['corpid'] = $request->input('corpid');
- $params['is_for_all'] = $request->input('is_for_all');
- $params['users'] = $request->input('users');
- $params['title'] = $request->input('title');
- $params['create_type'] = $request->input('create_type');
- $params['do_time'] = $request->input('do_time');
- $params['template_group_name'] = $request->input('template_group_name');
- $params['group_num'] = $request->input('group_num', 1);
- $params['forward_users'] = $request->input('forward_users');
-
- $errNo = ChatGroupService::setForwardChatGroupCreateRule($ruleId, $params);
- Log::logInfo('配置转发消息客服入群规则', [
- 'rule_id' => $ruleId, 'params' => $params, 'errno' => $errNo
- ], 'setForwardChatGroupCreateRule');
- return self::returnValue([], $errNo);
- }
-
- public function forwardChatGroupCreateRuleList(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $corpid = $request->input('corpid');
- $userId = $request->input('user_id');
- $status = $request->input('status');
- $keyword = $request->input('keyword');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
-
- list($list, $count) = ChatGroupService::forwardChatGroupCreateRuleList($corpid, $userId, $sysGroupId, $keyword, $status, $page, $pageSize);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
-
- public function forwardChatGroupCreateRuleDetail(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'rule_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $ruleId = $request->input('rule_id');
-
- $detail = ChatGroupService::forwardChatGroupCreateRuleDetail($ruleId);
- return self::returnValue($detail);
- }
-
- public function forwardChatGroupCreateRuleChangeStatus(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'status' => ['required', Rule::in([0, 1])],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $status = $request->input('status');
- $ruleId = $request->input('rule_id');
- $errno = ChatGroupService::forwardChatGroupCreateRuleChangeStatus($ruleId, $adminId, $status, $sysGroupId);
- return self::returnValue([], $errno);
- }
-
- public function forwardChatGroupCreateRuleDelete(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'rule_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $ruleId = $request->input('rule_id');
-
- $errno = ChatGroupService::forwardChatGroupCreateRuleDelete($ruleId, $sysGroupId, $adminId);
- return self::returnValue([], $errno);
- }
- }
|