企微短剧业务系统

OperationGroupController.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Service\OperationGroupService;
  4. use Illuminate\Http\Request;
  5. use App\Http\Controllers\Controller;
  6. use Illuminate\Validation\Rule;
  7. class OperationGroupController extends Controller
  8. {
  9. /**
  10. * 运营组信息设置
  11. * */
  12. public function setConfig(Request $request)
  13. {
  14. $validator = \Validator::make($request->all(),[
  15. 'group_name' => 'required|string',
  16. 'operator_id' => 'required|int',
  17. 'corp_user_list' => 'required',
  18. ]);
  19. if ($validator->fails()) {
  20. return self::returnValue($validator->getMessageBag(), 1102);
  21. }
  22. $groupId = $request->input('group_id');
  23. $groupName = $request->input('group_name');
  24. $operatorId = $request->input('operator_id');
  25. $corpUserList = $request->input('corp_user_list');
  26. $sysGroupId = $request->input('sys_group_id');
  27. $adminId = $request->input('admin_id');
  28. # 配置运营组信息
  29. $errno = OperationGroupService::setConfig($groupId, $groupName, $operatorId, $corpUserList, $sysGroupId, $adminId);
  30. return self::returnValue([], $errno);
  31. }
  32. /**
  33. * 运营组列表
  34. * */
  35. public function groupList(Request $request)
  36. {
  37. $sysGroupId = $request->input('sys_group_id');
  38. $adminId = $request->input('admin_id');
  39. $operatorId = $request->input('operator_id');
  40. $page = $request->input('page', 1);
  41. $pageSize = $request->input('page_size', 20);
  42. # 获取运营组列表
  43. list($list, $count) = OperationGroupService::groupList($sysGroupId, $adminId, $operatorId, $page, $pageSize);
  44. return self::returnPageValue($list, $count, $pageSize, $page);
  45. }
  46. /**
  47. * 运营组详情
  48. * */
  49. public function groupDetail(Request $request)
  50. {
  51. $validator = \Validator::make($request->all(),[
  52. 'group_id' => 'required|int',
  53. ]);
  54. if ($validator->fails()) {
  55. return self::returnValue($validator->getMessageBag(), 1102);
  56. }
  57. $sysGroupId = $request->input('sys_group_id');
  58. $groupId = $request->input('group_id');
  59. # 获取运营组详情数据
  60. $errno = 0;
  61. $data = OperationGroupService::groupDetail($groupId, $sysGroupId, $errno);
  62. return self::returnValue($data, $errno);
  63. }
  64. /**
  65. * 运营组 开启/禁用
  66. * */
  67. public function groupStatusChange(Request $request)
  68. {
  69. $validator = \Validator::make($request->all(),[
  70. 'group_id' => 'required|int',
  71. 'status' => ['required',Rule::in([0, 1])],
  72. ]);
  73. if ($validator->fails()) {
  74. return self::returnValue($validator->getMessageBag(), 1102);
  75. }
  76. $sysGroupId = $request->input('sys_group_id');
  77. $groupId = $request->input('group_id');
  78. $status = $request->input('status');
  79. # 修改运营组状态
  80. $errno = OperationGroupService::changeStatus($sysGroupId, $groupId, $status);
  81. return self::returnValue([], $errno);
  82. }
  83. }