post(); $pageSize = request()->post('pageSize', 0); $params['is_recommend'] = 1; $datas = VideoService::make()->getIndexList($params, $pageSize,'', $this->userId); return showJson(1010, true, $datas); } catch (\Exception $exception){ RedisService::set("caches:request:error_video_index", ['error'=>$exception->getMessage(),'trace'=>$exception->getTrace()], 7200); return showJson(1018, false, ['error'=>env('APP_DEBUG')? $exception->getMessage() : '']); } } /** * 视频评论 * @return array */ public function videoComment() { try { $params = request()->post(); $pageSize = request()->post('pageSize', 0); $datas = VideoCommentService::make()->getDataList($params, $pageSize,'', $this->userId); return showJson(1010, true, $datas); } catch (\Exception $exception){ RedisService::set("caches:request:error_video_comment", ['error'=>$exception->getMessage(),'trace'=>$exception->getTrace()], 7200); return showJson(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); $exchangePrice = (float)ConfigService::make()->getConfigByCode('score_exchange_xd_rate',100); foreach($mealList as $item){ $meals[] = [ 'money'=> $item, 'usdt'=> moneyFormat($item/$xdPrice,2), ]; } # 用户充值协议 $locale = RedisService::get("caches:locale:lang_{$this->userId}"); $locale = $locale? $locale : session('locale_lang'); $rechargeAgree = ArticleService::make()->getInfo(3, $this->userId, true); $rechargeAgree = isset($rechargeAgree['content'])? $rechargeAgree['content'] : ''; $withdrawAgree = ArticleService::make()->getInfo(5, $this->userId, true); $withdrawAgree = isset($withdrawAgree['content'])? $withdrawAgree['content'] : ''; $minTransfer = (float)ConfigService::make()->getConfigByCode('min_transfer',0.1); $maxTransfer = (float)ConfigService::make()->getConfigByCode('max_transfer',100000); $transferFee = (float)ConfigService::make()->getConfigByCode('transfer_fee_rate',0); $withdrawFee = (float)ConfigService::make()->getConfigByCode('withdraw_fee_rate',0); $exchangeFee = (float)ConfigService::make()->getConfigByCode('exchange_fee_rate',0); $accounts = []; $wxpayRealname = ConfigService::make()->getConfigByCode('recharge_wxpay_realname',''); $wxpayQrcode = ConfigService::make()->getConfigByCode('recharge_wxpay_qrcode', ''); if($wxpayRealname && $wxpayQrcode){ $accounts['wxpay'] = [ 'realname' => $wxpayRealname, 'qrcode'=> get_image_url($wxpayQrcode), ]; } $alipayRealname = ConfigService::make()->getConfigByCode('recharge_alipay_realname',''); $alipayQrcode = ConfigService::make()->getConfigByCode('recharge_alipay_qrcode', ''); if($alipayRealname && $alipayQrcode){ $accounts['alipay'] = [ 'realname' => $alipayRealname, 'qrcode'=> get_image_url($alipayQrcode), ]; } $bankRealname = ConfigService::make()->getConfigByCode('recharge_bank_realname',''); $bankName = ConfigService::make()->getConfigByCode('recharge_bank_name',''); $bankCard = ConfigService::make()->getConfigByCode('recharge_bank_card', ''); $bankBranch = ConfigService::make()->getConfigByCode('recharge_bank_branch', ''); if($bankRealname && $bankName && $bankCard){ $accounts['bank_account'] = [ 'realname' => $bankRealname, 'bank_name' => $bankName, 'bank_card' => $bankCard, 'bank_branch'=> $bankBranch, ]; } $usdtPrice = RedisService::get("caches:wallets:usdt_rate"); if ($usdtPrice <= 0) { $usdtCnyPrice = ConfigService::make()->getConfigByCode('usdt_cny_price', 7.2); $usdtPrice = $usdtCnyPrice > 0 && $usdtCnyPrice < 100 ? $usdtCnyPrice : 0; } $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"), 'chat_api_url' => ConfigService::make()->getConfigByCode("chat_api_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), 'min_transfer' => $minTransfer>0.1? moneyFormat($minTransfer,2) : 0.1, 'max_transfer' => $maxTransfer>0 && $maxTransfer<=100000? moneyFormat($maxTransfer,2) : 100000, 'transfer_fee_rate' => $transferFee>0 && $transferFee<100? moneyFormat($transferFee/100,2) : 0, 'withdraw_fee_rate' => $withdrawFee>0 && $withdrawFee<100? moneyFormat($withdrawFee/100,2) : 0, 'exchange_fee' => $exchangeFee>0 && $exchangeFee<100? moneyFormat($exchangeFee,3) : 0, 'recharge_agree' => $rechargeAgree, 'withdraw_agree' => $withdrawAgree, 'xd_price' => $xdPrice, 'usdt_price' => $usdtPrice, 'exchange_price' => $exchangePrice, 'rechargeMeals'=> $meals, 'accounts'=> $accounts, 'payments' => [ [ 'icon' => get_image_url('/images/pay/icon_usdt.png'), 'name' => 'USDT', 'status' => ConfigService::make()->getConfigByCode('usdt_open',1), 'code' => 20, "color"=> '#14ECCC', ], [ 'icon' => get_image_url('/images/pay/icon_wxpay.png'), 'name' => '微信', 'status' => ConfigService::make()->getConfigByCode('wechat_open',1), 'code' => 30, "color"=> '#666', ], [ 'icon' => get_image_url('/images/pay/icon_alipay.png'), 'name' => '支付宝', 'status' => ConfigService::make()->getConfigByCode('alipay_open',1), 'code' => 40, "color"=> '#666', ], [ 'icon' => get_image_url('/images/pay/icon_bank.png'), 'name' => '银行卡', 'status' => ConfigService::make()->getConfigByCode('bank_open',1), 'code' => 50, "color"=> '#666', ], ], 'lang'=> $locale, ]; RedisService::set($cacheKey, $config, 7200); } $config['app_sources'] = $appSources; $config['ios_plist'] = get_image_url('/app/'); $config['app_logo'] = get_image_url($config['app_logo']); $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() : '']); } } /** * APP配置信息 * @return array */ public function appData() { 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_data_{$appSources}"; $config = RedisService::get($cacheKey); if (empty($config)) { $locale = RedisService::get("caches:locale:lang_{$this->userId}"); $locale = $locale? $locale : session('locale_lang'); $updateNotice = ConfigService::make()->getConfigByCode('app_update_notice'); $updateNotice = $updateNotice? str_replace("\n","
", $updateNotice):''; $config = [ 'app_name' => ConfigService::make()->getConfigByCode('app_name'), 'app_logo' => ConfigService::make()->getConfigByCode('app_logo'), 'app_version' => ConfigService::make()->getConfigByCode('app_version'), 'app_update_notice' => $updateNotice, 'h5_url' => ConfigService::make()->getConfigByCode("h5_url"), 'custom_phone' => ConfigService::make()->getConfigByCode('custom_phone'), 'custom_telegram' => ConfigService::make()->getConfigByCode('custom_telegram'), 'custom_email' => ConfigService::make()->getConfigByCode('custom_email'), 'lang'=> $locale, ]; RedisService::set($cacheKey, $config, 7200); } $config['app_sources'] = $appSources; $config['app_logo'] = get_image_url($config['app_logo']); $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() : '']); } } /** * 验证APP更新 * @return array */ public function versionCheck() { $system = request()->post('system',[]); $version = request()->post('version', '1.3.20'); $appSources = isset($system['app_sources'])? $system['app_sources'] : 'ios'; $currentVersion = ConfigService::make()->getConfigByCode('app_version'); // var_dump(getVersion($version),getVersion($currentVersion)); 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_url"), 'is_force' => ConfigService::make()->getConfigByCode("is_force",0), 'app_hot_wget_url' => ConfigService::make()->getConfigByCode("app_hot_wget_url"), 'app_download_url' => ConfigService::make()->getConfigByCode("app_{$appSources}_url"), ]; return showJson(1010, true, $data); } else { $wgetUrl = ConfigService::make()->getConfigByCode("app_hot_wget_url"); $appUrl = ConfigService::make()->getConfigByCode("app_url"); $isForce = ConfigService::make()->getConfigByCode("is_force",0); $appDownloadUrl = ConfigService::make()->getConfigByCode("app_{$appSources}_url"); return showJson(1010, false, ['has_update' => false,'is_force'=>$isForce,'app_url'=>$appUrl,'app_hot_wget_url'=>$wgetUrl,'app_download_url'=>$appDownloadUrl, 'version' => $version]); } } /** * 币种 * @return array */ public function country() { $data = [ ['code'=>'CNY','name'=>'人民币','country'=>'中国','locale'=>'zh-cn','mark'=>'¥','status'=>1], ['code'=>'MYR','name'=>'林吉特','country'=>'马来西亚','locale'=>'mal','mark'=>'RM','status'=>1], ['code'=>'VND','name'=>'越南盾','country'=>'越南','locale'=>'vie','mark'=>'₫','status'=>1], ['code'=>'THB','name'=>'泰铢','country'=>'泰国','locale'=>'tha','mark'=>'฿','status'=>1], ['code'=>'IDR','name'=>'卢比','country'=>'印度尼西亚','locale'=>'ind','mark'=>'R','status'=>1], ['code'=>'JAY','name'=>'日元','country'=>'日本','locale'=>'jap','mark'=>'¥','status'=>1], ['code'=>'KRW','name'=>'韩元','country'=>'韩国','locale'=>'sk','mark'=>'₩','status'=>1], ['code'=>'EUR','name'=>'欧元','country'=>'法国','locale'=>'fr','mark'=>'€','status'=>1], ['code'=>'USD','name'=>'美元','country'=>'美国','locale'=>'en','mark'=>'$','status'=>1], ]; return showJson(1010, true, $data); } }