12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Service\MassMsgCancelService;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use Illuminate\Validation\Rule;
- class MassMsgCancelController extends Controller
- {
- /**
- * 创建企业群发停止任务
- * */
- public function setConfig(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'rule_id' => 'required|int',
- 'type' => ['required', Rule::in([1, 2, 3, 4])],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $adminId = $request->input('admin_id');
- $type = $request->input('type');
- $ruleId = $request->input('rule_id');
- # 创建任务
- $errno = MassMsgCancelService::setConfig($ruleId, $type, $sysGroupId, $adminId);
- return self::returnValue([], $errno);
- }
- /**
- * 群发停止任务列表
- * */
- public function taskList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'type' => ['required', Rule::in([1, 2, 3, 4])],
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sysGroupId = $request->input('sys_group_id');
- $type = $request->input('type');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- # 获取群发停止任务列表
- list($list, $count) = MassMsgCancelService::taskList($sysGroupId, $type, $page, $pageSize);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
- }
|