root пре 2 година
родитељ
комит
514fe69d86

+ 29 - 3
backendApi/modules/v1/controllers/ConfigController.php

@@ -99,7 +99,7 @@ class ConfigController extends BaseController {
      * @throws \yii\web\HttpException
      */
     public function actionBonusOpt() {
-        $configs = Config::find()->where("TYPE='bonus'")->orderBy('SORT ASC')->indexBy('CONFIG_NAME')->asArray()->all();
+        $configs = Config::actionBonusOpt();//Config::find()->where("TYPE='bonus'")->orderBy('SORT ASC')->indexBy('CONFIG_NAME')->asArray()->all();
         foreach ($configs as $key => $config) {
             if ($config['OPTIONS']) {
                 $configs[$key]['OPTIONS'] = Json::decode($config['OPTIONS']);
@@ -115,7 +115,7 @@ class ConfigController extends BaseController {
             }
         }
         // 获取会员报单级别的相关参数
-        $decLevel = DeclarationLevel::find()->orderBy('SORT ASC')->asArray()->all();
+        $decLevel = DeclarationLevel::configGetDeclarationLevelOrderBySort();//DeclarationLevel::find()->orderBy('SORT ASC')->asArray()->all();
         // 获取会员聘级相关参数
         $empLevel = EmployLevel::getAllDataWithNumIndex();
         // 获取会员星级相关参数
@@ -371,6 +371,7 @@ class ConfigController extends BaseController {
     public function actionTransfer() {
         // 获取priod的相关配置参数
         $configs = Config::find()->where("TYPE='transfer'")->orderBy('SORT ASC')->indexBy('CONFIG_NAME')->asArray()->all();
+        $configs = Tool::convertLanguage($configs, 'TITLE');
         $form = new ConfigForm();
         if (Yii::$app->request->post() && $form->load(Yii::$app->request->post(), '')) {
             if ($form->updateTransfer()) {
@@ -403,6 +404,7 @@ class ConfigController extends BaseController {
     public function actionScore() {
         // 获取priod的相关配置参数
         $configs = Config::find()->where("TYPE='score'")->orderBy('SORT ASC')->indexBy('CONFIG_NAME')->asArray()->all();
+        $configs = Tool::convertLanguage($configs, 'TITLE');
         $form = new ConfigForm();
         if (Yii::$app->request->post() && $form->load(Yii::$app->request->post(), '')) {
             if ($form->updateScore()) {
@@ -435,6 +437,7 @@ class ConfigController extends BaseController {
     public function actionOther() {
         // 获取priod的相关配置参数
         $configs = Config::find()->where("TYPE='other'")->orderBy('SORT ASC')->indexBy('CONFIG_NAME')->asArray()->all();
+        $configs = Tool::convertLanguage($configs, 'TITLE');
         $form = new ConfigForm();
         if (Yii::$app->request->post() && $form->load(Yii::$app->request->post(), '')) {
             if ($form->updateOther()) {
@@ -484,6 +487,14 @@ class ConfigController extends BaseController {
         $data = DeclarationLevel::lists('', [], [
             'orderBy' => 'SORT ASC, CREATED_AT ASC'
         ]);
+        if (!empty($data['list'])) {
+            foreach ($data['list'] as &$v) {
+                if (isset($v['LANGUAGE_KEY']) && !empty($v['LANGUAGE_KEY'])) {
+                    $v['TITLE'] = \Yii::t('ctx', $v['LANGUAGE_KEY']);
+                }
+            } 
+        }
+
         return static::notice($data);
     }
 
@@ -502,11 +513,16 @@ class ConfigController extends BaseController {
         ->where("CONFIG_NAME='observePeriodLimit'")
         ->asArray()
         ->one();
+        if (!empty($data) && isset($data['LANGUAGE_KEY']) && !empty($data['LANGUAGE_KEY'])) {
+            $data['TITLE'] = \Yii::t('ctx', $data['LANGUAGE_KEY']);
+        }
         $isSwitchUpgrade = Config::find()
         ->where("CONFIG_NAME='isOpenUpgrade'")
         ->asArray()
         ->one();
-
+        if (!empty($isSwitchUpgrade) && isset($isSwitchUpgrade['LANGUAGE_KEY']) && !empty($isSwitchUpgrade['LANGUAGE_KEY'])) {
+            $isSwitchUpgrade['TITLE'] = \Yii::t('ctx', $isSwitchUpgrade['LANGUAGE_KEY']);
+        }
         return static::notice([
             'observe' => $data,
             'isOpenUpgrade' => $isSwitchUpgrade
@@ -542,6 +558,14 @@ class ConfigController extends BaseController {
         $data = DecRole::lists('', [], [
             'orderBy' => 'SORT ASC'
         ]);
+        if (!empty($data['list'])) {
+            foreach ($data['list'] as &$v) {
+                if (isset($v['LANGUAGE_KEY']) && !empty($v['LANGUAGE_KEY'])) {
+                    $v['ROLE_NAME'] = \Yii::t('ctx', $v['LANGUAGE_KEY']);
+                }
+            } 
+        }
+
         return static::notice($data);
     }
 
@@ -869,6 +893,8 @@ class ConfigController extends BaseController {
         }
 
         $oneData = Config::find()->where('CONFIG_NAME=:CONFIG_NAME', [':CONFIG_NAME' => 'exchangeRate'])->asArray()->one();
+        $oneData = Tool::convertLanguage($oneData, 'TITLE');
+
         return static::notice($oneData);
     }
 }

+ 1 - 1
common/messages/en-US/ctx.php

@@ -84,7 +84,7 @@ return [
     'dbConfigIsCanTransferProp' => '是否开启单笔转账比例',
     'dbConfigIsCanWithdrawBack' => '是否开启前台提现退回功能',
     'dbConfigIsDecReg' => '只允许报单中心报单',
-    'dbConfigIsOpenUpgrade' => '是否开启会员升级单功能',
+    'dbConfigIsOpenUpgrade' => '是否开启会员升级单功能-enus',
     'dbConfigIsResaleUmbrella' => '是否只允许为伞下会员报复消单',
     'dbConfigManageTaxPercent' => '管理费比例',
     'dbConfigManualWithdrawMinAmount' => '手动提现最低金额',

+ 1 - 1
common/messages/zh-CN/ctx.php

@@ -52,7 +52,7 @@ return [
     'dbDealTypeTransferInto' => '转入',
 
     # AR_DEC_ROLE报单中心级别配置表
-    'dbDecRole1stLevelStockist' => '1st Level Stockist',
+    'dbDecRole1stLevelStockist' => '1st Level Stockist--中文',
     'dbDecRole2ndLevelStockist' => '2nd Level Stockist',
     'dbDecRole3rdLevelStockist' => '3rd Level Stockist',
     'dbDecRole4thLevelStockist' => '4th Level Stockist',

+ 8 - 0
common/models/Config.php

@@ -183,4 +183,12 @@ class Config extends \common\components\ActiveRecord
         return $data;
     }
 
+    public static function actionBonusOpt() {
+        $data = Config::find()->where("TYPE='bonus'")->orderBy('SORT ASC')->indexBy('CONFIG_NAME')->asArray()->all();
+        $data = Tool::convertLanguage($data, 'TITLE');
+
+        return $data;
+
+    }
+
 }

+ 7 - 0
common/models/DeclarationLevel.php

@@ -261,4 +261,11 @@ class DeclarationLevel extends \common\components\ActiveRecord
         }
         return $data;
     }
+    
+    public static function configGetDeclarationLevelOrderBySort() {
+        $data = DeclarationLevel::find()->orderBy('SORT ASC')->asArray()->all();
+        $data = Tool::convertLanguage($data);
+
+        return $data;
+    }
 }

+ 4 - 0
common/models/EmployLevel.php

@@ -156,6 +156,10 @@ class EmployLevel extends \common\components\ActiveRecord
             } else{
                 $allData[$key]['YC_PERCENT_ARR'] = [0,0,0,0,0,0,0,0,0,0];
             }
+
+            if (isset($data['LANGUAGE_KEY']) && !empty($data['LANGUAGE_KEY'])) {
+                $allData[$key]['LEVEL_NAME'] = \Yii::t('ctx', $data['LANGUAGE_KEY']);
+            }
         }
         return $allData;
     }

+ 4 - 1
common/models/StarCrownLevel.php

@@ -83,7 +83,10 @@ class StarCrownLevel extends \common\components\ActiveRecord
      */
     public static function getAllDataWithNumIndex()
     {
-        return static::find()->where('1=1')->orderBy('SORT ASC, CREATED_AT ASC')->indexBy('SORT')->asArray()->all();
+        $data = static::find()->where('1=1')->orderBy('SORT ASC, CREATED_AT ASC')->indexBy('SORT')->asArray()->all();
+        $data = Tool::convertLanguage($data);
+
+        return $data;
     }
 
     /**