企微短剧业务系统

ActiveFansDataController.php 13KB

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