prod_is_duli()) { $ali_plugin_goodsDetail = Option::get(OptionSetting::ALI_MINI_PLUGIN_goodsDetail . 0, 0, 'saas', 1)['value']; } return [ OptionSetting::ALI_MINI_PLUGIN_goodsDetail => (int)$ali_plugin_goodsDetail, ]; } public static function getConfig($store_id) { $contact_tel = Option::get(OptionSetting::STORE_CONTACT_TEL, $store_id); $store_name = Option::get(OptionSetting::STORE_NAME, $store_id); // 服务器图片 $form = new StoreImageFrom(); $share_form = new ShareForm(); $wxappImg = $form->search(); $lang = ''; if (is_platform()) { $lang = Option::get('lang', 0, 'saas', 'zh-CN')['value']; } else { $lang = Option::get('language', get_store_id(), 'display', 'zh-CN')['value']; } $store = Store::findOne(get_store_id()); $lat = ''; $long = ''; $distance = '未知距离'; $coordinate = explode(',', $store->coordinate); if ($coordinate) { $lat = isset($coordinate[0]) ? $coordinate[0] : 0; $long = isset($coordinate[1]) ? $coordinate[1] : 0; } $store_info = self::getStore($store_id); $store_info['payment'] = json_decode(Option::get('payment', $store_id, 'store', '{}')['value'], true); $store_info['latitude'] = $lat; $store_info['longitude'] = $long; $store_info['distance'] = $distance; $store_info['mobile'] = $store->contact_tel; $store_info['address'] = $store->address; $store_info['province_name'] = District::findOne($store->province_id)->name; $store_info['city_name'] = District::findOne($store->city_id)->name; $store_info['district_name'] = District::findOne($store->district_id)->name; $store_info['cover_url'] = $store->logo; $store_info['saas_name'] = Option::get('name', 0, 'saas', '')['value']; $store_info['saas_logo'] = Option::get('logo', 0, 'saas', '')['value']; if (\Yii::$app->prod_is_dandianpu()) { $store_info['mch_appid'] = Option::get('platform_mch_appid', 0, 'saas', '')['value']; } $switch_store = Option::get('one_store_switch_store', 0, 'saas', 0); $default_store = Option::get('one_store_default_store', 0, 'saas', 1)['value']; if ($store_id) { $result = self::getStoreSwitch($store_id); $default_store = $result['store_id']; } $is_password_login = Option::get(OptionSetting::IS_PASSWORD_LOGIN, $store_id, 'display', 0)['value']; $is_password_login = Option::get(OptionSetting::IS_PASSWORD_LOGIN, $store_id, 'reg', $is_password_login)['value']; $is_password_login_phone_verify = Option::get(OptionSetting::IS_PASSWORD_LOGIN_PHONE_VERIFY, $store_id, 'display', 0)['value']; $is_password_login_phone_verify = Option::get(OptionSetting::IS_PASSWORD_LOGIN_PHONE_VERIFY, $store_id, 'reg', $is_password_login_phone_verify)['value']; $store_info['is_password_login'] = intval($is_password_login); $store_info['is_password_login_phone_verify'] = intval($is_password_login_phone_verify); $one_store_hide_apply = Option::get('one_store_hide_apply', 0, 'saas', '0')['value']; $store_info['kefu_id'] = $store->kefu_id; if (is_wechat_platform()) { $alipay_login_toggle = Option::get('wechat_login_toggle', get_store_id(), 'wechat', 0)['value']; $store_info['alipay_login_toggle'] = Option::get('wechat_login_toggle', get_store_id(), 'reg', $alipay_login_toggle)['value']; } if (is_alipay_platform()) { $store_info['alipay_login_toggle'] = 1;//Option::get('alipay_login_toggle', get_store_id(), 'alipay', 0)['value']; } $default_user_info_arr = OptionSetting::default_user_info_arr(); $default_user_info = [ 'default_user_nickname' => $default_user_info_arr['default_user_nickname'] ?? '', 'default_user_pic' => $default_user_info_arr['default_user_pic'] ?? '', ]; if (isset($default_user_info_arr['isOpenDefault'])) { if (!$default_user_info_arr['isOpenDefault']) { $default_user_info = [ 'default_user_nickname' => '', 'default_user_pic' => '' ]; } } $store_info['default_user_info'] = $default_user_info; $store_info['app_is_open_map'] = Option::get(OptionSetting::APP_IS_OPEN_MAP, get_store_id(), 'app', 2)['value']; $copyright = Option::get('copyright', get_store_id(), 'store', '')['value']; if (\Yii::$app->prod_is_dandianpu() && intval(get_store_id()) === 0) { $copyright = Option::get('copyright', $default_store, 'store', '')['value']; } $store_admin = Admin::findOne(['type' => 'store', 'type_id' => get_store_id(), 'is_delete' => 0]); $store = Store::findOne(get_store_id()); $copyright = json_decode($copyright, true) ?: [ 'type' => 1, 'mini_url' => [ 'name' => '商城首页', 'link' => '/pages/home/home', 'open_type' => "switchtab", 'params' => [] ], 'mobile' => $store_admin->mobile ?? '', 'logo' => $store->logo ?: (Option::get('logo', get_store_id(), 'store')['value'] ?: Option::get('web_log', get_store_id(), 'web')['value']), 'copyright' => $store->name ]; foreach ($store_info['payment'] as $pay_type_index => &$pay_type_item) { if ($pay_type_index === \app\models\Order::PAY_TYPE_KEY_YUNST_WECHAT_PAY) { $isShowPayType = boolval(Store::findOne($store_id)->cusid); if (intval($pay_type_item['value']) === 1 && !$isShowPayType) { $pay_type_item['value'] = 0; } } } $mchSetting = json_decode(Option::get(OptionSetting::MCH_SETTING, get_store_id(), 'store', '{}')['value'], true); if(empty($mchSetting)){ $mchSetting = [ 'mch_reg_form' => $mchSetting['mch_reg_form'] ?? [], 'mch_reg_text' => $mchSetting['mch_reg_text'] ?? '', 'mch_goods_audit' => $mchSetting['mch_goods_audit'] ?? 0, 'mch_order_notice' => $mchSetting['mch_order_notice'] ?? 0, 'mch_cash_type' => $mchSetting['mch_cash_type'] ?? [0], 'mch_cash_rate' => $mchSetting['mch_cash_rate'] ?? 0, 'show_mch_mobile' => !isset($mchSetting['show_mch_mobile']) ? 1 : $mchSetting['show_mch_mobile'], 'show_mch_address' => !isset($mchSetting['show_mch_address']) ? 1 : $mchSetting['show_mch_address'], ]; } $mchSetting['show_mch_mobile'] = !isset($mchSetting['show_mch_mobile']) ? 1 : $mchSetting['show_mch_mobile']; $mchSetting['show_mch_address'] = !isset($mchSetting['show_mch_address']) ? 1 : $mchSetting['show_mch_address']; $copyright['type'] = intval($copyright['type']); $config = [ 'share_setting' => $share_form->getShareSetting()['data'], 'images' => $wxappImg, 'wx_bar_title' => [], 'store_name' => $store_name ? $store_name['value'] : '', 'contact_tel' => $contact_tel ? $contact_tel['value'] : '', 'store' => $store_info, 'navbar' => self::getNav(), 'platform_appid' => Option::getSaasWechat()['sp_appid'], 'language' => $lang, 'one_store_switch_store' => (bool)$switch_store['value'], 'one_store_default_store' => $default_store ?: 1, 'one_store_hide_apply' => (string)$one_store_hide_apply, 'copyright' => $copyright, 'shareHolderAliasName' => Option::get('shareHolderAliasName', $store_id, 'bonus_pool', '股东')['value'], 'mch_setting' => $mchSetting ]; // \Yii::error([__METHOD__, $config]); return $config; } //判断是单店铺且平台设置供应链为不可切换店铺时返回店铺id public static function getStoreSwitch($store_id) { //is_switch_store 是否需要切换店铺 $is_switch_store = false; $is_dandianpu = \Yii::$app->prod_is_dandianpu(); //判断是单店铺模式 if ($is_dandianpu) { //如果当前店铺是有独立小程序店铺,就不跳转 $self_mini = \app\models\Option::get('self_mini', $store_id, 'store', 0)['value']; if (!intval($self_mini)) { //判断平台设置是否可以切换店铺 $lock_store = Option::get('one_store_lock_store', 0, 'saas', 0)['value']; if (intval($lock_store)) { //获取注册时店铺id $saas_user = get_saas_user(); //如果是非运营人员就做判断 $storeOperations = StoreOperations::findOne(['saas_id' => $saas_user->id, 'is_delete' => 0]); if (empty($storeOperations) || intval($storeOperations->status) === 0) { //注册店铺id与当前店铺不一致就执行 if ($saas_user->store_id > 0 && intval($saas_user->store_id) !== $store_id) { //如果跳转店铺是没有独立小程序店铺,就跳转 $self_mini = \app\models\Option::get('self_mini', $saas_user->store_id, 'store', 0)['value']; if (!intval($self_mini)) { $store_id = $saas_user->store_id; $is_switch_store = true; } } } } } } return [ 'is_switch_store' => $is_switch_store, 'store_id' => $store_id ]; } /** * 平台小程序信息接口 * @return array */ public static function getPlatformConfig() { $store_name = Option::get('name', 0, 'saas')['value']; // 服务器图片 $form = new StoreImageFrom(); $wxappImg = $form->search(); $config = [ 'images' => $wxappImg, 'store_name' => $store_name, 'store' => [ 'name' => $store_name, 'logo' => Option::get('logo', 0, 'saas')['value'] ], 'language' => 'zh-CN' ]; return $config; } public static function getNav() { $default = [ 'frontColor' => '#000000', 'backgroundColor' => '#ffffff', 'bottomBackgroundColor' => '#ffffff', ]; $navigation_bar_color = Option::get('navigation_bar_color', get_store_id(), 'navbar', Json::encode($default)); $navbar = AppNavbar::getNavbar(get_store_id()); return [ 'navbar' => $navbar, 'navigation_bar_color' => Json::decode($navigation_bar_color['value']) ]; } /** * 获取商城信息 */ public static function getStore($store_id) { $key = [ 'reg' => [ OptionSetting::STORE_MOBILE_VERIFY, ], 'pay' => [ OptionSetting::STORE_SEND_TYPE, ], 'store' => [ OptionSetting::STORE_NAME, OptionSetting::STORE_MOBILE_VERIFY, OptionSetting::STORE_LOGIN_FORCIBLY_BIND_MOBILE, OptionSetting::STORE_OVER_DAY, OptionSetting::STORE_DELIVERY_TIME, OptionSetting::STORE_AFTER_SALE_TIME, OptionSetting::STORE_SEND_TYPE, OptionSetting::STORE_INTEGRAL, OptionSetting::STORE_INTEGRAL_NAME, OptionSetting::STORE_INTEGRATION, ], 'display' => [ OptionSetting::DISPLAY_IS_COMMENT, OptionSetting::WEB_STORE_SHARE_TITLE, OptionSetting::WEB_STORE_SHARE_LOG, OptionSetting::WEB_STORE_SHARE_DESC, OptionSetting::CLIENT_LOADING_LOGO, OptionSetting::STORE_CLIENT_PRIVACY_ID, OptionSetting::STORE_CLIENT_SERVICE_ID, OptionSetting::INSURANCE_BG_IMG, OptionSetting::IS_SHOW_CART_LEVEL_PRICE, ], 'web' => [ OptionSetting::WEB_LOG, OptionSetting::WEB_PASSPORT_BG ], 'wechat' => [ OptionSetting::WECHAT_IS_SHENHE, OptionSetting::WECHAT_AUTO_ADDRESS_STATUS, OptionSetting::WECHAT_IS_OFFICIAL_ACCOUNT, OptionSetting::WECHAT_ALI_IS_SHENHE ] ]; // $data = Option::get($key,$store_id); $value = []; foreach ($key as $index => $item) { foreach ($item as $val) { if (empty($value[$val])) { $value[$val] = Option::get($val,$store_id,$index)['value']; } if ($val === OptionSetting::STORE_INTEGRAL_NAME && !$value[$val]) { $value[$val] = "积分"; } } } // $data['quick_navigation'] = (object)array(); $store = Store::findOne($store_id); if ($store) { $value['is_alliance'] = $store->is_alliance; $value['douyin_url'] = $store->douyin_url; $value['balance'] = $store->balance; } if (is_platform()) { $value['name'] = Option::get('name', 0, 'saas', '')['value']; $value['web_log'] = Option::get('logo', 0, 'saas', '')['value']; $value['shenhe'] = Option::get('shenhe', 0, 'saas', 0)['value']; $value['union_client_loading_logo'] = Option::get('union_client_loading_logo', 0, 'saas', '')['value']; } $value['mobile'] = $store->contact_tel; $value['is_bind_wechat'] = 1; return $value; } }