企微短剧业务系统

ShortPlayDataTrendController.php 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shensong
  5. * Date: 2022/9/18
  6. * Time: 21:19
  7. */
  8. namespace App\Http\Controllers\Api;
  9. use App\Http\Controllers\Controller;
  10. use App\Service\ShortPlayDataTrendService;
  11. use Illuminate\Http\Request;
  12. class ShortPlayDataTrendController extends Controller
  13. {
  14. public function adqShortPlayDataTrendList(Request $request)
  15. {
  16. $validator = \Validator::make($request->all(),[
  17. 'start_date' => 'required|date',
  18. 'end_date' => 'required|date',
  19. 'closing_date' => 'nullable|date',
  20. 'page' => 'required|numeric',
  21. 'page_size' => 'required|numeric',
  22. 'playlet_id' => 'nullable|numeric',
  23. 'plat_order_type' => 'nullable|in:0,1'
  24. ]);
  25. if ($validator->fails()) {
  26. return self::returnValue($validator->getMessageBag(), 1102);
  27. }
  28. $params['start_date'] = $request->input('start_date');
  29. $params['end_date'] = $request->input('end_date');
  30. $params['sys_group_id'] = $request->input('sys_group_id');
  31. $params['playlet_id'] = $request->input('playlet_id', null);
  32. $params['closing_date'] = $request->input('closing_date', null);
  33. $params['plat_order_type'] = $request->input('plat_order_type', null);
  34. $params['cost_cover_min'] = $request->input('cost_cover_min', null);
  35. $params['cost_cover_max'] = $request->input('cost_cover_max', null);
  36. $page = $request->input('page', 1);
  37. $pageSize = $request->input('page_size', 20);
  38. $sortField = $request->input('sort_field', 'ref_date');
  39. $sortType = $request->input('sort_type', 'desc');
  40. list($count, $list, $retrieveColumns) = ShortPlayDataTrendService::adqShortPlayDataTrendList($params, $page, $pageSize, $sortField, $sortType);
  41. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  42. }
  43. public function adqSummaryOfShortDramaDataTrends(Request $request)
  44. {
  45. $validator = \Validator::make($request->all(),[
  46. 'start_date' => 'required|date',
  47. 'end_date' => 'required|date',
  48. ]);
  49. if ($validator->fails()) {
  50. return self::returnValue($validator->getMessageBag(), 1102);
  51. }
  52. $params['playlet_id'] = $request->input('playlet_id');
  53. $params['start_date'] = $request->input('start_date');
  54. $params['end_date'] = $request->input('end_date');
  55. $params['closing_date'] = $request->input('closing_date');
  56. $params['sys_group_id'] = $request->input('sys_group_id');
  57. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  58. $params['cost_cover_min'] = $request->input('cost_cover_min');
  59. $params['cost_cover_max'] = $request->input('cost_cover_max');
  60. list($data, $header) = ShortPlayDataTrendService::adqSummaryOfShortDramaDataTrends($params);
  61. return self::returnValue([
  62. 'data' => $data,
  63. 'header' => $header
  64. ]);
  65. }
  66. public function adqShortPlayDataTrendCurve(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['playlet_id'] = $request->input('playlet_id');
  76. $params['sys_group_id'] = $request->input('sys_group_id');
  77. $params['start_date'] = $request->input('start_date');
  78. $params['end_date'] = $request->input('end_date');
  79. $params['closing_date'] = $request->input('closing_date');
  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 = ShortPlayDataTrendService::adqShortPlayDataTrendCurve($params);
  84. return self::returnValue(['data' => $data]);
  85. }
  86. public function mpShortPlayDataTrendList(Request $request)
  87. {
  88. $validator = \Validator::make($request->all(),[
  89. 'start_date' => 'required|date',
  90. 'end_date' => 'required|date',
  91. 'closing_date' => 'nullable|date',
  92. 'page' => 'required|numeric',
  93. 'page_size' => 'required|numeric',
  94. 'playlet_id' => 'nullable|numeric',
  95. 'plat_order_type' => 'nullable|in:0,1'
  96. ]);
  97. if ($validator->fails()) {
  98. return self::returnValue($validator->getMessageBag(), 1102);
  99. }
  100. $params['start_date'] = $request->input('start_date');
  101. $params['end_date'] = $request->input('end_date');
  102. $params['sys_group_id'] = $request->input('sys_group_id');
  103. $params['playlet_id'] = $request->input('playlet_id', null);
  104. $params['closing_date'] = $request->input('closing_date', null);
  105. $params['plat_order_type'] = $request->input('plat_order_type', null);
  106. $params['cost_cover_min'] = $request->input('cost_cover_min', null);
  107. $params['cost_cover_max'] = $request->input('cost_cover_max', null);
  108. $page = $request->input('page', 1);
  109. $pageSize = $request->input('page_size', 20);
  110. $sortField = $request->input('sort_field', 'ref_date');
  111. $sortType = $request->input('sort_type', 'desc');
  112. list($count, $list, $retrieveColumns) = ShortPlayDataTrendService::mpShortPlayDataTrendList($params, $page, $pageSize, $sortField, $sortType);
  113. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  114. }
  115. public function mpSummaryOfShortDramaDataTrends(Request $request)
  116. {
  117. $validator = \Validator::make($request->all(),[
  118. 'start_date' => 'required|date',
  119. 'end_date' => 'required|date',
  120. ]);
  121. if ($validator->fails()) {
  122. return self::returnValue($validator->getMessageBag(), 1102);
  123. }
  124. $params['playlet_id'] = $request->input('playlet_id');
  125. $params['sys_group_id'] = $request->input('sys_group_id');
  126. $params['start_date'] = $request->input('start_date');
  127. $params['end_date'] = $request->input('end_date');
  128. $params['closing_date'] = $request->input('closing_date');
  129. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  130. $params['cost_cover_min'] = $request->input('cost_cover_min');
  131. $params['cost_cover_max'] = $request->input('cost_cover_max');
  132. list($data, $header) = ShortPlayDataTrendService::mpSummaryOfShortDramaDataTrends($params);
  133. return self::returnValue([
  134. 'data' => $data,
  135. 'header' => $header
  136. ]);
  137. }
  138. public function mpShortPlayDataTrendCurve(Request $request)
  139. {
  140. $validator = \Validator::make($request->all(),[
  141. 'start_date' => 'required|date',
  142. 'end_date' => 'required|date',
  143. ]);
  144. if ($validator->fails()) {
  145. return self::returnValue($validator->getMessageBag(), 1102);
  146. }
  147. $params['playlet_id'] = $request->input('playlet_id');
  148. $params['sys_group_id'] = $request->input('sys_group_id');
  149. $params['start_date'] = $request->input('start_date');
  150. $params['end_date'] = $request->input('end_date');
  151. $params['closing_date'] = $request->input('closing_date');
  152. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  153. $params['cost_cover_min'] = $request->input('cost_cover_min');
  154. $params['cost_cover_max'] = $request->input('cost_cover_max');
  155. $data = ShortPlayDataTrendService::mpShortPlayDataTrendCurve($params);
  156. return self::returnValue(['data' => $data]);
  157. }
  158. public function shortPlayDataTrendList(Request $request)
  159. {
  160. $validator = \Validator::make($request->all(),[
  161. 'start_date' => 'required|date',
  162. 'end_date' => 'required|date',
  163. 'closing_date' => 'nullable|date',
  164. 'page' => 'required|numeric',
  165. 'page_size' => 'required|numeric',
  166. 'playlet_id' => 'nullable|numeric',
  167. 'plat_order_type' => 'nullable|in:0,1'
  168. ]);
  169. if ($validator->fails()) {
  170. return self::returnValue($validator->getMessageBag(), 1102);
  171. }
  172. $params['start_date'] = $request->input('start_date');
  173. $params['end_date'] = $request->input('end_date');
  174. $params['sys_group_id'] = $request->input('sys_group_id');
  175. $params['playlet_id'] = $request->input('playlet_id', null);
  176. $params['closing_date'] = $request->input('closing_date', null);
  177. $params['plat_order_type'] = $request->input('plat_order_type', null);
  178. $params['cost_cover_min'] = $request->input('cost_cover_min', null);
  179. $params['cost_cover_max'] = $request->input('cost_cover_max', null);
  180. $page = $request->input('page', 1);
  181. $pageSize = $request->input('page_size', 20);
  182. $sortField = $request->input('sort_field', 'ref_date');
  183. $sortType = $request->input('sort_type', 'desc');
  184. list($count, $list, $retrieveColumns) = ShortPlayDataTrendService::shortPlayDataTrendList($params, $page, $pageSize, $sortField, $sortType);
  185. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  186. }
  187. public function summaryOfShortDramaDataTrends(Request $request)
  188. {
  189. $validator = \Validator::make($request->all(),[
  190. 'start_date' => 'required|date',
  191. 'end_date' => 'required|date',
  192. ]);
  193. if ($validator->fails()) {
  194. return self::returnValue($validator->getMessageBag(), 1102);
  195. }
  196. $params['playlet_id'] = $request->input('playlet_id');
  197. $params['start_date'] = $request->input('start_date');
  198. $params['end_date'] = $request->input('end_date');
  199. $params['closing_date'] = $request->input('closing_date');
  200. $params['sys_group_id'] = $request->input('sys_group_id');
  201. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  202. $params['cost_cover_min'] = $request->input('cost_cover_min');
  203. $params['cost_cover_max'] = $request->input('cost_cover_max');
  204. list($data, $header) = ShortPlayDataTrendService::summaryOfShortDramaDataTrends($params);
  205. return self::returnValue([
  206. 'data' => $data,
  207. 'header' => $header
  208. ]);
  209. }
  210. public function shortPlayDataTrendCurve(Request $request)
  211. {
  212. $validator = \Validator::make($request->all(),[
  213. 'start_date' => 'required|date',
  214. 'end_date' => 'required|date',
  215. ]);
  216. if ($validator->fails()) {
  217. return self::returnValue($validator->getMessageBag(), 1102);
  218. }
  219. $params['playlet_id'] = $request->input('playlet_id');
  220. $params['sys_group_id'] = $request->input('sys_group_id');
  221. $params['start_date'] = $request->input('start_date');
  222. $params['end_date'] = $request->input('end_date');
  223. $params['closing_date'] = $request->input('closing_date');
  224. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  225. $params['cost_cover_min'] = $request->input('cost_cover_min');
  226. $params['cost_cover_max'] = $request->input('cost_cover_max');
  227. $data = ShortPlayDataTrendService::shortPlayDataTrendCurve($params);
  228. return self::returnValue(['data' => $data]);
  229. }
  230. public function shortPlayDataTrendListByAccount(Request $request)
  231. {
  232. $validator = \Validator::make($request->all(),[
  233. 'start_date' => 'required|date',
  234. 'end_date' => 'required|date',
  235. 'closing_date' => 'nullable|date',
  236. 'page' => 'required|numeric',
  237. 'page_size' => 'required|numeric',
  238. 'playlet_id' => 'nullable|numeric',
  239. 'plat_order_type' => 'nullable|in:0,1',
  240. 'ad_type' => 'required|in:0,1,2'
  241. ]);
  242. if ($validator->fails()) {
  243. return self::returnValue($validator->getMessageBag(), 1102);
  244. }
  245. $params['start_date'] = $request->input('start_date');
  246. $params['end_date'] = $request->input('end_date');
  247. $params['playlet_id'] = $request->input('playlet_id', null);
  248. $params['closing_date'] = $request->input('closing_date', null);
  249. $params['plat_order_type'] = $request->input('plat_order_type', null);
  250. $params['cost_cover_min'] = $request->input('cost_cover_min', null);
  251. $params['cost_cover_max'] = $request->input('cost_cover_max', null);
  252. $params['admin_id'] = $request->input('admin_id');
  253. $params['is_system_admin'] = $request->input('is_system_admin');
  254. $params['sys_group_id'] = $request->input('sys_group_id');
  255. $params['ad_type'] = $request->input('ad_type');
  256. $page = $request->input('page', 1);
  257. $pageSize = $request->input('page_size', 20);
  258. $sortField = $request->input('sort_field', 'ref_date');
  259. $sortType = $request->input('sort_type', 'desc');
  260. list($count, $list, $retrieveColumns) = ShortPlayDataTrendService::shortPlayDataTrendListByAccount($params
  261. , $page, $pageSize, $sortField, $sortType);
  262. return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns);
  263. }
  264. public function summaryOfShortDramaDataTrendsByAccount(Request $request)
  265. {
  266. $validator = \Validator::make($request->all(),[
  267. 'start_date' => 'required|date',
  268. 'end_date' => 'required|date',
  269. 'closing_date' => 'nullable|date',
  270. 'playlet_id' => 'nullable|numeric',
  271. 'plat_order_type' => 'nullable|in:0,1',
  272. 'ad_type' => 'required|in:0,1,2'
  273. ]);
  274. if ($validator->fails()) {
  275. return self::returnValue($validator->getMessageBag(), 1102);
  276. }
  277. $params['playlet_id'] = $request->input('playlet_id');
  278. $params['start_date'] = $request->input('start_date');
  279. $params['end_date'] = $request->input('end_date');
  280. $params['closing_date'] = $request->input('closing_date');
  281. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  282. $params['cost_cover_min'] = $request->input('cost_cover_min');
  283. $params['cost_cover_max'] = $request->input('cost_cover_max');
  284. $params['admin_id'] = $request->input('admin_id');
  285. $params['is_system_admin'] = $request->input('is_system_admin');
  286. $params['sys_group_id'] = $request->input('sys_group_id');
  287. $params['ad_type'] = $request->input('ad_type');
  288. list($data, $header) = ShortPlayDataTrendService::summaryOfShortDramaDataTrendsByAccount($params);
  289. return self::returnValue([
  290. 'data' => $data,
  291. 'header' => $header
  292. ]);
  293. }
  294. public function shortPlayDataTrendCurveByAccount(Request $request)
  295. {
  296. $validator = \Validator::make($request->all(),[
  297. 'start_date' => 'required|date',
  298. 'end_date' => 'required|date',
  299. 'closing_date' => 'nullable|date',
  300. 'playlet_id' => 'nullable|numeric',
  301. 'plat_order_type' => 'nullable|in:0,1',
  302. 'ad_type' => 'required|in:0,1,2'
  303. ]);
  304. if ($validator->fails()) {
  305. return self::returnValue($validator->getMessageBag(), 1102);
  306. }
  307. $params['playlet_id'] = $request->input('playlet_id');
  308. $params['start_date'] = $request->input('start_date');
  309. $params['end_date'] = $request->input('end_date');
  310. $params['closing_date'] = $request->input('closing_date');
  311. $params['plat_order_type'] = $request->input('plat_order_type'); // 0:小程序 1:h5
  312. $params['cost_cover_min'] = $request->input('cost_cover_min');
  313. $params['cost_cover_max'] = $request->input('cost_cover_max');
  314. $params['admin_id'] = $request->input('admin_id');
  315. $params['is_system_admin'] = $request->input('is_system_admin');
  316. $params['sys_group_id'] = $request->input('sys_group_id');
  317. $params['ad_type'] = $request->input('ad_type');
  318. $data = ShortPlayDataTrendService::shortPlayDataTrendCurveByAccount($params);
  319. return self::returnValue(['data' => $data]);
  320. }
  321. }