企微短剧业务系统

MassMsgCancelController.php 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Service\MassMsgCancelService;
  4. use Illuminate\Http\Request;
  5. use App\Http\Controllers\Controller;
  6. use Illuminate\Validation\Rule;
  7. class MassMsgCancelController extends Controller
  8. {
  9. /**
  10. * 创建企业群发停止任务
  11. * */
  12. public function setConfig(Request $request)
  13. {
  14. $validator = \Validator::make($request->all(),[
  15. 'rule_id' => 'required|int',
  16. 'type' => ['required', Rule::in([1, 2, 3, 4])],
  17. ]);
  18. if ($validator->fails()) {
  19. return self::returnValue($validator->getMessageBag(), 1102);
  20. }
  21. $sysGroupId = $request->input('sys_group_id');
  22. $adminId = $request->input('admin_id');
  23. $type = $request->input('type');
  24. $ruleId = $request->input('rule_id');
  25. # 创建任务
  26. $errno = MassMsgCancelService::setConfig($ruleId, $type, $sysGroupId, $adminId);
  27. return self::returnValue([], $errno);
  28. }
  29. /**
  30. * 群发停止任务列表
  31. * */
  32. public function taskList(Request $request)
  33. {
  34. $validator = \Validator::make($request->all(),[
  35. 'type' => ['required', Rule::in([1, 2, 3, 4])],
  36. ]);
  37. if ($validator->fails()) {
  38. return self::returnValue($validator->getMessageBag(), 1102);
  39. }
  40. $sysGroupId = $request->input('sys_group_id');
  41. $type = $request->input('type');
  42. $page = $request->input('page', 1);
  43. $pageSize = $request->input('page_size', 20);
  44. # 获取群发停止任务列表
  45. list($list, $count) = MassMsgCancelService::taskList($sysGroupId, $type, $page, $pageSize);
  46. return self::returnPageValue($list, $count, $pageSize, $page);
  47. }
  48. }