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

Revert "不允许给自己转账,恢复"

This reverts commit 8e040b27ab9c6d8e888ca8da7f503b9cb1540c41.
theojeng 3 жил өмнө
parent
commit
631f905f5d

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

@@ -298,9 +298,9 @@ 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']){
+            throw new \Exception('Not allowed to transfer to yourself');
+        }
         $fromData = Balance::getLogData($this->_fromUserInfo['ID']);
         $toData = Balance::getLogData($this->_toUserInfo['ID']);
         $this->userOperateLogger->saveBeforeContent=array_merge($fromData,$toData);

+ 17 - 7
frontendEle/src/views/finance/transfer-add.vue

@@ -54,6 +54,7 @@ import Vue from 'vue'
 import store from '@/utils/vuexStore'
 import network from '@/utils/network'
 import tool from '@/utils/tool'
+import userInfo from '@/utils/userInfo'
 
 export default {
   name: 'finance_withdraw-add',
@@ -92,13 +93,22 @@ export default {
   },
   methods: {
     handleChange () {
-      this.loading = true
-      network.getData('user/full-info', {userName: this.form.toUserName}).then(response => {
-        this.form.toRealName = response.REAL_NAME
-        this.loading = false
-      }).catch(response => {
-        this.loading = false
-      })
+      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'
+        })
+      }
     },
     chkReal () {
       this.realAmount = tool.formatPrice(this.form.amount * (100 - this.fee) * 0.01)