diff --git a/app/admin/controller/Appconfig.php b/app/admin/controller/Appconfig.php index bbd7ed71d..ceae163e8 100755 --- a/app/admin/controller/Appconfig.php +++ b/app/admin/controller/Appconfig.php @@ -55,12 +55,17 @@ class AppConfig extends Base */ public function Save() { - // 空字段处理 - $field_list = [ - 'common_user_onekey_bind_mobile_list', - 'common_user_address_platform_import_list', - ]; - return ApiService::ApiDataReturn(ConfigService::ConfigSave(ConfigService::FieldsEmptyDataHandle($_POST, $field_list))); + $params = $_POST; + if(isset($this->ress['nav_type']) && $ssss['nav_type'] == 'app') + { + // 空字段处理 + $field_list = [ + 'common_user_onekey_bind_mobile_list', + 'common_user_address_platform_import_list', + ]; + $params = ConfigService::FieldsEmptyDataHandle($params, $field_list); + } + return ApiService::ApiDataReturn(ConfigService::ConfigSave($params)); } } ?> \ No newline at end of file diff --git a/app/admin/controller/Common.php b/app/admin/controller/Common.php index 935e0a243..f33d3c92a 100755 --- a/app/admin/controller/Common.php +++ b/app/admin/controller/Common.php @@ -398,7 +398,7 @@ class Common extends BaseController // 多语言 $assign['multilingual_default_code'] = MultilingualService::GetUserMultilingualValue(); - $assign['multilingual_data'] = MultilingualService::MultilingualData(); + $assign['multilingual_data'] = (MyC('admin_use_multilingual_status') == 1) ? MultilingualService::MultilingualData() : []; // 模板赋值 MyViewAssign($assign); diff --git a/app/admin/controller/Site.php b/app/admin/controller/Site.php index 7f8bcc739..e2856e596 100755 --- a/app/admin/controller/Site.php +++ b/app/admin/controller/Site.php @@ -191,6 +191,8 @@ class Site extends Base 'second_nav_list' => MyLang('site.second_nav_list'), // 网站设置导航 'siteset_nav_list' => MyLang('site.siteset_nav_list'), + // 多语言 + 'common_multilingual_list' => MyLang('common_multilingual_list'), ]; return $assign; } @@ -283,6 +285,11 @@ class Site extends Base case 'order' : $params['common_default_payment'] = empty($params['common_default_payment']) ? '' : json_encode($params['common_default_payment'], JSON_UNESCAPED_UNICODE); break; + + // 扩展 + case 'extends' : + $field_list[] = 'common_multilingual_choose_list'; + break; } break; diff --git a/app/admin/lang/en.php b/app/admin/lang/en.php index de4ffd88d..5ba1100a5 100644 --- a/app/admin/lang/en.php +++ b/app/admin/lang/en.php @@ -178,6 +178,7 @@ return [ 'base_item_crontab_config_title' => 'Timing Script Config', 'base_item_quick_nav_title' => 'Quick Navigation', 'base_item_user_address_title' => 'User Address', + 'base_item_multilingual_title' => 'Multilingual', 'base_item_site_auto_mode_title' => 'Automatic Mode', 'base_item_site_manual_mode_title' => 'Manual Mode', 'base_item_default_payment_title' => 'Default Payment Method', diff --git a/app/admin/lang/zh.php b/app/admin/lang/zh.php index c14d53ea1..e2c778dea 100755 --- a/app/admin/lang/zh.php +++ b/app/admin/lang/zh.php @@ -178,6 +178,7 @@ return [ 'base_item_crontab_config_title' => '定时脚本配置', 'base_item_quick_nav_title' => '快捷导航', 'base_item_user_address_title' => '用户地址', + 'base_item_multilingual_title' => '多语言', 'base_item_site_auto_mode_title' => '自动模式', 'base_item_site_manual_mode_title' => '手动模式', 'base_item_default_payment_title' => '默认支付方式', diff --git a/app/admin/view/default/appconfig/app.html b/app/admin/view/default/appconfig/app.html index 3aa736cf9..f6f49021c 100644 --- a/app/admin/view/default/appconfig/app.html +++ b/app/admin/view/default/appconfig/app.html @@ -8,7 +8,7 @@
-
+
diff --git a/app/admin/view/default/site/siteset/extends.html b/app/admin/view/default/site/siteset/extends.html index 57853f478..879bb2f77 100644 --- a/app/admin/view/default/site/siteset/extends.html +++ b/app/admin/view/default/site/siteset/extends.html @@ -135,6 +135,41 @@
+ +
+
+

{{:MyLang('site.base_item_multilingual_title')}}

+
+
+
+ +
+ {{foreach $common_multilingual_list as $k=>$v}} + + {{/foreach}} +
+
+
+ + +
+
+ + +
+
+
+
diff --git a/app/lang/en.php b/app/lang/en.php index 09c8fb7ae..5fba8347c 100644 --- a/app/lang/en.php +++ b/app/lang/en.php @@ -3580,6 +3580,21 @@ return [ 'desc' => 'Default on', 'tips' => 'Please select the bottom footer content status', ], + 'admin_use_multilingual_status' => [ + 'name' => 'Backend uses multiple languages', + 'desc' => 'Default on', + 'tips' => 'Please select a backend that uses multiple languages', + ], + 'home_use_multilingual_status' => [ + 'name' => 'Multilingual front-end', + 'desc' => 'Default on', + 'tips' => 'Please select multiple languages for the front end', + ], + 'common_multilingual_choose_list' => [ + 'name' => 'Available in multiple languages', + 'desc' => 'Check to use', + 'tips' => 'Please tick the language you want to use', + ], ], ]; ?> \ No newline at end of file diff --git a/app/lang/zh.php b/app/lang/zh.php index fc71dd05a..d34fd350b 100755 --- a/app/lang/zh.php +++ b/app/lang/zh.php @@ -3541,6 +3541,21 @@ return [ 'desc' => '默认开启', 'tips' => '请选择底部页脚内容状态', ], + 'admin_use_multilingual_status' => [ + 'name' => '后端使用多语言', + 'desc' => '默认关闭', + 'tips' => '请选择后端使用多语言', + ], + 'home_use_multilingual_status' => [ + 'name' => '前端用多语言', + 'desc' => '默认关闭', + 'tips' => '请选择前端用多语言', + ], + 'common_multilingual_choose_list' => [ + 'name' => '可用多语言', + 'desc' => '勾选则使用', + 'tips' => '请勾选需要使用的语言', + ], ], ]; ?> \ No newline at end of file diff --git a/app/service/ConfigService.php b/app/service/ConfigService.php index deadc3632..fe12b4acc 100755 --- a/app/service/ConfigService.php +++ b/app/service/ConfigService.php @@ -76,6 +76,7 @@ class ConfigService 'home_search_params_type', 'common_user_onekey_bind_mobile_list', 'common_user_address_platform_import_list', + 'common_multilingual_choose_list', ]; // json数组字段 @@ -124,6 +125,9 @@ class ConfigService // cookie有效域名 'common_cookie_domain', + + // 多语言可选列表 + 'common_multilingual_choose_list', ]; /** diff --git a/app/service/MultilingualService.php b/app/service/MultilingualService.php index 06cc01324..c6e11e598 100644 --- a/app/service/MultilingualService.php +++ b/app/service/MultilingualService.php @@ -41,7 +41,7 @@ class MultilingualService $default = []; $select = []; $allow_lang_list = MyConfig('lang.allow_lang_list'); - $multilingual_list = MyLang('common_multilingual_list'); + $multilingual_list = self::MultilingualCanChooseList(); if(!empty($multilingual_list) && is_array($multilingual_list) && !empty($allow_lang_list) && is_array($allow_lang_list)) { $allow_lang_list = array_column($allow_lang_list, null, 'code'); @@ -87,6 +87,32 @@ class MultilingualService return $user_multilingual_result; } + /** + * 语言列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2023-03-22 + * @desc description + */ + public static function MultilingualCanChooseList() + { + $result = []; + $data = MyLang('common_multilingual_list'); + if(!empty($data) && is_array($data)) + { + $choose_list = MyC('common_multilingual_choose_list'); + foreach($data as $k=>$v) + { + if(!empty($choose_list) && is_array($choose_list) && in_array($k, $choose_list)) + { + $result[$k] = $v; + } + } + } + return $result; + } + /** * 当前页面url地址 * @author Devil diff --git a/app/service/NavigationService.php b/app/service/NavigationService.php index 967e9e0fd..bdc950003 100755 --- a/app/service/NavigationService.php +++ b/app/service/NavigationService.php @@ -670,17 +670,20 @@ class NavigationService ]; // 追加多语言 - $multilingual_data = MultilingualService::MultilingualData(); - if(!empty($multilingual_data) && !empty($multilingual_data['data']) && !empty($multilingual_data['default'])) + if(MyC('home_use_multilingual_status') == 1) { - $data[] = [ - 'name' => MyLang('lang_title').'['.$multilingual_data['default']['name'].']', - 'is_login' => 0, - 'badge' => null, - 'icon' => 'am-icon-language', - 'url' => '', - 'items' => $multilingual_data['data'], - ]; + $multilingual_data = MultilingualService::MultilingualData(); + if(!empty($multilingual_data) && !empty($multilingual_data['data']) && !empty($multilingual_data['default'])) + { + $data[] = [ + 'name' => MyLang('lang_title').'['.$multilingual_data['default']['name'].']', + 'is_login' => 0, + 'badge' => null, + 'icon' => 'am-icon-language', + 'url' => '', + 'items' => $multilingual_data['data'], + ]; + } } // 顶部小导航右侧钩子 @@ -1098,7 +1101,9 @@ class NavigationService $user_order_count = OrderService::OrderTotal($where); // 商品收藏/我的足迹总数 - $where = ['user_id'=>$params['user']['id']]; + $where = [ + ['user_id', '=', $params['user']['id']], + ]; $user_goods_favor_count = GoodsFavorService::GoodsFavorTotal($where); $user_goods_browse_count = GoodsBrowseService::GoodsBrowseTotal($where); diff --git a/app/service/OrderAftersaleService.php b/app/service/OrderAftersaleService.php index ad9cd1531..49bf993a2 100644 --- a/app/service/OrderAftersaleService.php +++ b/app/service/OrderAftersaleService.php @@ -43,14 +43,14 @@ class OrderAftersaleService public static function OrdferGoodsRow($order_id, $order_detail_id, $user_id) { // 获取列表 - $data_params = array( + $data_params = [ 'm' => 0, 'n' => 1, 'where' => [ - 'id' => intval($order_id), - 'user_id' => intval($user_id), + ['id', '=', intval($order_id)], + ['user_id', '=', intval($user_id)], ], - ); + ]; $ret = OrderService::OrderList($data_params); if($ret['code'] == 0 && !empty($ret['data'][0])) {