企微短剧业务系统

OperateController.php 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Service\OperateDataService;
  4. use Illuminate\Http\Request;
  5. use App\Http\Controllers\Controller;
  6. class OperateController extends Controller
  7. {
  8. /**
  9. * 运营公众号数据
  10. * */
  11. public function accountData(Request $request)
  12. {
  13. $validator = \Validator::make($request->all(),[
  14. 'start_date' => 'required|date',
  15. 'end_date' => 'required|date',
  16. ]);
  17. if ($validator->fails()) {
  18. return self::returnValue($validator->getMessageBag(), 1102);
  19. }
  20. $params['start_date'] = $request->input('start_date');
  21. $params['end_date'] = $request->input('end_date');
  22. $params['operator_id'] = $request->input('operator_id');
  23. $params['app_id'] = $request->input('app_id');
  24. $params['closing_date'] = $request->input('closing_date');
  25. $params['sys_group_id'] = $request->input('sys_group_id');
  26. $params['is_system_admin'] = $request->input('is_system_admin');
  27. $params['admin_id'] = $request->input('admin_id');
  28. $sortField = $request->input('sort_field', '_key');
  29. $sortType = $request->input('sort_type', 'desc'); // 排序方式
  30. $page = $request->input('page', 1);
  31. $pageSize = $request->input('page_size', 10);
  32. list($list, $count, $retrieveColumns) = OperateDataService::getAccountData(
  33. $params, $sortField, $sortType, $page, $pageSize
  34. );
  35. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  36. }
  37. /**
  38. * 运营公众号数据汇总
  39. * */
  40. public function accountDataSummary(Request $request)
  41. {
  42. $validator = \Validator::make($request->all(),[
  43. 'start_date' => 'required|date',
  44. 'end_date' => 'required|date',
  45. ]);
  46. if ($validator->fails()) {
  47. return self::returnValue($validator->getMessageBag(), 1102);
  48. }
  49. $params['start_date'] = $request->input('start_date');
  50. $params['end_date'] = $request->input('end_date');
  51. $params['operator_id'] = $request->input('operator_id');
  52. $params['app_id'] = $request->input('app_id');
  53. $params['closing_date'] = $request->input('closing_date');
  54. $params['sys_group_id'] = $request->input('sys_group_id');
  55. $params['admin_id'] = $request->input('admin_id');
  56. $params['is_system_admin'] = $request->input('is_system_admin');
  57. list($data, $header) = OperateDataService::getAccountDataSummary($params);
  58. return self::returnValue([
  59. 'data' => $data,
  60. 'header' => $header
  61. ]);
  62. }
  63. /**
  64. * 运营数据
  65. * */
  66. public function data(Request $request)
  67. {
  68. $validator = \Validator::make($request->all(),[
  69. 'start_date' => 'required|date',
  70. 'end_date' => 'required|date',
  71. ]);
  72. if ($validator->fails()) {
  73. return self::returnValue($validator->getMessageBag(), 1102);
  74. }
  75. $params['start_date'] = $request->input('start_date');
  76. $params['end_date'] = $request->input('end_date');
  77. $params['operator_id'] = $request->input('operator_id');
  78. $params['closing_date'] = $request->input('closing_date');
  79. $params['sys_group_id'] = $request->input('sys_group_id');
  80. $params['admin_id'] = $request->input('admin_id');
  81. $params['is_system_admin'] = $request->input('is_system_admin');
  82. $sortField = $request->input('sort_field', '_key');
  83. $sortType = $request->input('sort_type', 'desc'); // 排序方式
  84. $page = $request->input('page', 1);
  85. $pageSize = $request->input('page_size', 10);
  86. list($list, $count, $retrieveColumns) = OperateDataService::getOperateData(
  87. $params, $sortField, $sortType, $page, $pageSize
  88. );
  89. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  90. }
  91. /**
  92. * 运营数据汇总
  93. * */
  94. public function dataSummary(Request $request)
  95. {
  96. $validator = \Validator::make($request->all(),[
  97. 'start_date' => 'required|date',
  98. 'end_date' => 'required|date',
  99. ]);
  100. if ($validator->fails()) {
  101. return self::returnValue($validator->getMessageBag(), 1102);
  102. }
  103. $params['start_date'] = $request->input('start_date');
  104. $params['end_date'] = $request->input('end_date');
  105. $params['operator_id'] = $request->input('operator_id');
  106. $params['closing_date'] = $request->input('closing_date');
  107. $params['sys_group_id'] = $request->input('sys_group_id');
  108. $params['admin_id'] = $request->input('admin_id');
  109. $params['is_system_admin'] = $request->input('is_system_admin');
  110. list($data, $header) = OperateDataService::getOperateDataSummary($params);
  111. return self::returnValue([
  112. 'data' => $data,
  113. 'header' => $header
  114. ]);
  115. }
  116. }