123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Service\PopularizService;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- class PopularizController extends Controller
- {
- /**
- * 客户群发
- * */
- public function ruleLists(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'send_time_start' => 'nullable|date_format:Y-m-d',
- 'send_time_end' => 'nullable|date_format:Y-m-d',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $creatorId = $request->input('creator_id');
- $sendTimeStart = $request->input('send_time_start');
- $sendTimeEnd = $request->input('send_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- $sortColumn = $request->input('sort_column','send_time');
- $group_admin_id = $request->input("group_admin_id",0);
- $is_system_admin = $request->input("is_system_admin",0);
- $sys_group_id = $request->input('sys_group_id');
- # 获取群发规则列表
- $errno = 0;
- list($list, $count) = PopularizService::ruleList(
- $creatorId, $sendTimeStart, $sendTimeEnd, $sortColumn, $page, $pageSize, $is_system_admin, $group_admin_id,
- $errno, $sys_group_id
- );
- if($errno) return self::returnValue([], $errno);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
- public function ruleTotal(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'send_time_start' => 'nullable|date_format:Y-m-d',
- 'send_time_end' => 'nullable|date_format:Y-m-d',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $creatorId = $request->input('creator_id');
- $sendTimeStart = $request->input('send_time_start');
- $sendTimeEnd = $request->input('send_time_end');
- $group_admin_id = $request->input("group_admin_id",0);
- $is_system_admin = $request->input("is_system_admin",0);
- $sys_group_id = $request->input('sys_group_id');
- # 获取群发规则列表
- $result = PopularizService::getRuleTotal($creatorId, $sendTimeStart, $sendTimeEnd, $is_system_admin, $group_admin_id,
- $sys_group_id);
- return self::returnValue($result);
- }
- /**
- * 朋友圈任务列表
- * */
- public function taskList(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'send_time_start' => 'nullable|date_format:Y-m-d',
- 'send_time_end' => 'nullable|date_format:Y-m-d',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $creatorId = $request->input('creator_id');
- $sendTimeStart = $request->input('send_time_start');
- $sendTimeEnd = $request->input('send_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- $sortColumn = $request->input('sort_column','send_time');
- $group_admin_id = $request->input("group_admin_id",0);
- $is_system_admin = $request->input("is_system_admin",0);
- $sys_group_id = $request->input('sys_group_id');
- # 获取群发规则列表
- $errno = 0;
- list($list, $count) = PopularizService::taskList(
- $creatorId, $sendTimeStart, $sendTimeEnd, $sortColumn, $page, $pageSize, $is_system_admin, $group_admin_id,
- $errno, $sys_group_id
- );
- if($errno) return self::returnValue([], $errno);
- return self::returnPageValue($list, $count, $pageSize, $page);
- }
- public function momentTotal(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'send_time_start' => 'nullable|date_format:Y-m-d',
- 'send_time_end' => 'nullable|date_format:Y-m-d',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $creatorId = $request->input('creator_id');
- $sendTimeStart = $request->input('send_time_start');
- $sendTimeEnd = $request->input('send_time_end');
- $group_admin_id = $request->input("group_admin_id",0);
- $is_system_admin = $request->input("is_system_admin",0);
- $sys_group_id = $request->input('sys_group_id');
- # 获取群发规则列表
- $result = PopularizService::getMomentTotal($creatorId, $sendTimeStart, $sendTimeEnd, $is_system_admin,
- $group_admin_id, $sys_group_id);
- return self::returnValue($result);
- }
- public function promotionData(Request $request) {
- $validator = \Validator::make($request->all(),[
- 'send_time_start' => 'nullable|date_format:Y-m-d',
- 'send_time_end' => 'nullable|date_format:Y-m-d',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $sendTimeStart = $request->input('send_time_start');
- $sendTimeEnd = $request->input('send_time_end');
- $page = $request->input('page', 1);
- $pageSize = $request->input('page_size', 20);
- $keyword = $request->input('keyword');
- $platType = $request->input('plat_type');
- $groupAdminId = $request->input("group_admin_id",0);
- $isSystemAdmin = $request->input("is_system_admin",0);
- $sysGroupId = $request->input('sys_group_id');
- # 获取群发规则列表
- list($result, $count, $totalStat) = PopularizService::promotionData($platType, $sendTimeStart, $sendTimeEnd, $keyword, $page, $pageSize);
- return self::returnPageValue($result, $count, $pageSize, $page, $totalStat);
- }
- }
|