lip hai 21 horas
pai
achega
0c7ad392c5

+ 35 - 30
app/Http/Controllers/admin/PaymentOrder.php

@@ -26,14 +26,14 @@ class PaymentOrder extends Controller
         //人工充值订单
         $data['rgRecharge'] = (int)PaymentOrderModel::whereIn('status', [0,1,5])->where('type', 3)->count();
         //人民币充值订单
-        $data['rgRecharge'] = (int)PaymentOrderModel::whereIn('status', [0,1])->where('type', 1)->count();
+        $data['rmbRecharge'] = (int)PaymentOrderModel::whereIn('status', [0,1])->where('type', 1)->count();
         
         //USDT提现订单
         $data['usdtWithdraw'] = (int)Withdraw::where('status', 0)->count();
         //人工提现订单
         $data['rgWithdraw'] = (int)PaymentOrderModel::where('status', 0)->where('type', 4)->count();
         //人民币提现订单
-        $data['rgWithdraw'] = (int)PaymentOrderModel::where('status', 0)->where('type', 2)->count();
+        $data['rmbWithdraw'] = (int)PaymentOrderModel::where('status', 0)->where('type', 2)->count();
         return $this->success($data);
     }
 
@@ -74,40 +74,44 @@ class PaymentOrder extends Controller
         DB::beginTransaction();
         try {
             $params = request()->validate([
-                'id' => ['required', 'integer'],
+                'id' => ['required'],
                 'status' => ['required', 'integer', 'in:2,3'],
                 'remark' => ['nullable', 'string'],
             ]);
             $remark = $params['remark'] ?? '';
-            $info = PaymentOrderModel::find($params['id']);
-            if (!$info) throw new Exception('数据不存在', HttpStatus::CUSTOM_ERROR);
-            if ($info->status != 5) throw new Exception('用户未提交充值凭证', HttpStatus::CUSTOM_ERROR);
-            if ($info->payment_type == 0) throw new Exception('当前订单非人工充值,无法操作', HttpStatus::CUSTOM_ERROR);
-            if ($params['status'] == 3) {
-                if (empty($remark)) {
-                    throw new Exception('请填写原因', HttpStatus::CUSTOM_ERROR);
+            $ids = is_array($params['id']) ? $params['id'] : [$params['id']];
+            foreach($ids as $id) {
+                $info = PaymentOrderModel::find($id);
+                if (!$info) throw new Exception('数据不存在', HttpStatus::CUSTOM_ERROR);
+                if ($params['status'] == 2 && $info->status != 5) throw new Exception('用户未提交充值凭证', HttpStatus::CUSTOM_ERROR);
+                if ($params['status'] == 3 && !in_array($info->status, [0,1,4,5])) throw new Exception('订单已完成,不可驳回', HttpStatus::CUSTOM_ERROR);
+                if ($params['status'] == 3) {
+                    //驳回
+                    if (empty($remark)) {
+                        throw new Exception('请填写原因', HttpStatus::CUSTOM_ERROR);
+                    }
+                    $info->status = $params['status'];
+                    $info->remark = $remark;
+                    $info->save();
+                } else {
+                    //充值成功
+                    $info->status = $params['status'];
+                    $info->remark = $remark;
+                    $info->state = 1;
+                    $info->save();
+    
+                    $memberId = $info->member_id;
+                    $amount = $info->amount;
+                    $changeType = '人工充值';
+                    $wallet = Wallet::where('member_id', $memberId)->first();
+                    if (!$wallet) throw new Exception('用户不存在', HttpStatus::CUSTOM_ERROR);
+                    $availableBalance = bcadd($wallet->available_balance, $amount, 10);
+                    BalanceLogService::addLog($memberId, $amount, $wallet->available_balance, $availableBalance, $changeType, null, $remark);
+                    $wallet->available_balance = $availableBalance;
+                    $wallet->save();
                 }
-                $info->status = $params['status'];
-                $info->remark = $remark;
-                $info->save();
-            } else {
-                //充值成功
-                $info->status = $params['status'];
-                $info->remark = $remark;
-                $info->state = 1;
-                $info->save();
-
-                $memberId = $info->member_id;
-                $amount = $info->amount;
-                $changeType = '人工充值';
-                $wallet = Wallet::where('member_id', $memberId)->first();
-                if (!$wallet) throw new Exception('用户不存在', HttpStatus::CUSTOM_ERROR);
-                $availableBalance = bcadd($wallet->available_balance, $amount, 10);
-                BalanceLogService::addLog($memberId, $amount, $wallet->available_balance, $availableBalance, $changeType, null, $remark);
-                $wallet->available_balance = $availableBalance;
-                $wallet->save();
-
             }
+            
             DB::commit();
         } catch (ValidationException $e) {
             DB::rollBack();
@@ -124,6 +128,7 @@ class PaymentOrder extends Controller
     {
         DB::beginTransaction();
         try {
+            
             $validate = [
                 'ids' => ['required', 'array', 'min:1', 'max:20'],
                 'ids.*' => ['required', 'integer', 'min:1'],

+ 1 - 1
app/Http/Controllers/admin/SportGameOrder.php

@@ -122,7 +122,7 @@ class SportGameOrder extends Controller
                     continue;
                 }
                 
-                $order->status = 4;
+                $order->status = 3;
                 $order->updated_at = time();
                 $order->save();
 

+ 11 - 0
app/Http/Controllers/api/Wallet.php

@@ -349,6 +349,17 @@ class Wallet extends BaseController
             ]);
             $member_id = request()->user->member_id;
             $user = User::where('member_id', $member_id)->first();
+
+            //检验是否有待处理的提现订单
+            if ($params['channel'] == 'rgtx') {
+                $count = PaymentOrder::where('type', PaymentOrderService::TYPE_SELF_PAYOUT)
+                            ->where('member_id', $member_id)
+                            ->whereIn('status', [0,1,4,5])
+                            ->count();
+                if ($count > 0) {
+                    throw new Exception(lang("您已有1笔提现订单正常处理中!"));
+                }
+            }
             if (empty($user->payment_password)) {
                 $error_code = 10011;
                 throw new Exception(lang("请先设置资金密码"));

+ 1 - 0
lang/en/messages.php

@@ -465,4 +465,5 @@ return [
     '请选择提现类型' => 'Please Select Withdrawal Type',
     '不支持此充值方式' => 'Not Support This Recharge Type', 
     '不支持此提现方式' =>  'Not Support This Withdrawal Type',
+    '您已有1笔提现订单正常处理中!' => 'You Have 1 Withdrawal Order In Normal Processing!',
 ];

+ 1 - 0
lang/vi/messages.php

@@ -465,4 +465,5 @@ return [
     '请选择提现类型' => 'Vui lòng chọn loại rút tiền',
     '不支持此充值方式' => 'Không hỗ trợ phương thức nạp này',
     '不支持此提现方式' => 'Không hỗ trợ phương thức rút này',
+    '您已有1笔提现订单正常处理中!' => 'Bạn đã có 1 lệnh rút tiền đang được xử lý!',
 ];

+ 1 - 0
lang/zh/messages.php

@@ -465,4 +465,5 @@ return [
     '请选择提现类型' => '请选择提现类型',
     '不支持此充值方式' => '不支持此充值方式',
     '不支持此提现方式' => '不支持此提现方式',
+    '您已有1笔提现订单正常处理中!' => '您已有1笔提现订单正常处理中!',
 ];