Przeglądaj źródła

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

zhangl 1 rok temu
rodzic
commit
2bdccd164b
1 zmienionych plików z 14 dodań i 0 usunięć
  1. 14 0
      common/models/forms/TransferForm.php

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

@@ -123,6 +123,19 @@ class TransferForm extends Model {
             $this->addError($attribute, '转出会员不存在');
             return null;
         }
+
+        // 转账是否已开启
+        $transferSwitch = Cache::getSystemConfig()['transferSwitch']['VALUE'] ?? '';
+        if ($transferSwitch != 1) {
+            // 转账未开启,判断是否报单中心. 报单中心可开启转账
+            $isDec = \frontendApi\modules\v1\models\User::getEnCodeInfo($fromUserId)['IS_DEC'];
+            if ($isDec != 1) {
+                throw new \Exception('转账功能已关闭');
+                return null;
+            }
+        }
+
+
         // 转账条件判断
         $orderAmount = Order::find()->where('USER_ID=:USER_ID', [':USER_ID' => $fromUserId])->SUM('ORDER_AMOUNT');
         $recNum = intval(DecOrder::find()->where('REC_USER_ID=:REC_USER_ID', [':REC_USER_ID' => $fromUserId])->count());
@@ -313,6 +326,7 @@ class TransferForm extends Model {
         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;