getChannelId(); $from = $request->has('from') ? $request->input('from') : ''; if(empty($from)) { return response()->error("PARAM_EMPTY"); } \Log::info('日推送智能分析 渠道ID:'.$distribution_channel_id); \Log::info('日推送智能分析 类型:'.$from); $customMsgService = CustomSendStatsService::customSendDayStatsByChannelAndFrom($distribution_channel_id,$from); if (!empty($customMsgService)) { return response()->pagination(new CustomSendStatsTransformers(), $customMsgService); }else{ $customMsgService['distribution_channel_id'] = $distribution_channel_id; $customMsgService['date'] = date("Y-m-d"); $customMsgService['push_user_num'] = 0; $customMsgService['click_num'] = 0; $customMsgService['amount'] = 0; $customMsgService['success_pay_num'] = 0; $customMsgService['success_pay_rate'] = 0; $customMsgService['click_rate'] = 0; $customMsgService['from'] = $from; return response()->item(new CustomSendStatsTransformers(), $customMsgService); } } /** * @apiVersion 1.0.0 * @api {GET} OfficialAccount/customSendStatsByChannelAndFrom 获取智能推送分析总数据 * @apiGroup OfficialAccount * @apiName customSendStatsByChannelAndFrom * @apiParam {String} from 智能分析类型 not_pay未支付提醒 recovery_push三天回本 hot_push热门推送 point_push书籍推荐. * @apiSuccess {String} distribution_channel_id 渠道号. * @apiSuccess {String} date 日期. * @apiSuccess {String} push_user_num 推送次数. * @apiSuccess {String} click_num 点击次数. * @apiSuccess {String} amount 充值金额. * @apiSuccess {String} success_pay_num 充值笔数. * @apiSuccess {String} success_pay_rate 充值率. * @apiSuccess {String} click_rate 点击率. * @apiSuccess {String} from 智能分析类型 not_pay未支付提醒 recovery_push三天回本 hot_push热门推送 point_push书籍推荐.. * @apiSuccessExample {json} Success-Response: * * { * "code": 0, * "msg": "", * "data": { * "id": 1, * "distribution_channel_id": 2, * "date": "2018-01-18", * "push_user_num": 4123, * "click_num": 543, * "amount": "123141.00", * "success_pay_num": 2132, * "success_pay_rate": "0.3100", * "click_rate": "0.0000", * "from": "not_pay" * } * } */ function customSendStatsByChannelAndFrom(Request $request) { $distribution_channel_id = $this->getChannelId(); $from = $request->has('from') ? $request->input('from') : ''; if(empty($from)) { return response()->error("PARAM_EMPTY"); } \Log::info('日推送智能分析 渠道ID:'.$distribution_channel_id); \Log::info('日推送智能分析 类型:'.$from); $customMsgService = CustomSendStatsService::customSendStatsByChannelAndFrom($distribution_channel_id,$from); if (!empty($customMsgService)) { return response()->item(new CustomSendStatsTransformers(), $customMsgService); }else{ $customMsgService['distribution_channel_id'] = $distribution_channel_id; $customMsgService['date'] = date("Y-m-d"); $customMsgService['push_user_num'] = 0; $customMsgService['click_num'] = 0; $customMsgService['amount'] = 0; $customMsgService['success_pay_num'] = 0; $customMsgService['success_pay_rate'] = 0; $customMsgService['click_rate'] = 0; $customMsgService['from'] = $from; return response()->item(new CustomSendStatsTransformers(), $customMsgService); } } /** * 获取智能推送列表 * @param Request $request */ function customSendStatsFromTypes(Request $request) { $customMsgSwitchs = CustomMsgSwitchs::getCustomMsgSwitchs(); return response()->success($customMsgSwitchs); } }