Jelajahi Sumber

Merge branch 'liuzj-permission-dev' into test

liuzejian 1 tahun lalu
induk
melakukan
bab7b964ef

+ 1 - 0
modules/Common/Errors/Errors.php

@@ -26,4 +26,5 @@ class Errors
     public const  TIXIAN_YUE_BUZU = [500201, '提现余额不足'];
     public const  TIXIAN_YUE_BUZU = [500201, '提现余额不足'];
     public const  BANK_CARD_STATUS_ERROR = [500202, '银行卡不存在或当前状态不可提现'];
     public const  BANK_CARD_STATUS_ERROR = [500202, '银行卡不存在或当前状态不可提现'];
     public const  TIXIAN_RECORD_NOT_EXISTS = [500203, '提现记录不存在'];
     public const  TIXIAN_RECORD_NOT_EXISTS = [500203, '提现记录不存在'];
+    public const  TIXIAN_ONLY_ONCE_EVERY_DAY = [500204, '每天只能提现一次'];
 }
 }

+ 8 - 1
modules/Jiesuan/Http/Controllers/JiesuanController.php

@@ -68,6 +68,14 @@ class JiesuanController extends CatchController
             'tixian_money' => 'required|numeric|min:500'
             'tixian_money' => 'required|numeric|min:500'
         ]);
         ]);
         $company_uid = $this->getLoginUserId();
         $company_uid = $this->getLoginUserId();
+        $now = date('Y-m-d H:i:s');
+
+        if(DB::table('tixian_records')->where(['company_uid' => $company_uid])
+            ->where('created_at', '>=', date('Y-m-d'))
+            ->where('created_at', '<=', $now)
+            ->exists()) {
+            CommonBusinessException::throwError(Errors::TIXIAN_ONLY_ONCE_EVERY_DAY);
+        }
         $tixianMoney = $request->input('tixian_money');
         $tixianMoney = $request->input('tixian_money');
         $userMoneyInfo = CompanyUserMoneyService::userMoneyInfo($company_uid);
         $userMoneyInfo = CompanyUserMoneyService::userMoneyInfo($company_uid);
         if($tixianMoney > $userMoneyInfo->yue_money) {
         if($tixianMoney > $userMoneyInfo->yue_money) {
@@ -78,7 +86,6 @@ class JiesuanController extends CatchController
         if(!$bankCard) {
         if(!$bankCard) {
             CommonBusinessException::throwError(Errors::BANK_CARD_STATUS_ERROR);
             CommonBusinessException::throwError(Errors::BANK_CARD_STATUS_ERROR);
         }
         }
-        $now = date('Y-m-d H:i:s');
         DB::table('tixian_records')
         DB::table('tixian_records')
             ->insert([
             ->insert([
                 'tixian_money' => $tixianMoney,
                 'tixian_money' => $tixianMoney,