root 3 лет назад
Родитель
Сommit
80dcc6a030
1 измененных файлов с 34 добавлено и 30 удалено
  1. 34 30
      common/models/forms/DeclarationUpgradeForm.php

+ 34 - 30
common/models/forms/DeclarationUpgradeForm.php

@@ -78,21 +78,21 @@ class DeclarationUpgradeForm extends Model
     public function attributeLabels()
     {
         return [
-            'type' => '升级类型',
-            'decLv' => '升级级别',
-            'decWay' => '报单方式',
-            'packageId' => '升级套餐',
-            'goodsId' => '商品ID',
-            'goodsNum' => '商品数量',
-            'insertUserName' => '要升级的会员编号',
-            'consignee' => '收货人',
-            'acceptMobile' => '收货人手机',
-            'province' => '收货省',
-            'city' => '收货市',
-            'county' => '收货区县',
+            'type' => 'Upgrade type',//升级类型
+            'decLv' => 'Upgrade level',//升级级别
+            'decWay' => 'Declaration method',//报单方式
+            'packageId' => 'Upgrade package',//升级套餐
+            'goodsId' => 'Product ID',//商品ID
+            'goodsNum' => 'Product quantity',//商品数量
+            'insertUserName' => 'Member number to be upgraded',//要升级的会员编号
+            'consignee' => 'consignee',//收货人
+            'acceptMobile' => 'The phone number of Consignee',//收货人手机
+            'province' => 'Receiving Province',//收货省
+            'city' => 'Receiving City',//收货市
+            'county' => 'Receiving area / county',//收货区县
             'lgaName' => 'Local Government Area',
             'cityName' => 'City',
-            'address' => '收货详细地址',
+            'address' => 'Receiving detailed address',//收货详细地址
         ];
     }
 
@@ -115,13 +115,13 @@ class DeclarationUpgradeForm extends Model
             $decLevel = $decLevelConfig[$this->decLv];
             $toDecLevel = $this->decLv;
             if(!$this->decLv){
-                throw new Exception('请选择升级级别');
+                throw new Exception('Please select upgrade level');//请选择升级级别
             }
             $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
             $userId = $baseInfo['ID'];
             $userDecPvSum = User::sumDevPvByUserId($userId); // 用户所有报单PV总和
             if ($userDecPvSum != $this->nowPerf) {
-                throw new Exception('请联系客服人员核对升级会员业绩');
+                throw new Exception('Please contact the customer service personnel to check the performance of upgraded members');//请联系客服人员核对升级会员业绩
             }
             // 获取用户是否是观察期
             $observe = Config::getConfigByType('observe'); // 获取观察期配置信息
@@ -129,7 +129,7 @@ class DeclarationUpgradeForm extends Model
             $isObserve = User::checkIsObserve($baseInfo['CREATED_AT'], $observeLimit); // 判断用户是否再观察期中
             $diffPerf = $isObserve ? $this->nowPerf : 0; // 观察期内升级要加上用户累计的PV,全额则基础PV为0,全额购买
             if ($this->decWay != 2) {
-                throw new Exception('升级方式不正确,请联系客服人员');
+                throw new Exception('The upgrade method is incorrect. Please contact the customer service personnel');//升级方式不正确,请联系客服人员
             }
             if($this->decWay==1) {
                 // 先不加套餐升级方式
@@ -173,7 +173,7 @@ class DeclarationUpgradeForm extends Model
                 // 这里特殊是用户原报单PV之和+用户购买的商品总PV
                 $checkPv = $totalPv + $diffPerf;
                 if($checkPv < $decLevel['PERF']) {
-                    throw new Exception('总PV不能小于所选级别PV');
+                    throw new Exception('Total PV cannot be less than the selected level PV');//总PV不能小于所选级别PV
                 }
                 foreach ($decLevelConfig as $key=>$val){
                     if($checkPv>=$val['PERF']){
@@ -181,21 +181,21 @@ class DeclarationUpgradeForm extends Model
                     }
                 }
                 if($this->decLv!=$toDecLevel){
-                    throw new Exception('总PV不能超过已选级别下一个级别的PV值');
+                    throw new Exception('The total PV cannot exceed the PV value of the next level under the selected level');//总PV不能超过已选级别下一个级别的PV值
                 }
                 $this->_decAmount = $totalAmount;
                 $this->_decPv = $totalPv;
             }
             //看现金余额是否充足
             if (Cash::getAvailableBalance($loginUserId) < $this->_decAmount){
-                throw new Exception('报单人现金不足,无法完成报单');
+                throw new Exception('The applicant is short of cash and cannot complete the declaration');//报单人现金不足,无法完成报单
             }
             $baseInfo = Info::baseInfoZhByUserName($this->insertUserName);
             $this->_insertUserId = $baseInfo['ID']; // 被报单人,通过insername 查找用户id
             $insertConId = $baseInfo['CON_UID'];
             $insertRecId = $baseInfo['REC_UID'];
             if(!($decResult = $this->addDecOrder($insertConId,$insertRecId, $baseInfo['DEC_LV'],$isObserve,$this->remark))) {
-                throw new Exception("操作失败");
+                throw new Exception("operation failed");//操作失败
             }
         }
         return true;
