Просмотр исходного кода

Merge branch 'bugfix/2107-transaction-self' into dev

theojeng 3 лет назад
Родитель
Сommit
5f7f311627

+ 1 - 1
common/helpers/user/Info.php

@@ -604,7 +604,7 @@ class Info {
      * @return array|null
      */
     public static function getLastInfo($userId){
-        $data = User::findOneAsArray('ID=:ID', [':ID' => $userId], 'LAST_DEC_LV AS DEC_LV,EMP_LV,STATUS');
+        $data = User::findOneAsArray('ID=:ID', [':ID' => $userId], 'LAST_DEC_LV AS DEC_LV,EMP_LV,LAST_EMP_LV,STATUS');
         return $data;
     }
 

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

@@ -301,11 +301,11 @@ class TransferForm extends Model {
         if (!$this->validate()) {
             return null;
         }
-        if ($this->_fromUserInfo['ID']==$this->_toUserInfo['ID']){
-            throw new \Exception('不能给自己转账');
-        }
         $fromData = Balance::getLogData($this->_fromUserInfo['ID']);
         $toData = Balance::getLogData($this->_toUserInfo['ID']);
+        if ($this->_fromUserInfo['ID']==$this->_toUserInfo['ID'] && $this->_transferConfig['out']==$this->_transferConfig['in']){
+            throw new \Exception('不能给自己转账');
+        }
         $this->userOperateLogger->saveBeforeContent=array_merge($fromData,$toData);
 
         $db = \Yii::$app->db;

+ 2 - 1
frontendEle/src/views/dashboard/index.vue

@@ -136,7 +136,8 @@
         if (type) return require('@/assets/emp-ico-' + type + '.png')
       },
       getEmpBg (type) {
-        if (type !== 0) return 'backgroundImage:url(' + require('@/assets/emp-bg-' + type + '.png') + ')'
+        let index = parseInt(type)
+        if (index) return 'backgroundImage:url(' + require('@/assets/emp-bg-' + index + '.png') + ')'
       },
       sub_str(str, len = 15) {
         if (str) return str.slice(0, len)

+ 9 - 18
frontendEle/src/views/finance/transfer-add.vue

@@ -58,7 +58,6 @@ 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',
@@ -96,23 +95,15 @@ 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 => {
-                  this.form.toRealName = response.REAL_NAME
-                  this.loading = false
-              }).catch(response => {
-                      this.loading = false
-              })
-          } else {
-            this.form.toUserName = ''
-            this.$message({
-              message: '不能给自己转账',
-              type: 'error'
-            })
-          }
-      },
+    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
+      })
+    },
     chkReal(){
       this.realAmount = tool.formatPrice(this.form.amount * (100-this.fee) * 0.01)
     },