Эх сурвалжийг харах

会员转账touser为空或金额为0时,只报错不记日志

theo 2 жил өмнө
parent
commit
b5d5dacb96

+ 4 - 2
common/models/forms/TransferForm.php

@@ -264,9 +264,11 @@ class TransferForm extends Model {
      */
     public function validatePassword($attribute, $params) {
         $uid = \Yii::$app->user->id;
-        if(!$this->_fromUserInfo){
-            LoggerTool::info('transfer error, '.$uid.' '. $this->amount.' '. $this->toUserName);
+        if(!$this->toUserName || $this->amount == 0){
             $this->addError($attribute, '转账失败');
+        }else if(!$this->_fromUserInfo){
+            LoggerTool::info('transfer error, '.$uid.' '. $this->amount.' '. $this->toUserName);
+            $this->addError($attribute, '转账时发生错误');
         }else if (!User::validatePayPassword($this->_fromUserInfo['ID'], $this->payPassword)) {
             $this->addError($attribute, '支付密码不正确');
         }

+ 55 - 58
frontendEle/src/views/finance/transfer-add.vue

@@ -66,22 +66,22 @@ export default {
   },
   data () {
     return {
-      allWallet:{'bonus':'会员账户','cash':'现金钱包','point':'复销点数'},
+      allWallet: {'bonus': '会员账户', 'cash': '现金钱包', 'point': '复销点数'},
       form: {
-        type:1,
+        type: 1,
         toUserName: '',
         toRealName: '',
         amount: 0,
         payPassword: '',
         remark: '',
-        transferCode: '',
+        transferCode: ''
       },
       userInfo: {
-        TRANSFER_PROP:100,
+        TRANSFER_PROP: 100
       },
       balance: 0,
       cash: 0,
-      point:0,
+      point: 0,
       maxAmount: 0,
       fee: '0',
       realAmount: 0,
@@ -91,11 +91,11 @@ export default {
       submitButtonStat: false,
       openBanks: null,
       tool: tool,
-      transferConfig: [],
+      transferConfig: []
     }
   },
   methods: {
-    handleChange() {
+    handleChange () {
       this.loading = true
       network.getData('user/full-info', {userName: this.form.toUserName}).then(response => {
         this.form.toRealName = response.REAL_NAME
@@ -104,19 +104,19 @@ export default {
         this.loading = false
       })
     },
-    chkReal(){
-      this.realAmount = tool.formatPrice(this.form.amount * (100-this.fee) * 0.01)
+    chkReal () {
+      this.realAmount = tool.formatPrice(this.form.amount * (100 - this.fee) * 0.01)
     },
-    getWalletName(out,inw){
-      return this.allWallet[out]+'转'+this.allWallet[inw]
+    getWalletName (out, inw) {
+      return this.allWallet[out] + '转' + this.allWallet[inw]
     },
-    handleTypeChange(){
-      //奖金转现金
-      this.fee = this.transferConfig[this.form.type-1].fee
+    handleTypeChange () {
+      // 奖金转现金
+      this.fee = this.transferConfig[this.form.type - 1].fee
     },
-    chkTransferUserinfo(){
+    chkTransferUserinfo () {
       network.getData(`finance/chk-transfer-user`).then(response => {
-        console.log(response);
+        // console.log(response)
         this.loading = false
         this.userInfo = response.userInfo
         this.transferConfig = response.transferConfig
@@ -126,7 +126,7 @@ export default {
         this.$router.go(-1)
       })
     },
-    getBalance() {
+    getBalance () {
       this.$message({
         message: '正获取您的奖金...',
         type: 'info'
@@ -140,54 +140,51 @@ export default {
         this.loading = false
       })
     },
-    getMaxAmount(){
+    getMaxAmount () {
       this.maxAmount = Math.floor(tool.formatPrice(this.balance * this.userInfo.TRANSFER_PROP * 0.01))
       this.transferProp = this.userInfo.TRANSFER_PROP
     },
     onSubmit () {
-        this.submitButtonStat = true
-        let path = 'finance/transfer-add'
+      this.submitButtonStat = true
+      let path = 'finance/transfer-add'
 
-        network.getData('finance/mult-point').then(response => {
-            this.form.transferCode = response.transferCode
+      network.getData('finance/mult-point').then(response => {
+        this.form.transferCode = response.transferCode
 
-            this.$prompt('请输入支付密码', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                inputType: 'password',
-                inputPattern: /\S+/,
-                inputErrorMessage: '请输入支付密码',
-                beforeClose:async (action, instance, done)=>{
-                    if (action === 'confirm') {
-                        instance.confirmButtonLoading = true;
-                        instance.confirmButtonText = '执行中...';
-                        console.log(instance.inputValue);
-                        this.form.payPassword = instance.inputValue;
-                        await network.postData(path, this.form).then(response => {
-
-                            instance.confirmButtonLoading = false;
-                            done();
-                            this.$message({
-                                message: response,
-                                type: 'success'
-                            })
-                            this.submitButtonStat = false
-                            this.$router.go(-1)
-                        }).catch(error=>{
-                            instance.confirmButtonLoading = false;
-                            this.submitButtonStat = false
-                            done();
-                        })
-                    }else {
-                        this.submitButtonStat = false
-                        done();
-                    }
-                }
-            })
+        this.$prompt('请输入支付密码', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          inputType: 'password',
+          inputPattern: /\S+/,
+          inputErrorMessage: '请输入支付密码',
+          beforeClose: async (action, instance, done) => {
+            if (action === 'confirm') {
+              instance.confirmButtonLoading = true
+              instance.confirmButtonText = '执行中...'
+              console.log(instance.inputValue)
+              this.form.payPassword = instance.inputValue
+              await network.postData(path, this.form).then(response => {
+                instance.confirmButtonLoading = false
+                done()
+                this.$message({
+                  message: response,
+                  type: 'success'
+                })
+                this.submitButtonStat = false
+                this.$router.go(-1)
+              }).catch(error => {
+                instance.confirmButtonLoading = false
+                this.submitButtonStat = false
+                done()
+              })
+            } else {
+              this.submitButtonStat = false
+              done()
+            }
+          }
         })
-
-
-    },
+      })
+    }
   }
 }
 </script>