@@ -209,7 +209,7 @@ class DeclarationUpgradeForm extends Model
     public function addDecOrder($insertConId,$insertRecId,$oriDecLv,$isObserve,$remark=''){
         $warehouse = Region::getWarehouseByCode($this->province);//仓库
         if(!$warehouse){
-            throw new Exception('地区暂时不支持配送,具体联系客服');
+            throw new Exception('Delivery is temporarily not supported in the region. Contact customer service for details');//地区暂时不支持配送,具体联系客服
         }
         $upgradeType = $isObserve ? 1 : 2; // 1补差  2全额
         $periodObj = Period::instance();
@@ -300,10 +300,12 @@ class DeclarationUpgradeForm extends Model
 			                    $data->update();
 			                }
 			            }else{
-			                throw new Exception("商品".$goods['GOODS_NAME']."库存不足");
+//			                throw new Exception("商品".$goods['GOODS_NAME']."库存不足");
+                            throw new Exception("product".$goods['GOODS_NAME']."Insufficient inventory");
 			            }
 			         }else{
-			             throw new Exception("商品".$goods['GOODS_NAME']."已下架");
+//			             throw new Exception("商品".$goods['GOODS_NAME']."已下架");
+                         throw new Exception("product".$goods['GOODS_NAME']."Removed from the shelf");
 			         }
 			     }
 			 }
@@ -337,7 +339,8 @@ class DeclarationUpgradeForm extends Model
                 throw new Exception(Form::formatErrorsForApi($addressModel->getErrors()));
             }
             // 扣报单人现金钱包
-            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'升级报单']);
+//            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'为'.$this->insertUserName.'升级报单']);
+            Cash::changeUserCash(\Yii::$app->user->id, 'CASH', -abs($this->_decAmount), ['REMARK' =>'by'.$this->insertUserName.'Upgrade entry']);
             // 为被升级人进行升级操作
             $decLevelLog = new DecLevelLog();
             $decLog = [
@@ -351,7 +354,7 @@ class DeclarationUpgradeForm extends Model
             $modifyDecLv = $decLevelLog->frontendChange($decLog);
             if (empty($modifyDecLv)) {
                 $transaction->rollBack();
-                throw new Exception("为会员升级失败");
+                throw new Exception("Failed to upgrade for member");//为会员升级失败
             }
             $transaction->commit();
         } catch(Exception $e) {
@@ -375,7 +378,7 @@ class DeclarationUpgradeForm extends Model
         ->asArray()
         ->one();
         if (!$decUser) {
-            $this->addError($attribute, '报单中心不存在');
+            $this->addError($attribute, 'Entry center does not exist');//报单中心不存在
             return false;
         } else {
             // 判断报单中心是否在新加入会员的安置网上级中
@@ -384,7 +387,8 @@ class DeclarationUpgradeForm extends Model
             //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
             $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
             if (!isset($flipParent[$this->decUserName])) {
-                $this->addError($attribute, '为' . $this->insertUserName . '升级报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+//                $this->addError($attribute, '为' . $this->insertUserName . '升级报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                $this->addError($attribute, 'by' . $this->insertUserName . 'Upgrade declaration, declaration Center' . $this->decUserName . 'be not in' . $this->insertUserName . 'Online level of resettlement');
                 return ;
             }
             $this->_decId = $decUser['ID'];
@@ -395,11 +399,11 @@ class DeclarationUpgradeForm extends Model
     // 判断是否已选择商品或套餐
     public function hasProduct($attribute) {
         if ($this->decWay==1 && empty($this->packageId)) {
-            $this->addError($attribute, '购买套餐升级,请选择套餐');
+            $this->addError($attribute, 'Purchase package upgrade, please select package');//购买套餐升级,请选择套餐
             return false;
         }
         if ($this->decWay!=1 && empty($this->goodsId)) {
-            $this->addError($attribute, '购买商品升级,请选择商品');
+            $this->addError($attribute, 'Purchase product upgrade, please select product');//购买商品升级,请选择商品'
             return false;
         }
 
@@ -413,7 +417,7 @@ class DeclarationUpgradeForm extends Model
         $maxPerfInfo = DeclarationLevel::getMaxDecPref(); 
         $maxDecId = $maxPerfInfo['ID']; // 级别配置中最高级别ID
         if ($maxDecId == $userDecId) {
-            $this->addError($attribute, '已是最高级别,无需升级');
+            $this->addError($attribute, 'It is already the highest level and no upgrade is required');//已是最高级别,无需升级
             return false;
         }