root пре 2 година
родитељ
комит
1e85ce7b89

+ 1 - 1
backendApi/modules/v1/controllers/SiteController.php

@@ -89,7 +89,7 @@ class SiteController extends BaseController
         // 钱包
         $shopWalletType = Yii::$app->params['shopWalletType'];
         // 全部报单中心角色
-        $decRoles = DecRole::find()->where('1=1')->select('ID,ROLE_NAME')->indexBy('ID')->asArray()->all();
+        $decRoles = DecRole::getAllDecRole();
         // 全部子公司
         $subCompanies = [];
         // 全部会员状态

+ 17 - 0
common/helpers/Tool.php

@@ -524,4 +524,21 @@ class Tool {
             LoggerTool::error(sprintf('[%s] [%s] [%s]', $e->getFile(), $e->getLine(), $e->getMessage()));
         }
     }
+
+    
+    /**
+     * 多语言转换,将数据转成基础数据
+     * @param $selData [] 数据
+     * @param $dbIndex strging 数据中要被覆盖转换多语言的字段
+     * @return []
+     */
+    public static function convertLanguage($selData, $dbIndex = 'LEVEL_NAME') {
+        foreach ($selData as $k => &$v) {
+            if (isset($v['LANGUAGE_KEY'])) {
+                $v[$dbIndex] = \Yii::t('ctx', $v['LANGUAGE_KEY']);
+            }
+        }
+
+        return $selData;
+    }
 }

+ 58 - 0
common/messages/en-US/ctx.php

