post('app_sources', 'ios'); $cacheKey = "caches:config:app_{$appSources}"; $config = RedisService::get($cacheKey); if (empty($config)) { $config = [ 'app_name' => ConfigService::make()->getConfigByCode('app_name'), 'app_logo' => get_image_url(ConfigService::make()->getConfigByCode('app_logo')), 'app_version' => ConfigService::make()->getConfigByCode('app_version'), 'withdraw_balance_desc' => format_content(ConfigService::make()->getConfigByCode('withdraw_balance_desc', '')), 'withdraw_property_desc' => format_content(ConfigService::make()->getConfigByCode('withdraw_property_desc', '')), 'goods_disclaimer' => format_content(ConfigService::make()->getConfigByCode('goods_disclaimer', '')), 'wxpay_open' => ConfigService::make()->getConfigByCode('wxpay_open', 0), 'withdraw_open' => ConfigService::make()->getConfigByCode('withdraw_open', 0), 'withdraw_min' => ConfigService::make()->getConfigByCode('withdraw_min', 0), 'withdraw_fee' => ConfigService::make()->getConfigByCode('withdraw_fee', 0), 'withdraw_property_open' => ConfigService::make()->getConfigByCode('withdraw_property_open', 0), 'withdraw_property_fee' => ConfigService::make()->getConfigByCode('withdraw_property_fee', 0), 'property_withdraw_rate' => ConfigService::make()->getConfigByCode('property_withdraw_rate', 0), 'transfer_bd_score_open' => ConfigService::make()->getConfigByCode('transfer_bd_score_open', 0), 'notices' => NoticeService::make()->getRecommandList(), ]; RedisService::set($cacheKey, $config, 3600); } return showJson(1010, true, $config); } catch (\Exception $exception) { $error = ['data' => $exception->getTrace(), 'err' => $exception->getMessage()]; return showJson(1046, false, $error); } } /** * 首页数据 * @return array */ public function data() { $type = request()->post('type',1); try { $data = [ // 轮播 'banners' => AdService::make()->getListByPosition(1), 'goods' => GoodsService::make()->getListByType(2), ]; return showJson(1010, true, $data); } catch (\Exception $exception) { $error = ['data' => $exception->getTrace(), 'err' => $exception->getMessage()]; return showJson(1046, false, $error); } } /** * 验证更新 * @return array */ public function versionCheck() { $version = request()->post('version', ''); $appSources = request()->post('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'), 'app_url' => ConfigService::make()->getConfigByCode("app_{$appSources}_url"), 'is_force' => ConfigService::make()->getConfigByCode("app_force_update"), 'auto_update' => false, // 是否APP内自动更新 ]; return showJson(1010, true, $data); } else { return showJson(1010, false, ['has_update' => false, 'version' => $version]); } } }