all(),[ // 'start_date' => 'nullable|date', // 'end_date' => 'nullable|date' // ]); // // if ($validator->fails()) { // return self::returnValue($validator->getMessageBag(), 1102); // } // // $startDate = $request->input('start_date'); // $endDate = $request->input('end_date'); // $accountId = $request->input('account_id'); // $corpid = $request->input('corpid'); // $sortField = $request->input('sort_field', 'charge_total'); // $sysGroupId = $request->input('sys_group_id'); // // $page = $request->input('page', 1); // $pageSize = $request->input('page_size', 10); // // list($data, $count) = DataStatisticsService::wechatAccountData($startDate, $endDate, $accountId, $corpid, // $sortField, $page, $pageSize, $sysGroupId); // // return self::returnPageValue($data, $count, $pageSize, $page); // } // 短剧投放趋势数据 public function playletTrendData(Request $request) { $validator = Validator::make($request->all(),[ 'start_date' => 'nullable|date', 'end_date' => 'nullable|date' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $accountId = $request->input('account_id'); $corpid = $request->input('corpid'); $playletId = $request->input('playlet_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 10); list($data, $count) = DataStatisticsService::playletTrendData($startDate, $endDate, $accountId, $corpid, $playletId, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } // 短剧数据(老) public function playletData(Request $request) { $validator = Validator::make($request->all(),[ 'start_date' => 'nullable|date', 'end_date' => 'nullable|date' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $accountId = $request->input('account_id'); $corpid = $request->input('corpid'); $playletId = $request->input('playlet_id'); $sortField = $request->input('sort_field', 'charge_total'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 10); list($data, $count) = DataStatisticsService::playletData($startDate, $endDate, $accountId, $corpid, $playletId, $sortField, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } # 短剧数据(新) public function playletDataTrend(Request $request) { $validator = Validator::make($request->all(),[ 'start_date' => 'nullable|date', 'end_date' => 'nullable|date' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $playletId = $request->input('playlet_id'); $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 10); list($data, $count) = DataStatisticsService::playletDataTrend($startDate, $endDate, $playletId, $page, $pageSize, $sysGroupId); return self::returnPageValue($data, $count, $pageSize, $page); } /** * 短剧粉丝激活趋势 * */ public function activeFansData(Request $request) { $validator = Validator::make($request->all(),[ 'start_date' => 'nullable|date', 'end_date' => 'nullable|date' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $closingDate = $request->input('closing_date'); $accountId = $request->input('app_id'); $minPaid = $request->input('min_paid'); $maxPaid = $request->input('max_paid'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 10); $sysGroupId = $request->input('sys_group_id'); list($data, $count) = DataStatisticsService::activeFansData( $startDate, $endDate, $closingDate, $accountId, $minPaid, $maxPaid, $page, $pageSize, $sysGroupId ); return self::returnPageValue($data, $count, $pageSize, $page); } // 公众号数据(2022-07-21改版) public function OfficialAccountData(Request $request) { $validator = Validator::make($request->all(),[ 'start_date' => 'nullable|date', 'end_date' => 'nullable|date' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $accountId = $request->input('account_id'); $sortField = $request->input('sort_field', 'charge_total'); $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 10); list($data, $count) = DataStatisticsService::OfficialAccountData($startDate, $endDate, $accountId, $sortField, $page, $pageSize, $sysGroupId); return self::returnPageValue($data, $count, $pageSize, $page); } public function playletDataUniqueUser (Request $request) { $validator = Validator::make($request->all(),[ 'start_date' => 'required|date', 'end_date' => 'required|date' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $playletId = $request->input('playlet_id'); $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'); $data = DataStatisticsService::statisticsDataUniqueUser($startDate, $endDate, $playletId, null, $sysGroupId , 3, $adminId, $isSystemAdmin, $appId, $launchAccountId); return self::returnValue($data); } public function pitcherDataUniqueUser (Request $request) { $validator = Validator::make($request->all(),[ 'start_date' => 'required|date', 'end_date' => 'required|date' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $startDate = $request->input('start_date'); $endDate = $request->input('end_date'); $pitcherId = $request->input('pitcher_id'); $sysGroupId = $request->input('sys_group_id'); $playletId = $request->input('playlet_id', null); $adminId = $request->input('admin_id'); $isSystemAdmin = $request->input('is_system_admin'); $appId = $request->input('app_id'); // 公众号 $launchAccountId = $request->input('launch_account_id'); $data = DataStatisticsService::statisticsDataUniqueUser($startDate, $endDate, $playletId, $pitcherId, $sysGroupId , 1, $adminId, $isSystemAdmin, $appId, $launchAccountId); return self::returnValue($data); } /* * 数据循环统计 * */ public function dataCycleList(Request $request) { $validator = \Validator::make($request->all(),[ 'begin_date' => 'required', 'end_date' => 'required', 'first_order_cost_min' => 'nullable|numeric', 'first_order_cost_max' => 'nullable|numeric', 'first_order_cost_unique_min' => 'nullable|numeric', 'first_order_cost_unique_max' => 'nullable|numeric', 'per_follow_cost_min' => 'nullable|numeric', 'per_follow_cost_max' => 'nullable|numeric', 'total_roi_min' => 'nullable|numeric', 'total_roi_max' => 'nullable|numeric', 'first_day_roi_min' => 'nullable|numeric', 'first_day_roi_max' => 'nullable|numeric', 'order_type' => 'required|in:1,2',// 1Mp 2Adq 'plat_order_type' => 'nullable|numeric', 'paid_min' => 'nullable|numeric', 'paid_max' => 'nullable|numeric', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $page = $request->input("page",1); $pageSize = $request->input("page_size",20); $beginDate = $request->input("begin_date", null); $endDate = $request->input("end_date", null); $sysGroupId = $request->input('sys_group_id'); $firstOrderCostMin = $request->input('first_order_cost_min', null); $firstOrderCostMax = $request->input('first_order_cost_max', null); $firstOrderCostUniqueMin= $request->input('first_order_cost_unique_min', null); $firstOrderCostUniqueMax= $request->input('first_order_cost_unique_max', null); $perFollowCostMin = $request->input('per_follow_cost_min', null); $perFollowCostMax = $request->input('per_follow_cost_max', null); $totalRoiMin = $request->input('total_roi_min', null); $totalRoiMax = $request->input('total_roi_max', null); $firstDayRoiMin = $request->input('first_day_roi_min', null); $firstDayRoiMax = $request->input('first_day_roi_max', null); $orderType = $request->input('order_type', 1); $platOrderType = $request->input('plat_order_type', null); $closingDate = $request->input('closing_date', null); $paidMin = $request->input('paid_min', null); $paidMax = $request->input('paid_max', null); $sortField = $request->input('sort_field', 'date'); $sortType = $request->input('sort_type', 'desc'); list($total, $list, $overview) = DataStatisticsService::dataCycleList( $beginDate,$endDate,$page,$pageSize, $sysGroupId, $firstOrderCostMin, $firstOrderCostMax, $firstOrderCostUniqueMin, $firstOrderCostUniqueMax, $perFollowCostMin, $perFollowCostMax, $totalRoiMin, $totalRoiMax, $firstDayRoiMin, $firstDayRoiMax, $orderType, $platOrderType, $closingDate, $paidMin, $paidMax, $sortField, $sortType); return self::returnPageValue(['list'=>$list, 'overview' => $overview],$total,$pageSize,$page); } /** * 获取数据看板数据更新时间 * */ public function uptime(Request $request) { $validator = \Validator::make($request->all(),[ 'type' => ['required', Rule::in([ 'account_data_trend_mp', 'account_data_trend_adq', 'playlet_data_trend_adq', 'data_cycle_nur', 'playlet_data_trend_mp', 'data_cycle_adq', 'data_cycle_mp', 'account_data_trend', 'playlet_data_trend', 'operate_data_trend', 'cumulative_recovery_data', 'account_funds' ])], ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $type = $request->input('type'); # 获取数据更新时间 $dateTime = DataStatisticsService::getDataUptime($type); return self::returnValue(['uptime' => $dateTime]); } public function HuaShengDataCycleList(Request $request) { $validator = \Validator::make($request->all(),[ 'begin_date' => 'required', 'end_date' => 'required', 'first_order_cost_min' => 'nullable|numeric', 'first_order_cost_max' => 'nullable|numeric', 'per_follow_cost_min' => 'nullable|numeric', 'per_follow_cost_max' => 'nullable|numeric', 'total_roi_min' => 'nullable|numeric', 'total_roi_max' => 'nullable|numeric', 'first_day_roi_min' => 'nullable|numeric', 'first_day_roi_max' => 'nullable|numeric', 'paid_min' => 'nullable|numeric', 'paid_max' => 'nullable|numeric', 'plat_order_type' => 'nullable|numeric', 'order_source' => 'nullable|numeric', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $page = $request->input("page",1); $pageSize = $request->input("page_size",20); $beginDate = $request->input("begin_date", null); $endDate = $request->input("end_date", null); $sysGroupId = $request->input('sys_group_id'); $firstOrderCostMin = $request->input('first_order_cost_min', null); $firstOrderCostMax = $request->input('first_order_cost_max', null); $perFollowCostMin = $request->input('per_follow_cost_min', null); $perFollowCostMax = $request->input('per_follow_cost_max', null); $totalRoiMin = $request->input('total_roi_min', null); $totalRoiMax = $request->input('total_roi_max', null); $firstDayRoiMin = $request->input('first_day_roi_min', null); $firstDayRoiMax = $request->input('first_day_roi_max', null); $closingDate = $request->input('closing_date', null); $paidMin = $request->input('paid_min', null); $paidMax = $request->input('paid_max', null); $sortField = $request->input('sort_field', 'date'); $sortType = $request->input('sort_type', 'desc'); $appId = $request->input('app_id'); $platOrderType = $request->input('plat_order_type', null); $adminId = $request->input('admin_id'); $isSystemAdmin = $request->input('is_system_admin'); $orderSource = $request->input('order_source', 5); list($total, $list, $overview) = DataStatisticsService::huaShengDataCycleList($adminId, $isSystemAdmin, $beginDate,$endDate,$page,$pageSize, $sysGroupId, $firstOrderCostMin, $firstOrderCostMax, $perFollowCostMin, $perFollowCostMax, $totalRoiMin, $totalRoiMax, $firstDayRoiMin, $firstDayRoiMax, $closingDate, $paidMin, $paidMax, $sortField, $sortType, $appId, $platOrderType, $orderSource); return self::returnPageValue(['list'=>$list, 'overview' => $overview],$total,$pageSize,$page); } public function dataCycleListByAccount(Request $request) { $validator = \Validator::make($request->all(),[ 'begin_date' => 'required', 'end_date' => 'required', 'first_order_cost_min' => 'nullable|numeric', 'first_order_cost_max' => 'nullable|numeric', 'per_follow_cost_min' => 'nullable|numeric', 'per_follow_cost_max' => 'nullable|numeric', 'total_roi_min' => 'nullable|numeric', 'total_roi_max' => 'nullable|numeric', 'first_day_roi_min' => 'nullable|numeric', 'first_day_roi_max' => 'nullable|numeric', 'order_type' => 'required|in:1,2',// 1Adq 2Mp 'plat_order_type' => 'nullable|numeric', 'paid_min' => 'nullable|numeric', 'paid_max' => 'nullable|numeric', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['begin_date'] = $request->input("begin_date", null); $params['end_date'] = $request->input("end_date", null); $params['sys_group_id'] = $request->input('sys_group_id'); $params['is_system_admin'] = $request->input('is_system_admin'); $params['admin_id'] = $request->input('admin_id'); $params['first_order_cost_min'] = $request->input('first_order_cost_min', null); $params['first_order_cost_max'] = $request->input('first_order_cost_max', null); $params['per_follow_cost_min'] = $request->input('per_follow_cost_min', null); $params['per_follow_cost_max'] = $request->input('per_follow_cost_max', null); $params['total_roi_min'] = $request->input('total_roi_min', null); $params['total_roi_max'] = $request->input('total_roi_max', null); $params['first_day_roi_min'] = $request->input('first_day_roi_min', null); $params['first_day_roi_max'] = $request->input('first_day_roi_max', null); $params['plat_order_type'] = $request->input('plat_order_type', null); $params['closing_date'] = $request->input('closing_date', null); $params['paid_min'] = $request->input('paid_min', null); $params['paid_max'] = $request->input('paid_max', null); $orderType = $request->input('order_type', 1); $sortField = $request->input('sort_field', 'date'); $sortType = $request->input('sort_type', 'desc'); $page = $request->input("page",1); $pageSize = $request->input("page_size",20); list($total, $list, $overview) = NewStatisticsService::dataCycleListByAccount($params, $orderType, $page, $pageSize , $sortField, $sortType); return self::returnPageValue(['list'=>$list, 'overview' => $overview],$total,$pageSize,$page); } public function HuaShengDataPlatformList(Request $request) { $data = [ ['order_source' => 99, 'desc' => '全部'], ['order_source' => 5, 'desc' => '花生'], ['order_source' => 7, 'desc' => '九州'], ]; return self::returnValue($data); } # 投手ADQ数据汇总(账户数以及投放天数只统计有消耗的数据) public function pitcherAdqAccountData(Request $request) { $validator = \Validator::make($request->all(),[ 'start_date' => 'required', 'end_date' => 'required', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['start_date'] = $request->input("start_date", null); $params['end_date'] = $request->input("end_date", null); $params['sys_group_id'] = $request->input('sys_group_id'); $params['is_system_admin'] = $request->input('is_system_admin'); $params['admin_id'] = $request->input('admin_id'); $sortField = $request->input('sort_field', 'total_paid'); $sortType = $request->input('sort_type', 'desc'); $res = DataStatisticsService::pitcherAdqAccountData($params, $sortField, $sortType); return self::returnValue($res); } # 送达数据 - 客户群发消息 public function massMsgServiceData(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'); $keyword = $request->input('keyword'); $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($data, $count) = ServiceDataService::massMsgServiceData($creatorId, $sendTimeStart, $sendTimeEnd, $keyword , $sysGroupId, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } # 送达数据 - 客户群群发消息 public function chatGroupMassMsgServiceData(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'); $keyword = $request->input('keyword'); $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($data, $count) = ServiceDataService::chatGroupMassMsgServiceData($creatorId, $sendTimeStart, $sendTimeEnd , $keyword, $sysGroupId, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } # 送达数据 - 智能群发消息 public function periodMassMsgServiceData(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'); $keyword = $request->input('keyword'); $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($data, $count) = ServiceDataService::periodMassMsgServiceData($creatorId, $sendTimeStart, $sendTimeEnd, $keyword , $sysGroupId, $page, $pageSize); return self::returnPageValue($data, $count, $pageSize, $page); } }