all(),[ 'corpid' => 'required|string', 'group_name' => 'required|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['group_name'] = $request->input('group_name'); $params['sys_group_id'] = $request->input('sys_group_id'); list($res, $code) = RadarService::radarGroupCreate($params); return self::returnValue($res, $code); } // 雷达组列表 public function radarGroupList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'keyword' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['keyword'] = $request->input('keyword'); $params['sys_group_id'] = $request->input('sys_group_id'); $params['page'] = $request->input('page', 1); $params['page_size'] = $request->input('page_size', 20); list($data, $count) = RadarService::radarGroupList($params); return self::returnPageValue($data, $count, $params['page_size'], $params['page']); } // 编辑雷达组 public function radarGroupUpdate(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'group_name' => 'required|string', 'group_id' => 'required|integer', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['group_name'] = $request->input('group_name'); $params['sys_group_id'] = $request->input('sys_group_id'); $params['group_id'] = $request->input('group_id'); list($res, $code) = RadarService::radarGroupUpdate($params); return self::returnValue($res, $code); } // 删除雷达组 public function radarGroupDelete(Request $request) { $validator = \Validator::make($request->all(),[ 'group_id' => 'required|integer', 'type' => 'required|in:1,2' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['group_id'] = $request->input('group_id'); $params['type'] = $request->input('type', 1); list($res, $code) = RadarService::radarGroupDelete($params); return self::returnValue($res, $code); } // 雷达组排序 public function radarGroupSortUpdate(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'operate_group_id' => 'required|integer', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['operate_group_id'] = $request->input('operate_group_id'); $params['front_group_id'] = $request->input('front_group_id'); $params['behind_group_id'] = $request->input('behind_group_id'); $params['sys_group_id'] = $request->input('sys_group_id'); list($res, $code) = RadarService::radarGroupSortUpdate($params); return self::returnValue($res, $code); } // 创建雷达 public function radarCreate(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'group_id' => 'nullable|integer', 'name' => 'required|string', 'type' => 'required|in:1,2,3,4', 'url_list' => 'required|array', 'title' => 'required|string', 'description' => 'required|string', 'cover_id' => 'required|integer', 'behavior_notification' => 'required|in:0,1', 'dynamic_notification' => 'required|in:0,1', 'customer_label' => 'required|in:0,1', 'tag_list' => 'required_if:customer_label,1' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['group_id'] = $request->input('group_id'); $params['name'] = $request->input('name'); $params['sys_group_id'] = $request->input('sys_group_id'); $params['type'] = $request->input('type'); $params['url_list'] = $request->input('url_list'); $params['title'] = $request->input('title'); $params['description'] = $request->input('description'); $params['cover_id'] = $request->input('cover_id'); $params['behavior_notification'] = $request->input('behavior_notification'); $params['dynamic_notification'] = $request->input('dynamic_notification'); $params['customer_label'] = $request->input('customer_label'); $params['tag_list'] = $request->input('tag_list'); list($res, $code) = RadarService::radarCreate($params); return self::returnValue($res, $code); } // 雷达列表 public function radarList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'group_id' => 'nullable|integer', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['sys_group_id'] = $request->input('sys_group_id'); $params['group_id'] = $request->input('group_id'); $params['name'] = $request->input('name'); $params['page'] = $request->input('page', 1); $params['page_size'] = $request->input('page_size', 20); list($data, $count) = RadarService::radarList($params); return self::returnPageValue($data, $count, $params['page_size'], $params['page']); } // 雷达详情 public function radarDetail(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'radar_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['radar_id'] = $request->input('radar_id'); $data = RadarService::radarDetail($params); return self::returnValue($data); } // 编辑雷达 public function radarUpdate(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'group_id' => 'nullable|integer', 'name' => 'required|string', 'type' => 'required|in:1,2,3,4', 'url_list' => 'required|array', 'title' => 'required|string', 'description' => 'required|string', 'cover_id' => 'required|integer', 'behavior_notification' => 'required|in:0,1', 'dynamic_notification' => 'required|in:0,1', 'customer_label' => 'required|in:0,1', 'tag_list' => 'required_if:customer_label,1', 'radar_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['group_id'] = $request->input('group_id'); $params['name'] = $request->input('name'); $params['sys_group_id'] = $request->input('sys_group_id'); $params['type'] = $request->input('type'); $params['url_list'] = $request->input('url_list'); $params['title'] = $request->input('title'); $params['description'] = $request->input('description'); $params['cover_id'] = $request->input('cover_id'); $params['behavior_notification'] = $request->input('behavior_notification'); $params['dynamic_notification'] = $request->input('dynamic_notification'); $params['customer_label'] = $request->input('customer_label'); $params['tag_list'] = $request->input('tag_list'); $params['radar_id'] = $request->input('radar_id'); list($res, $code) = RadarService::radarUpdate($params); return self::returnValue($res, $code); } // 删除雷达 public function radarDelete(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'radar_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['radar_id'] = $request->input('radar_id'); list($res, $code) = RadarService::radarDelete($params); return self::returnValue($res, $code); } // 雷达排序 public function radarSortUpdate(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'operate_radar_id' => 'required|integer', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['operate_radar_id'] = $request->input('operate_radar_id'); $params['front_radar_id'] = $request->input('front_radar_id'); $params['behind_radar_id'] = $request->input('behind_radar_id'); $params['sys_group_id'] = $request->input('sys_group_id'); list($res, $code) = RadarService::radarSortUpdate($params); return self::returnValue($res, $code); } public function dataStatisticsTotal(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'radar_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['radar_id'] = $request->input('radar_id'); $data = RadarService::dataStatisticsTotal($params); return self::returnValue($data); } // 数据分析--列表 public function dataStatisticsList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'radar_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['radar_id'] = $request->input('radar_id'); $params['page'] = $request->input('page', 1); $params['page_size'] = $request->input('page_size', 20); $params['channel'] = $request->input('channel'); $params['customer_name'] = $request->input('customer_name'); $params['start_date'] = $request->input('start_date'); $params['end_date'] = $request->input('end_date'); $params['user_list'] = $request->input('user_list'); list($data, $count) = RadarService::dataStatisticsList($params); return self::returnPageValue($data, $count, $params['page_size'], $params['page']); } /** * H5页面需展示的雷达内容 * */ public function radarDetailForH5(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'radar_id' => 'required|integer', 'user_id' => 'required|string', 'token' => 'required|string', 'timestamp' => 'required', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $radarId = $request->input('radar_id'); $userId = $request->input('user_id'); $token = $request->input('token'); $timestamp = $request->input('timestamp'); # 获取H5页面需要展示的雷达内容 $errno = 0; $radarDetail = RadarService::radarDetailForH5($corpid, $radarId, $userId, $token, $timestamp, $errno); if($errno) return self::returnValue([] , $errno); return self::returnValue($radarDetail); } /** * 雷达获取的用户行为数据上报 * */ public function behaviorReport(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'radar_id' => 'required|integer', 'user_id' => 'required|string', 'token' => 'required|string', 'timestamp' => 'required', 'type' => 'required', 'request_id' => 'required', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } Log::logInfo('behaviorReport', $request->all(), 'interface'); $param['corpid'] = $request->input('corpid'); $param['radar_id'] = $request->input('radar_id'); $param['user_id'] = $request->input('user_id'); $param['external_userid'] = $request->input('external_userid'); $param['openid'] = $request->input('openid'); $param['device_id'] = $request->input('device_id'); $param['channel'] = $request->input('channel'); // 渠道标识 1:朋友圈 2:群发消息 3:欢迎语 4:渠道活码 $param['rule_id'] = $request->input('rule_id'); $param['state'] = $request->input('state'); $type = $request->input('type'); $param['request_id'] = $request->input('request_id'); $token = $request->input('token'); $timestamp = $request->input('timestamp'); # 数据上报 $error = RadarService::behaviorReport($param, $type, $token, $timestamp); return self::returnValue([], $error); } // 渠道列表 public function channelList() { $data = RadarService::channelList(); return self::returnValue($data); } public function radarListForH5(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'group_id' => 'nullable|integer', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['group_id'] = $request->input('group_id'); $params['name'] = $request->input('name'); $params['page'] = $request->input('page', 1); $params['page_size'] = $request->input('page_size', 20); list($data, $count) = RadarService::radarListForH5($params); return self::returnPageValue($data, $count, $params['page_size'], $params['page']); } // 获取h5中雷达组列表 public function radarGroupListForH5(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'keyword' => 'nullable|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['corpid'] = $request->input('corpid'); $params['keyword'] = $request->input('keyword'); $params['page'] = $request->input('page', 1); $params['page_size'] = $request->input('page_size', 20); list($data, $count) = RadarService::radarGroupList($params); return self::returnPageValue($data, $count, $params['page_size'], $params['page']); } public function getLinkMsgOfRadar(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'radar_id' => 'required|string', 'user_id' => 'required|string', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $radarId = $request->input('radar_id'); $corpid = $request->input('corpid'); $userId = $request->input('user_id'); $ruleId = time().rand(10000, 99999); $data = RadarService::getLinkMsgOfRadar($radarId, $corpid, $userId, 5, $ruleId); return self::returnValue($data); } }