input('platform_id'); $keyword = $request->input('keyword'); $accountId = $request->input('account_id'); $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); # 获取群列表 list($list, $count) = PlatformService::playletList($platformId, $sysGroupId, $keyword, $accountId, $page, $pageSize); return self::returnPageValue($list, $count, $pageSize, $page); } /** * 创建推广链接 * */ public function createLink(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'mini_app_id' => 'nullable|string', 'platform_id' => 'required|int', 'account_id' => 'required|int', 'app_id' => 'required|string', 'name' => 'required|string', 'playlet_id' => 'required|string', 'episode_num' => 'required|int', 'link_type' => 'required|in:0,1' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $platformId = $request->input('platform_id'); $accountId = $request->input('account_id'); $sysGroupId = $request->input('sys_group_id'); $adminId = $request->input('admin_id'); $params['corpid'] = $request->input('corpid'); // 企微Id $params['app_id'] = $request->input('app_id'); // 公众号appId $params['mini_app_id'] = $request->input('mini_app_id'); // 小程序appId $params['name'] = $request->input('name'); // 推广链接名称 $params['playlet_id'] = $request->input('playlet_id'); // 短剧id $params['episode_num'] = $request->input('episode_num'); // 剧集集数 $params['force_subscribe'] = $request->input('episode_num', 0); // 是否强关: 0不强关,1强关 $params['force_subscribe_sectionId'] = $request->input('force_subscribe_sectionId', 0); // 强关集数 $params['type'] = $request->input('type', 0); // 剧集集数 $params['link_type'] = $request->input('link_type'); // 链接类型 $errno = 0; $data = PlatformService::createLink($params, $platformId, $accountId, $sysGroupId, $adminId, $errno); if($errno) return self::returnValue($data, $errno); return self::returnValue($data); } public function setPlayletGroup(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'required', 'name' => 'required|string', 'playlet_list' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $sysGroupId = $request->input('sys_group_id');// 系统权限组ID $name = $request->input('name'); // 短剧组名称 $playletList = $request->input('playlet_list');// 短剧信息 $adminId = $request->input('admin_id'); // 操作人ID $corpid = $request->input('corpid'); // 企微ID $groupId = $request->input('group_id'); // 短剧组ID $errno = 0; PlatformService::setPlayletGroup($sysGroupId, $corpid, $adminId, $groupId, $name, $playletList, $errno); return self::returnValue([], $errno); } public function playletGroupList(Request $request) { $sysGroupId = $request->input('sys_group_id'); $page = $request->input('page', 1); $pageSize = $request->input('page_size', 20); list($data, $total) = PlatformService::playletGroupList($sysGroupId, $page, $pageSize); return self::returnPageValue($data, $total, $pageSize, $page); } public function addPlayletToGroup(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'mini_app_id' => 'nullable|string', 'platform_id' => 'required|int', 'account_id' => 'required|int', 'app_id' => 'required|string', 'playlet_id' => 'required|string', 'episode_num' => 'required|int', 'link_type' => 'required|in:0,1' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $params['platform_id'] = $request->input('platform_id'); $params['account_id'] = $request->input('account_id'); $params['group_id'] = $request->input('group_id'); $params['corpid'] = $request->input('corpid'); // 企微Id $params['app_id'] = $request->input('app_id'); // 公众号appId $params['mini_app_id'] = $request->input('mini_app_id'); // 小程序appId $params['name'] = $request->input('name'); // 推广链接名称 $params['playlet_id'] = $request->input('playlet_id'); // 短剧id $params['episode_num'] = $request->input('episode_num'); // 剧集集数 $params['force_subscribe'] = $request->input('episode_num', 0); // 是否强关: 0不强关,1强关 $params['force_subscribe_sectionId'] = $request->input('force_subscribe_sectionId', 0); // 强关集数 $params['type'] = $request->input('type', 0); // 剧集集数 $params['link_type'] = $request->input('link_type'); // 链接类型 $errno = 0; PlatformService::addPlayletToGroup($params, $errno); return self::returnValue([], $errno); } public function playletGroupDetail(Request $request) { $validator = \Validator::make($request->all(),[ 'group_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $groupId = $request->input('group_id'); list($data, $errno) = PlatformService::playletGroupDetail($groupId); return self::returnValue($data, $errno); } public function createPlayletGroupLink(Request $request) { $validator = \Validator::make($request->all(),[ 'group_id' => 'required|integer' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $groupId = $request->input('group_id'); $corpid = $request->input('corpid'); if('test' == env('ENVIRONMENT')){ $url = 'http://duanju.wenxingshuju.com'; } else { $url = 'http://dj.wenxingshuju.com'; } $url .= '/playlet/qwh5/dist/index.html#/playletGroupH5?corpid='.$corpid.'&group_id='.$groupId.'&send_type=6'; return self::returnValue($url); } public function playletGroupH5Detail(Request $request) { $validator = \Validator::make($request->all(),[ 'group_id' => 'required|integer', 'sender' => 'required|string', 'rule_id' => 'required|integer', 'msg_type' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $groupId = $request->input('group_id'); $sender = $request->input('sender'); $ruleId = $request->input('rule_id'); $msgType = $request->input('msg_type'); $data = PlatformService::playletGroupH5Detail($groupId, $sender, $ruleId, $msgType); return self::returnValue($data); } public function paramsValidate(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required|string', 'mini_app_id' => 'nullable|string', 'platform_id' => 'required|int', 'account_id' => 'required|int', 'app_id' => 'required|string', 'name' => 'required|string', 'playlet_id' => 'required|string', 'episode_num' => 'required|int', 'link_type' => 'required|in:0,1' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $platformId = $request->input('platform_id'); $accountId = $request->input('account_id'); $sysGroupId = $request->input('sys_group_id'); $adminId = $request->input('admin_id'); $params['corpid'] = $request->input('corpid'); // 企微Id $params['app_id'] = $request->input('app_id'); // 公众号appId $params['mini_app_id'] = $request->input('mini_app_id'); // 小程序appId $params['name'] = $request->input('name'); // 推广链接名称 $params['playlet_id'] = $request->input('playlet_id'); // 短剧id $params['episode_num'] = $request->input('episode_num'); // 剧集集数 $params['force_subscribe'] = $request->input('episode_num', 0); // 是否强关: 0不强关,1强关 $params['force_subscribe_sectionId'] = $request->input('force_subscribe_sectionId', 0); // 强关集数 $params['type'] = $request->input('type', 0); // 剧集集数 $params['link_type'] = $request->input('link_type'); // 链接类型 $errno = 0; $data = PlatformService::paramsValidate($params, $platformId, $accountId, $sysGroupId, $adminId, $errno); if($errno) return self::returnValue($data, $errno); return self::returnValue($data); } public function batchCreateLink(Request $request) { $validator = \Validator::make($request->all(),[ 'sys_group_id' => 'required', 'playlet_list' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $sysGroupId = $request->input('sys_group_id');// 系统权限组ID $playletList = $request->input('playlet_list');// 短剧信息 $adminId = $request->input('admin_id'); // 操作人ID $corpid = $request->input('corpid'); // 企微ID list($errMsg, $errNo) = PlatformService::batchCreateLink($sysGroupId, $corpid, $adminId, $playletList); return self::returnValue($errMsg, $errNo); } }