@@ -1,5 +1,63 @@
 <?php
 return [
+    #system db config
+    # AR_DECLARATION_LEVEL 报单级别配置表
+    'dbDeclarationLevelElite' => 'Elite',
+    'dbDeclarationLevelPro' => 'Pro',
+    'dbDeclarationLevelVip' => 'VIP',
+
+    # AR_EMPLOY_LEVEL 聘级表
+    'dbEmployLevelNoRank' => 'No Rank',
+    'dbEmployLevel2StarDirector' => '2-Star Director',
+    'dbEmployLevel4StarDirector' => '4-Star Director',
+    'dbEmployLevel5StarDirector' => '5-Star Director',
+    'dbEmployLevel6StarDirector' => '6-Star Director',
+    'dbEmployLevel7StarDirector' => '7-Star Director',
+    'dbEmployLevel1StarDirector' => '1-Star Director',
+    'dbEmployLevel3StarDirector' => '3-Star Director',
+
+    # AR_CROWN_LEVEL 皇冠星级表
+    'dbCrownLevel6StarCrown' => '6-Star Crown',
+    'dbCrownLevel3StarCrown' => '3-Star Crown',
+    'dbCrownLevel2StarCrown' => '2-Star Crown',
+    'dbCrownLevel4StarCrown' => '4-Star Crown',
+    'dbCrownLevel7StarCrown' => '7-Star Crown',
+    'dbCrownLevel5StarCrown' => '5-Star Crown',
+    'dbCrownLevel0StarCrown' => '0-Star Crown',
+    'dbCrownLevel1StarCrown' => '1-Star Crown',
+
+    # AR_DEAL_TYPE 交易类型表
+    'dbDealTypeWithdrawlBack' => 'Withdrawl back',
+    'dbDealTypeTransferOutResellingPoints' => 'Transfer out reselling points',
+    'dbDealTypeBonusPayment' => 'Bonus payment',
+    'dbDealTypeOthers' => 'Others',
+    'dbDealTypeTravelPointsGrant' => 'Travel points grant',
+    'dbDealTypeCarPointsGrant' => 'Car points grant',
+    'dbDealTypeTravelPointsExchange' => 'Travel points exchange',
+    'dbDealTypeCarPointsExchange' => 'Car points exchange',
+    'dbDealTypeAdjustTravelPointsBalance' => 'Adjust travel points balance',
+    'dbDealTypeAdjustCarPointsBalance' =>'Adjust car points balance',
+    'dbDealTypeAdjustReissue' => 'Reissue',
+    'dbDealTypePermanentShutdownDeduction' => 'Permanent shutdown deduction',
+    'dbDealTypeAdjustVillaPointsBalance' => 'Adjust villa points balance',
+    'dbDealTypeVillaPointsExchange' => 'Villa points exchange',
+    'dbDealTypeVillaPointsGrant' => 'Villa points grant',
+    'dbDealTypeWithdrawBonus' => 'Withdraw bonus',
+    'dbDealTypeAdjustBalance' => 'Adjust balance',
+    'dbDealTypeReturnFreight' => 'Return freight',
+    'dbDealTypeCTransferInto' => 'C Transfer into',
+    'dbDealTypeDeductMoney' => 'Deduct money',
+    'dbDealTypeCancellationOfDeduction' => 'Cancellation of deduction',
+    'dbDealTypeTransferOut' => 'Transfer out',
+    'dbDealTypeTransferInto' => 'Transfer into',
+
+    # AR_DEC_ROLE报单中心级别配置表
+    'dbDecRole1stLevelStockist' => '1st Level Stockist',
+    'dbDecRole2ndLevelStockist' => '2nd Level Stockist',
+    'dbDecRole3rdLevelStockist' => '3rd Level Stockist',
+    'dbDecRole4thLevelStockist' => '4th Level Stockist',
+    'dbDecRole5thLevelStockist' => '5th Level Stockist',
+
     #Admin
     'AdminAddedSuccessfully' => 'Administrator added successfully',
     'AdminEditedSuccessfully' => 'Administrator edited successfully',

+ 58 - 0
common/messages/zh-CN/ctx.php

@@ -1,5 +1,63 @@
 <?php
 return [
+    #system db config
+    # AR_DECLARATION_LEVEL 报单级别配置表
+    'dbDeclarationLevelElite' => 'Elite',
+    'dbDeclarationLevelPro' => 'Pro',
+    'dbDeclarationLevelVip' => 'VIP',
+
+    # AR_EMPLOY_LEVEL 聘级表
+    'dbEmployLevelNoRank' => 'No Rank',
+    'dbEmployLevel2StarDirector' => '2-Star Director',
+    'dbEmployLevel4StarDirector' => '4-Star Director',
+    'dbEmployLevel5StarDirector' => '5-Star Director',
+    'dbEmployLevel6StarDirector' => '6-Star Director',
+    'dbEmployLevel7StarDirector' => '7-Star Director',
+    'dbEmployLevel1StarDirector' => '1-Star Director',
+    'dbEmployLevel3StarDirector' => '3-Star Director',
+
+    # AR_CROWN_LEVEL 皇冠星级表
+    'dbCrownLevel6StarCrown' => '6-Star Crown',
+    'dbCrownLevel3StarCrown' => '3-Star Crown',
+    'dbCrownLevel2StarCrown' => '2-Star Crown',
+    'dbCrownLevel4StarCrown' => '4-Star Crown',
+    'dbCrownLevel7StarCrown' => '7-Star Crown',
+    'dbCrownLevel5StarCrown' => '5-Star Crown',
+    'dbCrownLevel0StarCrown' => '0-Star Crown',
+    'dbCrownLevel1StarCrown' => '1-Star Crown',
+
+    # AR_DEAL_TYPE 交易类型表
+    'dbDealTypeWithdrawlBack' => '提现退回',
+    'dbDealTypeTransferOutResellingPoints' => '复消积分转出',
+    'dbDealTypeBonusPayment' => '奖金发放',
+    'dbDealTypeOthers' => '其他',
+    'dbDealTypeTravelPointsGrant' => '旅游积分发放',
+    'dbDealTypeCarPointsGrant' => '车奖积分发放',
+    'dbDealTypeTravelPointsExchange' => '旅游积分兑换',
+    'dbDealTypeCarPointsExchange' => '车奖积分兑换',
+    'dbDealTypeAdjustTravelPointsBalance' => '旅游积分余额调整',
+    'dbDealTypeAdjustCarPointsBalance' =>'车奖积分余额调整',
+    'dbDealTypeAdjustReissue' => '补发',
+    'dbDealTypePermanentShutdownDeduction' => '永久关停扣除',
+    'dbDealTypeAdjustVillaPointsBalance' => '房奖积分余额调整',
+    'dbDealTypeVillaPointsExchange' => '房奖积分兑换',
+    'dbDealTypeVillaPointsGrant' => '房奖积分发放',
+    'dbDealTypeWithdrawBonus' => '奖金提现',
+    'dbDealTypeAdjustBalance' => '余额调整',
+    'dbDealTypeReturnFreight' => '返运费',
+    'dbDealTypeCTransferInto' => 'c转入',
+    'dbDealTypeDeductMoney' => '扣币',
+    'dbDealTypeCancellationOfDeduction' => '注销扣除',
+    'dbDealTypeTransferOut' => '转出',
+    'dbDealTypeTransferInto' => '转入',
+
+    # AR_DEC_ROLE报单中心级别配置表
+    'dbDecRole1stLevelStockist' => '1st Level Stockist',
+    'dbDecRole2ndLevelStockist' => '2nd Level Stockist',
+    'dbDecRole3rdLevelStockist' => '3rd Level Stockist',
+    'dbDecRole4thLevelStockist' => '4th Level Stockist',
+    'dbDecRole5thLevelStockist' => '5th Level Stockist',
+
     #Admin
     'AdminAddedSuccessfully' => '管理员添加成功',
     'AdminEditedSuccessfully' => '管理员编辑成功',

+ 9 - 2
common/models/DealType.php

@@ -3,6 +3,7 @@
 namespace common\models;
 
 use backendApi\modules\v1\models\Admin;
+use common\helpers\Tool;
 use common\libs\logging\operate\valueType\Config as ValueTypeConfig;
 use Yii;
 
@@ -113,7 +114,10 @@ class DealType extends \common\components\ActiveRecord
      * @return array|\yii\db\ActiveRecord[]
      */
     public static function getAllTypes(){
-        return self::find()->select('ID,TYPE_NAME,IS_PRESET')->where('IS_ENABLE=1')->indexBy('ID')->orderBy('IS_PRESET ASC,SORT_ORDER DESC')->asArray()->all();
+        $data = self::find()->select('ID,TYPE_NAME,IS_PRESET')->where('IS_ENABLE=1')->indexBy('ID')->orderBy('IS_PRESET ASC,SORT_ORDER DESC')->asArray()->all();
+        $data = Tool::convertLanguage($data, 'TYPE_NAME');
+        
+        return $data;
     }
 
     /**
@@ -121,7 +125,10 @@ class DealType extends \common\components\ActiveRecord
      * @return array|\yii\db\ActiveRecord[]
      */
     public static function getAllTypesForShow(){
-        return self::find()->select('ID,TYPE_NAME,IS_PRESET')->indexBy('ID')->orderBy('IS_PRESET ASC,SORT_ORDER DESC')->asArray()->all();
+        $data = self::find()->select('ID,TYPE_NAME,IS_PRESET')->indexBy('ID')->orderBy('IS_PRESET ASC,SORT_ORDER DESC')->asArray()->all();
+        $data = Tool::convertLanguage($data, 'TYPE_NAME');
+        
+        return $data;
     }
 
     /**

+ 9 - 0
common/models/DecRole.php

@@ -3,6 +3,7 @@
 namespace common\models;
 
 use common\helpers\Cache;
+use common\helpers\Tool;
 use Yii;
 
 /**
@@ -113,4 +114,12 @@ class DecRole extends \common\components\ActiveRecord
         Yii::$app->cache->set(Cache::DEC_ROLE_CONFIG_KEY, $data);
         return $data;
     }
+
+    // 全部报单中心角色
+    public static function getAllDecRole() {
+        $data = DecRole::find()->where('1=1')->select('ID,ROLE_NAME,LANGUAGE_KEY')->indexBy('ID')->asArray()->all();
+        $data = Tool::convertLanguage($data, 'ROLE_NAME');
+
+        return $data;
+    }
 }

+ 4 - 0
common/models/DeclarationLevel.php

@@ -3,6 +3,7 @@
 namespace common\models;
 
 use common\helpers\Cache;
+use common\helpers\Tool;
 use Yii;
 
 /**
@@ -99,6 +100,9 @@ class DeclarationLevel extends \common\components\ActiveRecord
             $data = static::find()->where('1=1')->orderBy('PERF ASC, CREATED_AT ASC')->indexBy('ID')->asArray()->all();
             Yii::$app->cache->set(Cache::DEC_LEVEL_CONFIG_KEY, $data);
         }
+        
+        $data = Tool::convertLanguage($data);
+
         return $data;
     }
 

+ 4 - 0
common/models/EmployLevel.php

@@ -3,6 +3,7 @@
 namespace common\models;
 
 use common\helpers\Cache;
+use common\helpers\Tool;
 use Yii;
 use yii\helpers\Json;
 
@@ -214,6 +215,9 @@ class EmployLevel extends \common\components\ActiveRecord
             $data = self::getAllData();
             Yii::$app->cache->set(Cache::EMP_LEVEL_CONFIG_KEY, $data);
         }
+
+        $data = Tool::convertLanguage($data);
+
         return $data;
     }
 

+ 4 - 0
common/models/StarCrownLevel.php

@@ -4,6 +4,7 @@ namespace common\models;
 
 use common\helpers\Cache;
 use common\helpers\LoggerTool;
+use common\helpers\Tool;
 use Yii;
 
 /**
@@ -134,6 +135,9 @@ class StarCrownLevel extends \common\components\ActiveRecord
             $data = self::getAllData();
             Yii::$app->cache->set(Cache::CROWN_LEVEL_CONFIG_KEY, $data);
         }
+        
+        $data = Tool::convertLanguage($data);
+          
         return $data;
     }