Sfoglia il codice sorgente

给自己转账,只允许奖金转余额

theojeng 3 anni fa
parent
commit
cbd1240009

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

@@ -298,8 +298,8 @@ class TransferForm extends Model {
         if (!$this->validate()) {
             return null;
         }
-        if ($this->_fromUserInfo['ID']==$this->_toUserInfo['ID']){
-            throw new \Exception('Not allowed to transfer to yourself');
+        if ($this->_fromUserInfo['ID']==$this->_toUserInfo['ID'] && $this->_transferConfig['out']==$this->_transferConfig['in']){
+            throw new \Exception('Not allowed to transfer to the same account');
         }
         $fromData = Balance::getLogData($this->_fromUserInfo['ID']);
         $toData = Balance::getLogData($this->_toUserInfo['ID']);

+ 8 - 16
frontendEle/src/views/finance/transfer-add.vue

@@ -93,22 +93,14 @@ export default {
   },
   methods: {
     handleChange () {
-      if (this.form.toUserName.trim() != userInfo.userName()){
-        this.loading = true
-        network.getData('user/full-info', {userName: this.form.toUserName}).then(response => {
-          console.log(userInfo.userName())
-          this.form.toRealName = response.REAL_NAME
-          this.loading = false
-        }).catch(response => {
-          this.loading = false
-        })
-      } else {
-        this.form.toUserName = ''
-        this.$message({
-          message: 'Not allowed to transfer to yourself',
-          type: 'error'
-        })
-      }
+      this.loading = true
+      network.getData('user/full-info', {userName: this.form.toUserName}).then(response => {
+        console.log(userInfo.userName())
+        this.form.toRealName = response.REAL_NAME
+        this.loading = false
+      }).catch(response => {
+        this.loading = false
+      })
     },
     chkReal () {
       this.realAmount = tool.formatPrice(this.form.amount * (100 - this.fee) * 0.01)