企微短剧业务系统

AccountDataTrendController.php 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Service\AccountDataTrendService;
  4. use Illuminate\Http\Request;
  5. use App\Http\Controllers\Controller;
  6. class AccountDataTrendController extends Controller
  7. {
  8. /**
  9. * ADQ账号数据趋势
  10. * */
  11. public function adqAccount(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['account_id'] = $request->input('account_id');
  21. $params['sys_group_id'] = $request->input('sys_group_id');
  22. $params['start_date'] = $request->input('start_date');
  23. $params['end_date'] = $request->input('end_date');
  24. $params['closing_date'] = $request->input('closing_date');
  25. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  26. $params['cost_cover_min'] = $request->input('cost_cover_min');
  27. $params['cost_cover_max'] = $request->input('cost_cover_max');
  28. $sortField = $request->input('sort_field', 'account_id');
  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) = AccountDataTrendService::getAdqAccountDataTrend(
  33. $params, $sortField, $sortType, $page, $pageSize
  34. );
  35. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  36. }
  37. /**
  38. * ADQ账号总概数据
  39. * */
  40. public function adqAccountSummary(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['account_id'] = $request->input('account_id');
  50. $params['start_date'] = $request->input('start_date');
  51. $params['end_date'] = $request->input('end_date');
  52. $params['closing_date'] = $request->input('closing_date');
  53. $params['sys_group_id'] = $request->input('sys_group_id');
  54. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  55. $params['cost_cover_min'] = $request->input('cost_cover_min');
  56. $params['cost_cover_max'] = $request->input('cost_cover_max');
  57. list($data, $header) = AccountDataTrendService::getAdqAccountDataSummary($params);
  58. return self::returnValue([
  59. 'data' => $data,
  60. 'header' => $header
  61. ]);
  62. }
  63. /**
  64. * Adq账号数据汇总曲线
  65. * */
  66. public function adqAccountCurve(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['account_id'] = $request->input('account_id');
  76. $params['start_date'] = $request->input('start_date');
  77. $params['end_date'] = $request->input('end_date');
  78. $params['closing_date'] = $request->input('closing_date');
  79. $params['sys_group_id'] = $request->input('sys_group_id');
  80. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  81. $params['cost_cover_min'] = $request->input('cost_cover_min');
  82. $params['cost_cover_max'] = $request->input('cost_cover_max');
  83. $data = AccountDataTrendService::getAdqAccountDataCurve($params);
  84. return self::returnValue(['data' => $data]);
  85. }
  86. /**
  87. * MP账号数据趋势
  88. * */
  89. public function mpAccount(Request $request)
  90. {
  91. $validator = \Validator::make($request->all(),[
  92. 'start_date' => 'required|date',
  93. 'end_date' => 'required|date',
  94. ]);
  95. if ($validator->fails()) {
  96. return self::returnValue($validator->getMessageBag(), 1102);
  97. }
  98. $params['app_id'] = $request->input('app_id');
  99. $params['sys_group_id'] = $request->input('sys_group_id');
  100. $params['start_date'] = $request->input('start_date');
  101. $params['end_date'] = $request->input('end_date');
  102. $params['closing_date'] = $request->input('closing_date');
  103. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  104. $params['cost_cover_min'] = $request->input('cost_cover_min');
  105. $params['cost_cover_max'] = $request->input('cost_cover_max');
  106. $sortField = $request->input('sort_field', 'account_id');
  107. $sortType = $request->input('sort_type', 'desc'); // 排序方式
  108. $page = $request->input('page', 1);
  109. $pageSize = $request->input('page_size', 10);
  110. list($list, $count, $retrieveColumns) = AccountDataTrendService::getMpAccountDataTrend(
  111. $params, $sortField, $sortType, $page, $pageSize
  112. );
  113. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  114. }
  115. /**
  116. * MP账号总概数据
  117. * */
  118. public function mpAccountSummary(Request $request)
  119. {
  120. $validator = \Validator::make($request->all(),[
  121. 'start_date' => 'required|date',
  122. 'end_date' => 'required|date',
  123. ]);
  124. if ($validator->fails()) {
  125. return self::returnValue($validator->getMessageBag(), 1102);
  126. }
  127. $params['app_id'] = $request->input('app_id');
  128. $params['sys_group_id'] = $request->input('sys_group_id');
  129. $params['start_date'] = $request->input('start_date');
  130. $params['end_date'] = $request->input('end_date');
  131. $params['closing_date'] = $request->input('closing_date');
  132. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  133. $params['cost_cover_min'] = $request->input('cost_cover_min');
  134. $params['cost_cover_max'] = $request->input('cost_cover_max');
  135. list($data, $header) = AccountDataTrendService::getMpAccountDataSummary($params);
  136. return self::returnValue([
  137. 'data' => $data,
  138. 'header' => $header
  139. ]);
  140. }
  141. /**
  142. * Adq账号数据汇总曲线
  143. * */
  144. public function mpAccountCurve(Request $request)
  145. {
  146. $validator = \Validator::make($request->all(),[
  147. 'start_date' => 'required|date',
  148. 'end_date' => 'required|date',
  149. ]);
  150. if ($validator->fails()) {
  151. return self::returnValue($validator->getMessageBag(), 1102);
  152. }
  153. $params['app_id'] = $request->input('app_id');
  154. $params['sys_group_id'] = $request->input('sys_group_id');
  155. $params['start_date'] = $request->input('start_date');
  156. $params['end_date'] = $request->input('end_date');
  157. $params['closing_date'] = $request->input('closing_date');
  158. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  159. $params['cost_cover_min'] = $request->input('cost_cover_min');
  160. $params['cost_cover_max'] = $request->input('cost_cover_max');
  161. $data = AccountDataTrendService::getMpAccountDataCurve($params);
  162. return self::returnValue(['data' => $data]);
  163. }
  164. /**
  165. * 账号数据趋势(ADQ+MP)
  166. * */
  167. public function account(Request $request)
  168. {
  169. $validator = \Validator::make($request->all(),[
  170. 'start_date' => 'required|date',
  171. 'end_date' => 'required|date',
  172. ]);
  173. if ($validator->fails()) {
  174. return self::returnValue($validator->getMessageBag(), 1102);
  175. }
  176. $params['account_id'] = $request->input('account_id');
  177. $params['sys_group_id'] = $request->input('sys_group_id');
  178. $params['admin_id'] = $request->input('admin_id');
  179. $params['is_system_admin'] = $request->input('is_system_admin');
  180. $params['ad_type'] = $request->input('ad_type');
  181. $params['start_date'] = $request->input('start_date');
  182. $params['end_date'] = $request->input('end_date');
  183. $params['closing_date'] = $request->input('closing_date');
  184. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  185. $params['cost_cover_min'] = $request->input('cost_cover_min');
  186. $params['cost_cover_max'] = $request->input('cost_cover_max');
  187. $sortField = $request->input('sort_field', '_key');
  188. $sortType = $request->input('sort_type', 'desc'); // 排序方式
  189. $page = $request->input('page', 1);
  190. $pageSize = $request->input('page_size', 10);
  191. list($list, $count, $retrieveColumns) = AccountDataTrendService::getAccountDataTrend(
  192. $params, $sortField, $sortType, $page, $pageSize
  193. );
  194. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  195. }
  196. /**
  197. * 账号总概数据(ADQ+MP)
  198. * */
  199. public function accountSummary(Request $request)
  200. {
  201. $validator = \Validator::make($request->all(),[
  202. 'start_date' => 'required|date',
  203. 'end_date' => 'required|date',
  204. ]);
  205. if ($validator->fails()) {
  206. return self::returnValue($validator->getMessageBag(), 1102);
  207. }
  208. $params['account_id'] = $request->input('account_id');
  209. $params['sys_group_id'] = $request->input('sys_group_id');
  210. $params['admin_id'] = $request->input('admin_id');
  211. $params['is_system_admin'] = $request->input('is_system_admin');
  212. $params['ad_type'] = $request->input('ad_type');
  213. $params['start_date'] = $request->input('start_date');
  214. $params['end_date'] = $request->input('end_date');
  215. $params['closing_date'] = $request->input('closing_date');
  216. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  217. $params['cost_cover_min'] = $request->input('cost_cover_min');
  218. $params['cost_cover_max'] = $request->input('cost_cover_max');
  219. list($data, $header) = AccountDataTrendService::getAccountDataSummary($params);
  220. return self::returnValue([
  221. 'data' => $data,
  222. 'header' => $header
  223. ]);
  224. }
  225. /**
  226. * 账号数据汇总曲线(ADQ+MP)
  227. * */
  228. public function accountCurve(Request $request)
  229. {
  230. $validator = \Validator::make($request->all(),[
  231. 'start_date' => 'required|date',
  232. 'end_date' => 'required|date',
  233. ]);
  234. if ($validator->fails()) {
  235. return self::returnValue($validator->getMessageBag(), 1102);
  236. }
  237. $params['account_id'] = $request->input('account_id');
  238. $params['sys_group_id'] = $request->input('sys_group_id');
  239. $params['admin_id'] = $request->input('admin_id');
  240. $params['is_system_admin'] = $request->input('is_system_admin');
  241. $params['ad_type'] = $request->input('ad_type');
  242. $params['start_date'] = $request->input('start_date');
  243. $params['end_date'] = $request->input('end_date');
  244. $params['closing_date'] = $request->input('closing_date');
  245. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  246. $params['cost_cover_min'] = $request->input('cost_cover_min');
  247. $params['cost_cover_max'] = $request->input('cost_cover_max');
  248. $data = AccountDataTrendService::getAccountDataCurve($params);
  249. return self::returnValue(['data' => $data]);
  250. }
  251. }