Browse Source

feat: 会员端转账只有报单中心可以

zhangl 1 year ago
parent
commit
95f21a1b74

+ 11 - 0
common/models/forms/TransferForm.php

@@ -313,6 +313,17 @@ class TransferForm extends Model {
         if ($this->_fromUserInfo['ID']==$this->_toUserInfo['ID'] && $this->_transferConfig['out']==$this->_transferConfig['in']){
             throw new \Exception('不能给同一账户转账');
         }
+
+        // 转账是否已开启
+        $transferSwitch = Cache::getSystemConfig()['transferSwitch'] ?? '';
+        if ($transferSwitch != 1) {
+            // 转账未开启,判断是否报单中心. 报单中心可开启转账
+            $isDec = \frontendApi\modules\v1\models\User::getEnCodeInfo($this->_fromUserInfo['ID'])['IS_DEC'];
+            if ($isDec != 1) {
+                throw new \Exception('转账功能已关闭');
+            }
+        }
+
         $this->userOperateLogger->saveBeforeContent=array_merge($fromData,$toData);
 
         $db = \Yii::$app->db;

+ 4 - 4
frontendApi/modules/v1/controllers/SiteController.php

@@ -213,8 +213,8 @@ class SiteController extends BaseController
 
         if($menu['allow']=='transferRecordSwitch'){
             $transferRecordSwitch = isset(Cache::getSystemConfig()['transferRecordSwitch']) ? Cache::getSystemConfig()['transferRecordSwitch']['VALUE'] : '';
-            $isStudio = User::getEnCodeInfo(\Yii::$app->user->id)['IS_DEC'];
-            if ($isStudio == 1) {
+            $isDec = User::getEnCodeInfo(\Yii::$app->user->id)['IS_DEC'];
+            if ($isDec == 1) {
                 return false;
             }
 
@@ -226,8 +226,8 @@ class SiteController extends BaseController
 
         if($menu['allow']=='transferSwitch'){
             $transferSwitch = isset(Cache::getSystemConfig()['transferSwitch']) ? Cache::getSystemConfig()['transferSwitch']['VALUE'] : '';
-            $isStudio = User::getEnCodeInfo(\Yii::$app->user->id)['IS_DEC'];
-            if ($isStudio == 1) {
+            $isDec = User::getEnCodeInfo(\Yii::$app->user->id)['IS_DEC'];
+            if ($isDec == 1) {
                 return false;
             }
             if($transferSwitch) {