all(),[ 'corpid' => 'required', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $res = StatisticsService::custTotal($corpid); return self::returnValue($res); } public function custTrends(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'start' => 'required', 'end' => 'required', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $start = $request->input('start'); $end = $request->input('end'); $user_id = $request->input('user_id'); $res = StatisticsService::custTrends($corpid, $start, $end, $user_id); return self::returnValue($res); } public function playletPopulariz(Request $request) { $validator = \Validator::make($request->all(),[ 'principalName' => 'nullable', 'start' => 'nullable', 'end' => 'nullable', 'page' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $principalName = $request->input('principalName'); $mpAppId = $request->input('mpAppId'); $start = $request->input('start'); $end = $request->input('end'); $playletId = $request->input('playletId'); $operators = $request->input('operators'); $page = (int)$request->input('page', 1); $pagesize = (int)$request->input('pagesize', 20); list($data, $total) = StatisticsService::playletPopulariz($principalName, $mpAppId, $start, $end, $playletId, $operators, $page, $pagesize); return self::returnPageValue($data, $total, $pagesize, $page); } public function momentsPopulariz(Request $request) { $validator = \Validator::make($request->all(),[ 'principalName' => 'nullable', 'start' => 'nullable', 'end' => 'nullable', 'page' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $principalName = $request->input('principalName'); $mpAppId = $request->input('mpAppId'); $start = $request->input('start'); $end = $request->input('end'); $playletId = $request->input('playletId'); $operators = $request->input('operators'); $page = (int)$request->input('page', 1); $pagesize = (int)$request->input('pagesize', 20); list($data, $total) = StatisticsService::momentsPopulariz($principalName, $mpAppId, $start, $end, $playletId, $operators, $page, $pagesize); return self::returnPageValue($data, $total, $pagesize, $page); } public function popularizAccounts(Request $request) { $validator = \Validator::make($request->all(),[ 'type' => 'nullable|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $type = $request->input('type'); $res = StatisticsService::popularizAccounts($type); return self::returnValue($res); } public function popularizPlaylets(Request $request) { $validator = \Validator::make($request->all(),[ 'mpAppId' => 'required', 'type' => 'nullable|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $mpAppId = $request->input('mpAppId'); $type = $request->input('type'); $res = StatisticsService::popularizPlaylets($mpAppId, $type); return self::returnValue($res); } public function popularizCompanys(Request $request) { $validator = \Validator::make($request->all(),[ 'type' => 'nullable|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $type = $request->input('type'); $res = StatisticsService::popularizCompanys($type); return self::returnValue($res); } public function operateDayRetrieve(Request $request) { $validator = \Validator::make($request->all(),[ 'start' => 'nullable', 'end' => 'nullable', 'app_id' => 'nullable', 'page' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $app_id = $request->input('app_id'); $start = $request->input('start'); $end = $request->input('end'); $drama_id = (int)$request->input('drama_id'); $page = (int)$request->input('page', 1); $pagesize = (int)$request->input('pagesize', 20); $sysGroupId = $request->input('sys_group_id'); $orderType = $request->input('order_type', 1); if(1 == $orderType) { $res = StatisticsService::operateDayRetrieve($app_id, $start, $end, $page, $pagesize, $drama_id, $sysGroupId); } else { $res = StatisticsService::operateDayRetrieveAdq($start, $end, $page, $pagesize, $sysGroupId); } return self::returnPageValue($res['list'], $res['total'], $pagesize, $page, $res['retrieveColumns']); } public function throwPersonData(Request $request) { $validator = \Validator::make($request->all(),[ 'start' => 'required', 'end' => 'required', 'user_id' => 'nullable|int', 'drama_id' => 'nullable|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $user_id = $request->input('user_id'); $drama_id = $request->input('drama_id'); $start = $request->input('start'); $end = $request->input('end'); $sysGroupId = $request->input('sys_group_id'); $adminId = $request->input('admin_id'); $isSystemAdmin = $request->input('is_system_admin'); $appId = $request->input('app_id'); // 公众号 $launchAccountId = $request->input('launch_account_id'); $closingDate = $request->input('closing_date'); $res = StatisticsService::throwPersonData($start, $end, $user_id, $drama_id, $sysGroupId, $adminId , $isSystemAdmin, $appId, $launchAccountId, $closingDate); return self::returnValue($res); } public function throwPersonList(Request $request) { $validator = \Validator::make($request->all(),[ 'start' => 'required|date', 'end' => 'required|date', 'user_id' => 'nullable|int', 'drama_id' => 'nullable|int', 'page' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $user_id = $request->input('user_id'); $drama_id = $request->input('drama_id'); $start = $request->input('start'); $end = $request->input('end'); $page = $request->input('page'); $pageSize = (int)$request->input('pagesize', 10); $sysGroupId = $request->input('sys_group_id'); $sortField = $request->input('sort_field', 'date'); $adminId = $request->input('admin_id'); $isSystemAdmin = $request->input('is_system_admin'); $appId = $request->input('app_id'); // 公众号 $launchAccountId = $request->input('launch_account_id'); $closingDate = $request->input('closing_date'); list($data, $total) = StatisticsService::throwPersonList($start, $end, $user_id, $drama_id, $page, $pageSize , $sysGroupId, $sortField, $adminId, $isSystemAdmin, $appId, $launchAccountId, $closingDate); return self::returnPageValue($data, $total, $pageSize, $page); } public function officialTrendTotal(Request $request) { $validator = \Validator::make($request->all(),[ 'start' => 'required|date', 'end' => 'required|date', 'app_id' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $appId = $request->input('app_id'); $start = $request->input('start'); $end = $request->input('end'); $sysGroupId = $request->input('sys_group_id'); $data = StatisticsService::officialTrendTotal($start, $end, $appId, $sysGroupId); return self::returnValue($data); } public function officialTrendList(Request $request) { $validator = \Validator::make($request->all(),[ 'start' => 'required|date', 'end' => 'required|date', 'app_id' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $appId = $request->input('app_id'); $start = $request->input('start'); $end = $request->input('end'); $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pagesize = (int)$request->input('pagesize', 10); list($data, $total, $day_columns) = StatisticsService::officialTrendList($start, $end, $appId, $page, $pagesize, $sysGroupId); return self::returnPageValue($data, $total, $pagesize, $page, ['day_columns' => $day_columns]); } /** * 投手数据 * @param Request $request * @return array */ public function pitcherData (Request $request) { $validator = \Validator::make($request->all(),[ 'st_date' => 'required|date', 'en_date' => 'required|date', 'user_id' => 'nullable|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $stDate = $request->input('st_date'); $enDate = $request->input('en_date'); $userId = $request->input('user_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); $sortField = $request->input('sort_field', 'roi'); $sysGroupId = $request->input('sys_group_id'); $adminId = $request->input('admin_id'); $isSystemAdmin = $request->input('is_system_admin'); list($data, $total) = StatisticsService::pitcherData($stDate, $enDate, $userId, $page, $pageSize, $sortField , $sysGroupId, $adminId, $isSystemAdmin); return self::returnPageValue($data, $total, $pageSize, $page); } public function custTotalNew (Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'nullable', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $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'); $corpid = $request->input('corpid'); $res = StatisticsService::custTotalNew($corpid, $group_admin_id, $is_system_admin, $sys_group_id); return self::returnValue($res); } public function custTrendsNew(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'nullable', 'start' => 'required|date', 'end' => 'required|date' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $start = $request->input('start'); $end = $request->input('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'); $res = StatisticsService::custTrendsNew($corpid, $start, $end, $group_admin_id, $is_system_admin, $sys_group_id); return self::returnValue($res); } public function custDataList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'nullable' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $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'); $res = StatisticsService::custDataList($corpid, $group_admin_id, $is_system_admin, $sys_group_id); return self::returnValue($res); } /** * 获取累计充值用户【去重】 * */ public function chargeUserUnique(Request $request) { $validator = \Validator::make($request->all(),[ 'start_date' => 'required|date', 'end_date' => 'required|date', 'app_id' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $appId = $request->input('app_id'); $start = $request->input('start_date'); $end = $request->input('end_date'); $sysGroupId = $request->input('sys_group_id'); # 获取累计充值用户 $count = StatisticsService::chargeUserUnique($appId, $start, $end, $sysGroupId); return self::returnValue(['count' => $count]); } /** * 获取首日充值用户【去重】 * */ public function firstDayChargeUserUnique(Request $request) { $validator = \Validator::make($request->all(),[ 'start_date' => 'required|date', 'end_date' => 'required|date', 'app_id' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $appId = $request->input('app_id'); $start = $request->input('start_date'); $end = $request->input('end_date'); $sysGroupId = $request->input('sys_group_id'); # 获取首日充值用户 $count = StatisticsService::firstDayChargeUserUnique($appId, $start, $end, $sysGroupId); return self::returnValue(['count' => $count]); } public function operateDayRetrieveByAccount(Request $request) { $validator = \Validator::make($request->all(),[ 'start' => 'nullable', 'end' => 'nullable', 'app_id' => 'nullable', 'page' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $appId = $request->input('app_id'); $start = $request->input('start'); $end = $request->input('end'); $dramaId = (int)$request->input('drama_id'); $page = (int)$request->input('page', 1); $pageSize = (int)$request->input('pagesize', 20); $sysGroupId = $request->input('sys_group_id'); $orderType = $request->input('order_type', 1); $isSystemAdmin = $request->input('is_system_admin'); $adminId = $request->input('admin_id'); if(1 == $orderType) { $res = NewStatisticsService::operateDayRetrieveByAccount($appId, $start, $end, $page, $pageSize, $dramaId , $sysGroupId, $adminId, $isSystemAdmin); } else { $res = NewStatisticsService::operateDayRetrieveAdqByAccount($start, $end, $page, $pageSize, $sysGroupId , $adminId, $isSystemAdmin); } return self::returnPageValue($res['list'], $res['total'], $pageSize, $page, $res['retrieveColumns']); } public function publicAccountDataList(Request $request) { $validator = \Validator::make($request->all(),[ 'start_date' => 'required|date', 'end_date' => 'required|date', 'app_id' => 'nullable', 'closing_date' => 'nullable|date', 'page' => 'required|numeric', 'page_size' => 'required|numeric', 'operator_id' => 'nullable|integer', 'pitcher_id' => 'nullable|integer', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['start_date'] = $request->input('start_date'); $params['end_date'] = $request->input('end_date'); $params['closing_date'] = $request->input('closing_date'); $params['cost_cover_min'] = $request->input('cost_cover_min'); $params['cost_cover_max'] = $request->input('cost_cover_max'); $params['admin_id'] = $request->input('admin_id'); $params['is_system_admin'] = $request->input('is_system_admin'); $params['sys_group_id'] = $request->input('sys_group_id'); $params['operator_id'] = $request->input('operator_id'); $params['pitcher_id'] = $request->input('pitcher_id'); $params['app_id'] = $request->input('app_id'); $page = $request->input('page'); $pageSize = $request->input('page_size'); $sortField = $request->input('sort_field', 'expense_date'); $sortType = $request->input('sort_type', 'desc'); list($count, $list, $retrieveColumns) = PublicAccountDataService::publicAccountDataList($params , $page, $pageSize, $sortField, $sortType); return self::returnPageValue($list, $count, $pageSize, $page, $retrieveColumns); } public function publicAccountDataSummary(Request $request) { $validator = \Validator::make($request->all(),[ 'start_date' => 'required|date', 'end_date' => 'required|date', 'app_id' => 'nullable', 'closing_date' => 'nullable|date', 'operator_id' => 'nullable|integer', 'pitcher_id' => 'nullable|integer', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['start_date'] = $request->input('start_date'); $params['end_date'] = $request->input('end_date'); $params['closing_date'] = $request->input('closing_date'); $params['cost_cover_min'] = $request->input('cost_cover_min'); $params['cost_cover_max'] = $request->input('cost_cover_max'); $params['admin_id'] = $request->input('admin_id'); $params['is_system_admin'] = $request->input('is_system_admin'); $params['sys_group_id'] = $request->input('sys_group_id'); $params['operator_id'] = $request->input('operator_id'); $params['pitcher_id'] = $request->input('pitcher_id'); $params['app_id'] = $request->input('app_id'); list($data, $header) = PublicAccountDataService::publicAccountDataSummary($params); return self::returnValue([ 'data' => $data, 'header' => $header ]); } public function cumulativeRecoveryData(Request $request) { $validator = \Validator::make($request->all(),[ 'start' => 'nullable', 'end' => 'nullable', 'page' => 'required|int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $page = (int)$request->input('page', 1); $pageSize = (int)$request->input('page_size', 20); $isSystemAdmin = $request->input('is_system_admin'); $adminId = $request->input('admin_id'); $sysGroupId = $request->input('sys_group_id'); $res = NewStatisticsService::cumulativeRecoveryData($startDate, $endDate, $page, $pageSize, $isSystemAdmin , $adminId, $sysGroupId); return self::returnPageValue($res['list'], $res['total'], $pageSize, $page, $res['retrieveColumns']); } public function customerServiceData(Request $request) { $validator = \Validator::make($request->all(),[ 'status' => 'nullable|in:1, 2, 3', 'active_status' => 'nullable|in:0, 1' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corp_id'] = $request->input('corp_id'); $params['user_name'] = $request->input('user_name'); $params['status'] = $request->input('status'); $params['active_status'] = $request->input('active_status'); $params['operator_uid'] = $request->input('operator_uid'); $params['sort_field'] = $request->input('sort_field'); $params['sort_type'] = $request->input('sort_type'); $params['sort_field'] = empty($params['sort_field']) ? 'daily_new_contact_cnt' : $params['sort_field']; $params['sort_type'] = empty($params['sort_type']) ? 'desc' : $params['sort_type']; $page = (int)$request->input('page', 1); $pageSize = (int)$request->input('page_size', 20); $isSystemAdmin = $request->input('is_system_admin'); $adminId = $request->input('admin_id'); $sysGroupId = $request->input('sys_group_id'); $res = NewStatisticsService::customerServiceData($params, $page, $pageSize, $isSystemAdmin, $adminId, $sysGroupId); return self::returnPageValue($res['list'], $res['total'], $pageSize, $page, $res['columns']); } public function customerServiceDataTotal(Request $request) { $validator = \Validator::make($request->all(),[ 'status' => 'nullable|in:1, 2, 3', 'active_status' => 'nullable|in:0, 1' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corp_id'] = $request->input('corp_id'); $params['user_name'] = $request->input('user_name'); $params['status'] = $request->input('status'); $params['active_status'] = $request->input('active_status'); $params['operator_uid'] = $request->input('operator_uid'); $isSystemAdmin = $request->input('is_system_admin'); $adminId = $request->input('admin_id'); $sysGroupId = $request->input('sys_group_id'); $res = NewStatisticsService::customerServiceDataTotal($params, $isSystemAdmin, $adminId, $sysGroupId); return self::returnValue($res['data'], 0, $res['columns']); } }