企微短剧业务系统

PopularizController.php 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Service\PopularizService;
  4. use Illuminate\Http\Request;
  5. use App\Http\Controllers\Controller;
  6. class PopularizController extends Controller
  7. {
  8. /**
  9. * 客户群发
  10. * */
  11. public function ruleLists(Request $request)
  12. {
  13. $validator = \Validator::make($request->all(),[
  14. 'send_time_start' => 'nullable|date_format:Y-m-d',
  15. 'send_time_end' => 'nullable|date_format:Y-m-d',
  16. ]);
  17. if ($validator->fails()) {
  18. return self::returnValue($validator->getMessageBag(), 1102);
  19. }
  20. $creatorId = $request->input('creator_id');
  21. $sendTimeStart = $request->input('send_time_start');
  22. $sendTimeEnd = $request->input('send_time_end');
  23. $page = $request->input('page', 1);
  24. $pageSize = $request->input('page_size', 20);
  25. $sortColumn = $request->input('sort_column','send_time');
  26. $group_admin_id = $request->input("group_admin_id",0);
  27. $is_system_admin = $request->input("is_system_admin",0);
  28. $sys_group_id = $request->input('sys_group_id');
  29. # 获取群发规则列表
  30. $errno = 0;
  31. list($list, $count) = PopularizService::ruleList(
  32. $creatorId, $sendTimeStart, $sendTimeEnd, $sortColumn, $page, $pageSize, $is_system_admin, $group_admin_id,
  33. $errno, $sys_group_id
  34. );
  35. if($errno) return self::returnValue([], $errno);
  36. return self::returnPageValue($list, $count, $pageSize, $page);
  37. }
  38. public function ruleTotal(Request $request)
  39. {
  40. $validator = \Validator::make($request->all(),[
  41. 'send_time_start' => 'nullable|date_format:Y-m-d',
  42. 'send_time_end' => 'nullable|date_format:Y-m-d',
  43. ]);
  44. if ($validator->fails()) {
  45. return self::returnValue($validator->getMessageBag(), 1102);
  46. }
  47. $creatorId = $request->input('creator_id');
  48. $sendTimeStart = $request->input('send_time_start');
  49. $sendTimeEnd = $request->input('send_time_end');
  50. $group_admin_id = $request->input("group_admin_id",0);
  51. $is_system_admin = $request->input("is_system_admin",0);
  52. $sys_group_id = $request->input('sys_group_id');
  53. # 获取群发规则列表
  54. $result = PopularizService::getRuleTotal($creatorId, $sendTimeStart, $sendTimeEnd, $is_system_admin, $group_admin_id,
  55. $sys_group_id);
  56. return self::returnValue($result);
  57. }
  58. /**
  59. * 朋友圈任务列表
  60. * */
  61. public function taskList(Request $request)
  62. {
  63. $validator = \Validator::make($request->all(),[
  64. 'send_time_start' => 'nullable|date_format:Y-m-d',
  65. 'send_time_end' => 'nullable|date_format:Y-m-d',
  66. ]);
  67. if ($validator->fails()) {
  68. return self::returnValue($validator->getMessageBag(), 1102);
  69. }
  70. $creatorId = $request->input('creator_id');
  71. $sendTimeStart = $request->input('send_time_start');
  72. $sendTimeEnd = $request->input('send_time_end');
  73. $page = $request->input('page', 1);
  74. $pageSize = $request->input('page_size', 20);
  75. $sortColumn = $request->input('sort_column','send_time');
  76. $group_admin_id = $request->input("group_admin_id",0);
  77. $is_system_admin = $request->input("is_system_admin",0);
  78. $sys_group_id = $request->input('sys_group_id');
  79. # 获取群发规则列表
  80. $errno = 0;
  81. list($list, $count) = PopularizService::taskList(
  82. $creatorId, $sendTimeStart, $sendTimeEnd, $sortColumn, $page, $pageSize, $is_system_admin, $group_admin_id,
  83. $errno, $sys_group_id
  84. );
  85. if($errno) return self::returnValue([], $errno);
  86. return self::returnPageValue($list, $count, $pageSize, $page);
  87. }
  88. public function momentTotal(Request $request)
  89. {
  90. $validator = \Validator::make($request->all(),[
  91. 'send_time_start' => 'nullable|date_format:Y-m-d',
  92. 'send_time_end' => 'nullable|date_format:Y-m-d',
  93. ]);
  94. if ($validator->fails()) {
  95. return self::returnValue($validator->getMessageBag(), 1102);
  96. }
  97. $creatorId = $request->input('creator_id');
  98. $sendTimeStart = $request->input('send_time_start');
  99. $sendTimeEnd = $request->input('send_time_end');
  100. $group_admin_id = $request->input("group_admin_id",0);
  101. $is_system_admin = $request->input("is_system_admin",0);
  102. $sys_group_id = $request->input('sys_group_id');
  103. # 获取群发规则列表
  104. $result = PopularizService::getMomentTotal($creatorId, $sendTimeStart, $sendTimeEnd, $is_system_admin,
  105. $group_admin_id, $sys_group_id);
  106. return self::returnValue($result);
  107. }
  108. public function promotionData(Request $request) {
  109. $validator = \Validator::make($request->all(),[
  110. 'send_time_start' => 'nullable|date_format:Y-m-d',
  111. 'send_time_end' => 'nullable|date_format:Y-m-d',
  112. ]);
  113. if ($validator->fails()) {
  114. return self::returnValue($validator->getMessageBag(), 1102);
  115. }
  116. $sendTimeStart = $request->input('send_time_start');
  117. $sendTimeEnd = $request->input('send_time_end');
  118. $page = $request->input('page', 1);
  119. $pageSize = $request->input('page_size', 20);
  120. $keyword = $request->input('keyword');
  121. $platType = $request->input('plat_type');
  122. $groupAdminId = $request->input("group_admin_id",0);
  123. $isSystemAdmin = $request->input("is_system_admin",0);
  124. $sysGroupId = $request->input('sys_group_id');
  125. # 获取群发规则列表
  126. list($result, $count, $totalStat) = PopularizService::promotionData($platType, $sendTimeStart, $sendTimeEnd, $keyword, $page, $pageSize);
  127. return self::returnPageValue($result, $count, $pageSize, $page, $totalStat);
  128. }
  129. }