post(); $pageSize = request()->post('pageSize', 0); $params['is_recommend'] = 1; $datas = VideoService::make()->getIndexList($params, $pageSize,'', $this->userId); return message(1010, true, $datas); } catch (\Exception $exception){ RedisService::set("caches:request:error_video_index", ['error'=>$exception->getMessage(),'trace'=>$exception->getTrace()], 7200); return message(1018, false, ['error'=>env('APP_DEBUG')? $exception->getMessage() : '']); } } /** * 配置信息 * @return array */ public function config() { try { $params = request()->all(); $system = isset($params['system'])? json_decode($params['system'], true) : []; $appSources = isset($system['app_sources']) && $system['app_sources']? $system['app_sources'] : 'android'; $cacheKey = "caches:config:app_{$appSources}"; $config = RedisService::get($cacheKey); if (empty($config)) { $mealList = ConfigService::make()->getConfigByCode('recharge_xd_meals',''); $mealList = $mealList? explode('|', $mealList) : []; $mealList = $mealList? $mealList : [10,20,50,100,200,500,1000]; $meals = []; $xdPrice = (float)ConfigService::make()->getConfigByCode('xd_price',100); foreach($mealList as $item){ $meals[] = [ 'money'=> $item, 'usdt'=> moneyFormat($item/$xdPrice,2), ]; } # 用户充值协议 $rechargeAgree = ArticleService::make()->getInfo(1); $rechargeAgree = isset($rechargeAgree['content'])? htmlspecialchars_decode($rechargeAgree['content']) : ''; $config = [ 'app_name' => ConfigService::make()->getConfigByCode('app_name'), 'app_logo' => ConfigService::make()->getConfigByCode('app_logo'), 'app_version' => ConfigService::make()->getConfigByCode('app_version'), 'h5_url' => ConfigService::make()->getConfigByCode("h5_url"), 'chat_url' => ConfigService::make()->getConfigByCode("chat_url"), 'custom_phone' => ConfigService::make()->getConfigByCode('custom_phone'), 'custom_telegram' => ConfigService::make()->getConfigByCode('custom_telegram'), 'custom_email' => ConfigService::make()->getConfigByCode('custom_email'), 'open_h5' => (int)ConfigService::make()->getConfigByCode('open_h5',0), 'min_recharge' => (float)ConfigService::make()->getConfigByCode('min_recharge',0.1), 'recharge_agree' => $rechargeAgree, 'xd_price' => $xdPrice, 'rechargeMeals'=> $meals, ]; RedisService::set($cacheKey, $config, 7200); } $config['app_sources'] = $appSources; $config['app_url'] = ConfigService::make()->getConfigByCode("app_{$appSources}_url"); return showJson(1010, true, $config); } catch (\Exception $exception) { RedisService::set("caches:request:error_config", ['trace' => $exception->getTrace()], 7200); return showJson(1018, false, ['error' => env('APP_DEBUG') ? $exception->getMessage() : '']); } } /** * 物流公司 * @return array */ public function express() { return showJson(1010, true, config('express')); } /** * 验证APP更新 * @return array */ public function versionCheck() { $system = request()->post('system',[]); $version = isset($system['version'])? $system['version'] : '1.3.20'; $appSources = isset($system['app_sources'])? $system['app_sources'] : 'ios'; $currentVersion = ConfigService::make()->getConfigByCode('app_version'); if (getVersion($version) < getVersion($currentVersion)) { $data = [ 'has_update' => true, 'app_version' => $currentVersion, 'app_name' => ConfigService::make()->getConfigByCode('app_name'), 'update_notice' => ConfigService::make()->getConfigByCode('app_update_notice'), 'app_url' => ConfigService::make()->getConfigByCode("app_{$appSources}_url"), ]; return showJson(1010, true, $data); } else { $appUrl = ConfigService::make()->getConfigByCode("app_{$appSources}_url"); return showJson(1010, false, ['has_update' => false,'app_url'=>$appUrl, 'version' => $version]); } } /** * 直播参数 * @return array */ public function liveConfig() { $userId = request()->post('user_id', 0); $roomId = request()->post('room_id', 0); $refresh = request()->post('refresh', 0); return showJson(1010, true); } public function noticeCount() { $noticeUid = request()->post('id',0); $userId = request()->post('uid',0); $userType = request()->post('type',0); return message(1010, true, []); } /** * 验证视频通话剩余时长 * @return array */ public function checkChat() { $toUserId = request()->post('to_user_id', 0); $fromUserId = request()->post('from_user_id', 0); $type = request()->post('type', 2); $data = ImChatService::make()->checkChat($fromUserId, $toUserId, $type); $config = ConfigService::make()->getConfigByCode('chat_buy_time_money'); $config = $config ? explode('/', $config) : []; $money = isset($config[0]) && $config[0] > 0 ? $config[0] : 10; $num = isset($config[1]) && $config[1] > 0 ? $config[1] : 5; $tips = "抱歉您的免费时长已经用完,请先余额支付【{$money}元】购买【{$num}分钟】聊天时长再使用视频聊天服务。"; return message(1010, true, ['time' => $data, 'tips' => $tips]); } }