kevin_zhangl před 3 roky
rodič
revize
6c48ef9f96
1 změnil soubory, kde provedl 21 přidání a 21 odebrání
  1. 21 21
      common/models/forms/TransferForm.php

+ 21 - 21
common/models/forms/TransferForm.php

@@ -90,10 +90,10 @@ class TransferForm extends Model {
 
     public function attributeLabels() {
         return [
-            'toUserName' => '转入会员编号',
-            'amount' => '金额',
-            'payPassword' => '支付密码',
-            'transferCode' => '转账校验码',
+            'toUserName' => 'Transferred Member Code', // 转入会员编号
+            'amount' => 'Amount', // 金额
+            'payPassword' => 'Payment Password', // 支付密码
+            'transferCode' => 'Verification Code', // 转账校验码
         ];
     }
 
@@ -106,7 +106,7 @@ class TransferForm extends Model {
     public function initUser($attribute) {
         // 转账记录
         if(!$toUserId = Info::getUserIdByUserName($this->toUserName)){
-            $this->addError($attribute, '转入会员不存在');
+            $this->addError($attribute, 'Transferred member not exists'); // 转入会员不存在
             return null;
         }
 //        if(Info::getUserRealNameByUserId($toUserId)!=$this->toRealName){
@@ -118,7 +118,7 @@ class TransferForm extends Model {
         $fromUserId = \Yii::$app->user->id;
         $fromUser = Info::baseInfo($fromUserId);
         if (!$fromUser) {
-            $this->addError($attribute, '转出会员不存在');
+            $this->addError($attribute, 'Transferred member not exists'); // 转入会员不存在
             return null;
         }
         // 转账条件判断
@@ -173,33 +173,33 @@ class TransferForm extends Model {
      */
     public function isAmount($attribute) {
         if(!$this->_fromUserInfo){
-            $this->addError($attribute, '会员信息未验证通过');
+            $this->addError($attribute, 'Member info has not been verified'); // 会员信息未验证通过
             return null;
         }
         if ($this->amount <= 0) {
-            $this->addError($attribute, '转账金额必须大于0');
+            $this->addError($attribute, 'The transfer amount must be greater than 0'); // 转账金额必须大于0
         }
         if ((int)$this->amount!=$this->amount) {
-            $this->addError('scenario', '转账金额必须是整数');
+            $this->addError('scenario', 'The transfer amount must be a round number'); // 转账金额必须是整数
         }
         $minAmount = $this->_transferConfig['outMin'];
         if ($this->amount < $minAmount) {
-            $this->addError($attribute, '转账金额低于转账下限');
+            $this->addError($attribute, 'The transfer amount is lower than the transfer limit'); // 转账金额低于转账下限
         }
         $maxAmount = $this->_transferConfig['outMax'];
         if ($maxAmount && $this->amount > $maxAmount) {
-            $this->addError($attribute, '转账金额高于转账上限');
+            $this->addError($attribute, 'The transfer amount is higher than the transfer limit'); // 转账金额高于转账上限
         }
         //周转账上限
         if($this->_transferConfig['weekMax']!=0){
             if($this->amount+Transfer::weekTransfer($this->_fromUserInfo['ID'])>$this->_transferConfig['weekMax']){
-                $this->addError($attribute, '超出周转账上限');
+                $this->addError($attribute, 'The working book limit is exceeded'); // 超出周转账上限
             }
         }
         //月转账上限
         if($this->_transferConfig['monthMax']!=0){
             if($this->amount+Transfer::monthTransfer($this->_fromUserInfo['ID'])>$this->_transferConfig['weekMax']){
-                $this->addError($attribute, '超出月转账上限');
+                $this->addError($attribute, 'Exceed the monthly transfer limit'); // 超出月转账上限
             }
         }
 
@@ -210,7 +210,7 @@ class TransferForm extends Model {
             $haveBalance = Balance::getAvailableBalance($this->_fromUserInfo['ID']);
         }
         if ($this->amount > $haveBalance) {
-            $this->addError($attribute, '转账金额必须小于自己的可用余额');
+            $this->addError($attribute, 'The transfer amount must be less than your available balance'); // 转账金额必须小于自己的可用余额
         }
         // 转账比例
         if ($this->type == self::BONUS_TO_BALANCE) {
@@ -218,7 +218,7 @@ class TransferForm extends Model {
             if ($isCanTransferProp == 1) {
                 $maxAmount = Tool::formatPrice($this->_fromUserInfo['TRANSFER_PROP'] * Balance::getAvailableBalance($this->_fromUserInfo['ID']) * 0.01);
                 if ($this->amount > $maxAmount) {
-                    $this->addError($attribute, '转账金额超出转账比例限额');
+                    $this->addError($attribute, 'The transfer amount exceeds the transfer ratio limit'); // 转账金额超出转账比例限额
                 }
             }
         }
@@ -242,14 +242,14 @@ class TransferForm extends Model {
      */
     public function isType($attribute) {
         if (!in_array($this->type, self::allowTransferType)) {
-            $this->addError($attribute, '不允许的转账类型');
+            $this->addError($attribute, 'Types of transfers that are not allowed'); // 不允许的转账类型
         }
         //获取转账参数
         if(!$this->_transferConfig = Json::decode(Cache::getSystemConfig()['allowWallet']['VALUE'])[$this->type-1]){
-            $this->addError($attribute, '错误的转账类型');
+            $this->addError($attribute, 'Wrong type of transfer'); // 错误的转账类型
         }
         if(!$this->_transferConfig['isOpen']){
-            $this->addError($attribute, '不可用的转账类型');
+            $this->addError($attribute, 'Type of transfer that is not available'); // 不可用的转账类型
         }
     }
 
@@ -260,7 +260,7 @@ class TransferForm extends Model {
      */
     public function validatePassword($attribute, $params) {
         if (!User::validatePayPassword($this->_fromUserInfo['ID'], $this->payPassword)) {
-            $this->addError($attribute, '支付密码不正确');
+            $this->addError($attribute, 'The payment password is incorrect');//支付密码不正确
         }
     }
 
@@ -269,7 +269,7 @@ class TransferForm extends Model {
         $redisCode = \Yii::$app->redis->getset('transferCode_'.$uid,'');
         \Yii::$app->redis->del('transferCode_'.$uid);
         if ($this->transferCode!=$redisCode) {
-            $this->addError($attribute, '转账校验失败'.$redisCode);
+            $this->addError($attribute, 'Transfer verification failed '.$redisCode); // 转账校验失败
         }
     }
     /**
@@ -348,7 +348,7 @@ class TransferForm extends Model {
                 Cash::changeUserCash($this->_fromUserInfo['ID'], 'CASH', -abs($this->amount), ['TRANSFER_SN' => $model->TRANSFER_SN,'DEAL_TYPE_ID' => DealType::TRANSFER_OUT, 'REMARK' => 'To:' . $this->_toUserInfo['USER_NAME'] . ',' . $this->remark]);
                 Cash::changeUserCash($this->_toUserInfo['ID'], 'CASH', abs($amount), ['TRANSFER_SN' => $model->TRANSFER_SN,'DEAL_TYPE_ID' => DealType::TRANSFER_IN, 'REMARK' => 'From:' . $this->_fromUserInfo['USER_NAME'] . ',' . $this->remark]);
             }else {
-                throw new \Exception('错误的交易类型');
+                throw new \Exception('Wrong transaction type'); // 错误的交易类型
             }
 
             $transaction->commit();