123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Models\PeriodMassMsg\PeriodMassMsgGroup;
- use App\Models\PeriodMassMsg\PeriodTempGroup;
- use App\Service\PeriodMassMsgService;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use Illuminate\Validation\Rule;
- class PeriodMassMsgController extends Controller
- {
- /**
- * 智能群发消息规则设置
- * */
- public function setRule(Request $request)
- {
- $validator = \Validator::make($request->all(), [
- 'corpid' => 'required|string',
- 'name' => 'required|string',
- 'send_conf' => 'required|string',
- 'content' => ['required_without:attachments', 'nullable'],
- 'attachments' => ['required_without:content', 'nullable'],
- 'tag_screen_type' => ['nullable', Rule::in([0, 1, 2, 3])],
- 'customer_filter' => ['nullable', Rule::in([0, 1])],
- 'pay_status' => ['nullable', Rule::in([0, 1])],
- 'pay_num_min' => 'nullable|int',
- 'pay_num_max' => 'nullable|int',
- ]);
- 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['group_id'] = $request->input('group_id', 0);
- $params['name'] = $request->input('name');
- $params['send_conf'] = $request->input('send_conf'); // 发送时间配置
- $params['is_all'] = $request->input('is_all', 0); // 是否应用于全部员工 0否 1是
- $params['senders'] = $request->input('senders'); // 群发账号集合
- $params['content'] = $request->input('content');
- $params['attachments'] = $request->input('attachments');
- $params['gender'] = $request->input('gender', 3); // 客户性别 0未知 1男性 2女性 3全部
- $params['tag_screen_type'] = $request->input('tag_screen_type', 0); // 标签筛选方式 0未设置标签筛选 1所选标签满足其一 2所选标签全部满足 3无任何标签
- $params['tag_list'] = $request->input('tag_list');
- $params['exclude_tag_list'] = $request->input('exclude_tag_list');
- // 付费情况
- $params['pay_status'] = $request->input('pay_status'); // 是否付费 0:未付费 1:付费
- $params['pay_num_min'] = $request->input('pay_num_min'); // 最小付费次数
- $params['pay_num_max'] = $request->input('pay_num_max'); // 最大付费次数
- $params['operate_type'] = $request->input('operate_type', 1);# 运营类型 1单主体 2多主体
- $params['operator_group_id'] = $request->input('operator_group_id');// 运营组ID
- $params['multiple_senders'] = $request->input('multiple_senders');
- $params['is_operation'] = $request->input('is_operation');
- # 智能群发规则设置
- $errNo = PeriodMassMsgService::setRule($ruleId, $params);
- return self::returnValue([], $errNo);
- }
- /**
- * 设置智能群发模板
- * */
- public function setTemplate(Request $request)
- {
- $validator = \Validator::make($request->all(), [
- 'title' => 'required|string',
- 'send_conf' => 'required|string',
- 'content' => ['required_without:attachments', 'nullable'],
- 'attachments' => ['required_without:content', 'nullable'],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $params = array();
- $templateId = $request->input('template_id');
- $params['admin_id'] = $request->input('admin_id');
- $params['group_id'] = $request->input('group_id');
- $params['sys_group_id'] = $request->input('sys_group_id');
- $params['title'] = $request->input('title');
- $params['send_conf'] = $request->input('send_conf'); // 发送时间配置
- $params['content'] = $request->input('content');
- $params['attachments'] = $request->input('attachments');
- # 智能群发模板配置
- $errNo = PeriodMassMsgService::setTemplate($templateId, $params);
- return self::returnValue([], $errNo);
- }
- /**
- * 智能群发规则列表
- * */
- public function ruleLists(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- '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);
- }
- $groupId = $request->input('group_id', 0);
- $keyword = $request->input('keyword');
- $corpid = $request->input('corpid');
- $creatorId = $request->input('creator_id');
- $createTimeStart = $request->input('create_time_start');
- $createTimeEnd = $request->input('create_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- # 获取群发规则列表
- $errno = 0;
- list($list, $count) = PeriodMassMsgService::ruleList(
- $groupId, $keyword, $corpid, $creatorId, $createTimeStart,$createTimeEnd, $page, $pageSize, $errno
- );
- # 获取分组名称
- $groupName = PeriodMassMsgGroup::where('id', $groupId)->value('title');
- if($errno) return self::returnValue([], $errno);
- return self::returnPageValue($list, $count, $pageSize, $page, ['group_name' => $groupName ? $groupName : '未分组']);
- }
- /**
- * 智能群发模板列表
- * */
- public function templateList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- '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);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $groupId = $request->input('group_id', 0);
- $title = $request->input('title');
- $status = $request->input('status');
- $createTimeStart = $request->input('create_time_start');
- $createTimeEnd = $request->input('create_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- # 获取分组名称
- $groupName = PeriodTempGroup::where('id', $groupId)->value('title');
- # 获取智能群发模板列表
- list($list, $count) = PeriodMassMsgService::templateList(
- $adminId, $sysGroupId, $groupId, $title, $createTimeStart,$createTimeEnd, $status, $page, $pageSize
- );
- return self::returnPageValue($list, $count, $pageSize, $page, ['group_name' => $groupName ? $groupName : '未分组']);
- }
- /**
- * 智能群发规则详情
- * */
- 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 = PeriodMassMsgService::ruleDetail($corpid, $ruleId, $errno);
- return self::returnValue($detail, $errno);
- }
- /**
- * 智能群发模板详情
- * */
- public function templateDetail(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'template_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $templateId = $request->input('template_id');
- $sysGroupId = $request->input('sys_group_id');
- # 获取智能群发规则详情
- $errno = 0;
- $detail = PeriodMassMsgService::templateDetail($templateId, $sysGroupId, $adminId, $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);
- }
- $adminId = $request->input('admin_id');
- $corpid = $request->input('corpid');
- $status = $request->input('status');
- $ruleId = $request->input('rule_id');
- $errno = PeriodMassMsgService::updateRuleStatus($corpid, $ruleId, $status, $adminId);
- return self::returnValue([], $errno);
- }
- /**
- * 智能群发模板状态修改
- * */
- public function changeStatus(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'template_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');
- $templateId = $request->input('template_id');
- $errno = PeriodMassMsgService::templateChangeStatus($templateId, $adminId, $sysGroupId, $status);
- return self::returnValue([], $errno);
- }
- /**
- * 群发消息列表
- * */
- public function recordLists(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'send_time_start' => 'nullable|date_format:Y-m-d H:i:s',
- 'send_time_end' => 'nullable|date_format:Y-m-d H:i:s',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $ruleId = $request->input('rule_id');
- $sendTimeStart = $request->input('send_time_start');
- $sendTimeEnd = $request->input('send_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- $sortColumn = $request->input('sort_column','send_time');
- $sortMethod = $request->input('sort_method','desc');
- # 获取群发规则列表
- $errno = 0;
- list($list, $count) = PeriodMassMsgService::recordList(
- $corpid, $ruleId, $sendTimeStart, $sendTimeEnd, $sortColumn, $sortMethod, $page, $pageSize, $errno
- );
- if($errno) return self::returnValue([], $errno);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
- public function recordDetail(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'send_num' => 'required|numeric',
- 'send_date' => 'required|date',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $ruleId = $request->input('rule_id');
- $sendNum = $request->input('send_num');
- $sendDate = $request->input('send_date');
- # 获取群发消息详情
- $errno = 0;
- $detail = PeriodMassMsgService::recordDetail($corpid, $ruleId, $sendNum, $sendDate, $errno);
- return self::returnValue($detail, $errno);
- }
- /**
- * 群发消息数据概览
- * @param Request $request
- * @return array
- */
- public function overview(Request $request){
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'send_num' => 'required|numeric',
- 'send_date' => 'required|date'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $ruleId = $request->input('rule_id');
- $sendNum = $request->input('send_num');
- $sendDate = $request->input('send_date');
- $res = PeriodMassMsgService::overview($corpid, $ruleId, $sendNum, $sendDate);
- return self::returnValue( $res , 0 );
- }
- /**
- * 群发消息发送成员名单
- * @param Request $request
- * @return array
- */
- public function senderList(Request $request){
- $support_type = ['all','sent','unsent','fail']; //支持的查询类型
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'send_num' => 'required|numeric',
- 'send_date' => 'required|date',
- 'type' => Rule::in($support_type)
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $ruleId = $request->input('rule_id');
- $sendNum = $request->input('send_num');
- $sendDate = $request->input('send_date');
- $type = $request->input("type",$support_type[0]);
- $page = $request->input("page",1);
- $pageSize = $request->input("page_size",20);
- $keyword = $request->input("keyword");
- list($total,$list) = PeriodMassMsgService::senderList($corpid, $ruleId, $sendNum, $sendDate, $type, $keyword, $page, $pageSize);
- return self::returnPageValue($list,$total,$pageSize,$page);
- }
- /**
- * 群发消息发送成员名单 - 导出
- * @param Request $request
- * @return array
- */
- public function senderListExport(Request $request){
- $support_type = ['all','sent','unsent','fail']; //支持的查询类型
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'send_num' => 'required|numeric',
- 'send_date' => 'required|date',
- 'type' => Rule::in($support_type)
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $corpid = $request->input('corpid');
- $ruleId = $request->input('rule_id');
- $sendNum = $request->input('send_num');
- $sendDate = $request->input('send_date');
- $type = $request->input("type",$support_type[0]);
- $keyword = $request->input("keyword");
- PeriodMassMsgService::senderListExport($corpid, $ruleId, $sendNum, $sendDate, $type, $keyword);
- }
- /**
- * 获取群发详情-客户列表
- * @param Request $request
- * @return array
- */
- public function massSendCustList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'rule_id' => 'required|int',
- 'send_num' => 'required|numeric',
- 'send_date' => 'required|date',
- 'sender' => 'nullable|string',
- 'name' => 'nullable|string',
- 'type' => 'nullable|int|in:0,1,2,3,4'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $ruleId = $request->input('rule_id');
- $sendNum = $request->input('send_num');
- $sendDate = $request->input('send_date');
- $sender = $request->input('sender');
- $name = $request->input('name');
- $type = $request->input('type');
- $page = $request->input('page', 1);
- $pageSize = (int)$request->input('page_size', 20);
- list($data, $total) = PeriodMassMsgService::massSendCustList($ruleId, $sendNum, $sendDate, $sender, $name, $type, $page, $pageSize);
- return self::returnPageValue($data, $total, $pageSize, $page);
- }
- /**
- * 获取群发详情-客户列表导出
- * @param Request $request
- * @return array
- */
- public function massSendCustListExport(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'rule_id' => 'required|int',
- 'send_num' => 'required|numeric',
- 'send_date' => 'required|date',
- 'sender' => 'nullable|string',
- 'name' => 'nullable|string',
- 'type' => 'nullable|int|in:0,1,2,3,4'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $ruleId = $request->input('rule_id');
- $sendNum = $request->input('send_num');
- $sendDate = $request->input('send_date');
- $sender = $request->input('sender');
- $name = $request->input('name');
- $type = $request->input('type');
- PeriodMassMsgService::massSendCustListExport($ruleId, $sendNum, $sendDate, $sender, $name, $type);
- }
- /**
- * 删除智能群发规则
- * */
- public function deleteRule(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 = PeriodMassMsgService::deleteRule($corpid, $ruleId);
- return self::returnValue([], $errno);
- }
- /**
- * 批量删除智能群发模板
- * */
- public function delTemplate(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'template_ids' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $templateIds = $request->input('template_ids');
- $errno = PeriodMassMsgService::delTemplate($templateIds, $adminId);
- return self::returnValue([], $errno);
- }
- /**
- * 智能群发分组新建/编辑
- * */
- public function editGroup(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'title' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $groupId = $request->input('group_id');
- $operateType = $request->input('operate_type', 1);
- $isOperation = $request->input('is_operation', 0);
- $operatorGroupId = $request->input('operator_group_id');
- $corpid = $request->input('corpid');
- $isAll = $request->input('is_all', 0);
- $senders = $request->input('senders');
- $multipleSenders = $request->input('multiple_senders');
- $groupName = $request->input('title');
- $sysGroupId = $request->input('sys_group_id');
- $adminId = $request->input('admin_id');
- # 创建/编辑 素材组
- list($groupId, $errno) = PeriodMassMsgService::editGroup(
- $groupId, $groupName, $sysGroupId, $adminId, $operateType, $isOperation, $operatorGroupId, $corpid,
- $isAll, $senders, $multipleSenders
- );
- return self::returnValue(['group_id' => $groupId], $errno);
- }
- /**
- * 智能群发分组新建/编辑
- * */
- public function editTempGroup(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'title' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $groupId = $request->input('group_id');
- $groupName = $request->input('title');
- $sysGroupId = $request->input('sys_group_id');
- $adminId = $request->input('admin_id');
- # 创建/编辑 素材组
- list($groupId, $errno) = PeriodMassMsgService::editTempGroup($groupId, $groupName, $sysGroupId, $adminId);
- return self::returnValue(['group_id' => $groupId], $errno);
- }
- /**
- * 分组禁用/启用
- * */
- public function changeGroupStatus(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_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');
- $groupId = $request->input('group_id');
- $errno = PeriodMassMsgService::changeGroupStatus($groupId, $adminId, $sysGroupId, $status);
- return self::returnValue([], $errno);
- }
- /**
- * 模板分组禁用/启用
- * */
- public function changeTempGroupStatus(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_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');
- $groupId = $request->input('group_id');
- $errno = PeriodMassMsgService::changeTempGroupStatus($groupId, $adminId, $sysGroupId, $status);
- return self::returnValue([], $errno);
- }
- /**
- * 分组删除
- * */
- public function delGroup(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $groupId = $request->input('group_id');
- $errno = PeriodMassMsgService::delGroup($groupId, $adminId, $sysGroupId);
- return self::returnValue([], $errno);
- }
- /**
- * 模板分组删除
- * */
- public function delTempGroup(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $groupId = $request->input('group_id');
- $errno = PeriodMassMsgService::delTempGroup($groupId, $adminId, $sysGroupId);
- return self::returnValue([], $errno);
- }
- /**
- * 智能推送分组列表
- * */
- public function groupList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- '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);
- }
- $sysGroupId = $request->input('sys_group_id');
- $creatorId = $request->input('creator_id');
- $keyword = $request->input('keyword');
- $status = $request->input('status');
- $createTimeStart = $request->input('create_time_start');
- $createTimeEnd = $request->input('create_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- # 获取群发规则列表
- $errno = 0;
- list($list, $count) = PeriodMassMsgService::groupList(
- $sysGroupId, $creatorId, $status, $keyword, $createTimeStart,$createTimeEnd, $page, $pageSize, $errno
- );
- if($errno) return self::returnValue([], $errno);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
- /**
- * 智能群发分组详情
- * */
- public function groupDetail(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_id' => 'required|integer',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $groupId = $request->input('group_id');
- $detail = PeriodMassMsgService::groupDetail($groupId, $sysGroupId);
- return self::returnValue($detail);
- }
- /**
- * 智能推送分组列表
- * */
- public function tempGroupList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- '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);
- }
- $sysGroupId = $request->input('sys_group_id');
- $creatorId = $request->input('creator_id');
- $keyword = $request->input('keyword');
- $status = $request->input('status');
- $createTimeStart = $request->input('create_time_start');
- $createTimeEnd = $request->input('create_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- # 获取群发规则列表
- $errno = 0;
- list($list, $count) = PeriodMassMsgService::tempGroupList(
- $sysGroupId, $creatorId, $status, $keyword, $createTimeStart,$createTimeEnd, $page, $pageSize, $errno
- );
- if($errno) return self::returnValue([], $errno);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
- /**
- * 批量移动分组
- * */
- public function changeGroupBatch(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_id' => 'required|integer',
- 'rule_ids' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $ruleIds = $request->input('rule_ids');
- $groupId = $request->input('group_id');
- $errno = PeriodMassMsgService::changeGroupBatch($groupId, $sysGroupId, $adminId, $ruleIds);
- return self::returnValue([], $errno);
- }
- /**
- * 批量移动模板分组
- * */
- public function changeTempGroupBatch(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'group_id' => 'required|integer',
- 'rule_ids' => 'required|string',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $adminId = $request->input('admin_id');
- $sysGroupId = $request->input('sys_group_id');
- $ruleIds = $request->input('rule_ids');
- $groupId = $request->input('group_id');
- $errno = PeriodMassMsgService::changeTempGroupBatch($groupId, $sysGroupId, $adminId, $ruleIds);
- return self::returnValue([], $errno);
- }
- }
|