lip 6 часов назад
Родитель
Сommit
30b54c4904

+ 24 - 0
app/Http/Controllers/admin/PaymentOrder.php

@@ -202,4 +202,28 @@ class PaymentOrder extends Controller
         }
         return $this->success([], $result['msg'] ?? '操作成功');
     }
+
+    //设置提现订单是否加锁
+    public function setIsLocked()
+    {
+        DB::beginTransaction();
+        try {
+            $params = request()->validate([
+                'ids' => ['required', 'array', 'min:1', 'max:20'],
+                'ids.*' => ['required', 'integer', 'min:1'],
+                'is_locked' => ['required', 'integer', 'in:1,0'],
+            ]);
+            foreach ($params['ids'] as $id) {
+                PaymentOrderModel::whereIn('id',$id)->whereIn('type',[2,4])->update('is_locked',$params['is_locked']);
+            }
+            DB::commit();
+        } catch (ValidationException $e) {
+            DB::rollBack();
+            return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
+        } catch (Exception $e) {
+            DB::rollBack();
+            return $this->error($e->getCode(), $e->getMessage());
+        }
+        return $this->success();
+    }
 }

+ 3 - 4
app/Http/Controllers/admin/RechargeChannel.php

@@ -34,9 +34,9 @@ class RechargeChannel extends Controller
                 ->forPage($page, $limit)
                 ->get();
             foreach($list as &$item) {
-                $item->rechargeType = RechargeChannelModel::getChannel(1, $item['recharge_type']);
-                $item->withdrawType = RechargeChannelModel::getChannel(2, $item['withdraw_type']);
-                $item->activityType = RechargeChannelModel::getChannel(3, $item['activity_type']);
+                $item->rechargeTypes = $item['recharge_type'] ? RechargeChannelModel::getChannel(1, $item['recharge_type']) : [];
+                $item->withdrawTypes = $item['withdraw_type'] ? RechargeChannelModel::getChannel(2, $item['withdraw_type']) : [];
+                $item->activityTypes = $item['activity_type'] ? RechargeChannelModel::getChannel(3, $item['activity_type']) : [];
             }
         } catch (Exception $e) {
             return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
@@ -58,7 +58,6 @@ class RechargeChannel extends Controller
                 'activity_type' => ['nullable','array'],
             ]);
             
-            $params['type'] = implode(',', $params['type']);
             if (empty($params['id'])) {
                 RechargeChannelGroup::create($params);
             } else {

+ 26 - 1
app/Http/Controllers/admin/Withdraw.php

@@ -48,13 +48,14 @@ class Withdraw extends Controller
             $params = request()->validate([
                 'page' => ['nullable', 'integer', 'min:1'],
                 'limit' => ['nullable', 'integer', 'min:1'],
+                'type' => ['nullable', 'integer'],
                 'member_id' => ['nullable', 'string', 'min:1'],
                 'status' => ['nullable', 'integer', 'min:0', 'max:3'],
                 'first_name' => ['nullable'],
             ]);
             $page = request()->input('page', 1);
             $limit = request()->input('limit', 10);
-            $params['type'] = 2;
+            $params['type'] = $params['type'] ?? 2;
             
             $query = PaymentOrder::join('users', 'users.member_id', '=', 'payment_orders.member_id')
                         ->select("payment_orders.*", "users.first_name","users.admin_note as user_admin_note");
@@ -210,4 +211,28 @@ class Withdraw extends Controller
         }
         return $this->success();
     }
+
+    //设置提现订单是否加锁
+    public function setIsLocked()
+    {
+        DB::beginTransaction();
+        try {
+            $params = request()->validate([
+                'ids' => ['required', 'array', 'min:1', 'max:20'],
+                'ids.*' => ['required', 'integer', 'min:1'],
+                'is_locked' => ['required', 'integer', 'in:1,0'],
+            ]);
+            foreach ($params['ids'] as $id) {
+                $count += WithdrawModel::whereIn('id',$id)->update('is_locked',$params['is_locked']);
+            }
+            DB::commit();
+        } catch (ValidationException $e) {
+            DB::rollBack();
+            return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
+        } catch (Exception $e) {
+            DB::rollBack();
+            return $this->error($e->getCode(), $e->getMessage());
+        }
+        return $this->success();
+    }
 }

+ 39 - 1
app/Http/Controllers/api/Wallet.php

@@ -61,7 +61,15 @@ class Wallet extends BaseController
             if ($params['payment_type'] == 'rgcz') {
                 return $this->error('参数有误');
             }
+            
             $member_id = request()->user->member_id;
+            $user = User::where('member_id', $member_id)->first();
+            //校验是否支持此充值方式
+            $check  = RechargeChannel::checkRechargeChannel($params['payment_type'], $user->recharge_channel_group_id);
+            if ($check === false) {
+                throw new Exception(lang("不支持此充值方式").$user->recharge_channel_group_id);
+            }
+            
             $res = PaymentOrderService::createPay($member_id, $params['amount'], $params['payment_type']);
             if ($res['code'] == 0) { 
                 return $this->success($res);
@@ -130,7 +138,15 @@ class Wallet extends BaseController
                 'toAddress' => ['required', 'string'],
                 'image' => ['required', 'url'],
             ]);
+
             $member_id = request()->user->member_id;
+            $user = User::where('member_id', $member_id)->first();
+
+            //校验是否支持此充值方式
+            $check  = RechargeChannel::checkRechargeChannel('usdt', $user->recharge_channel_group_id);
+            if ($check === false) {
+                throw new Exception(lang("不支持此充值方式"));
+            }
             $recharge = new Recharge();
             $recharge->member_id = $member_id;
             $recharge->net = $params['net'];
@@ -159,6 +175,15 @@ class Wallet extends BaseController
                 'amount' => ['required', 'numeric', 'min:0.01'],
                 'payment_type' => ['required', 'integer'],
             ]);
+            
+            $member_id = request()->user->member_id;
+            $user = User::where('member_id', $member_id)->first();
+
+            //校验是否支持此充值方式
+            $check  = RechargeChannel::checkRechargeChannel('rgcz', $user->recharge_channel_group_id);
+            if ($check === false) {
+                throw new Exception(lang("不支持此充值方式"));
+            }
 
             $data = [];
             $data['type'] = PaymentOrderService::TYPE_SELF_PAY;
@@ -240,7 +265,12 @@ class Wallet extends BaseController
             if (!password_verify($params['safe_word'], $user->payment_password)) {
                 throw new Exception(lang('资金密码错误'));
             }
-              
+
+            //校验是否支持此提现方式
+            $check  = RechargeChannel::checkWithdrawChannel('usdt', $user->recharge_channel_group_id);
+            if ($check === false) {
+                throw new Exception(lang("不支持此提现方式"));
+            }
             $serviceCharge = (new WithdrawService())->serviceCharge;
             $amount = $params['amount'];
             $address = $params['address'];
@@ -312,7 +342,15 @@ class Wallet extends BaseController
             if (!password_verify($params['safe_word'], $user->payment_password)) {
                 throw new Exception(lang('资金密码错误'));
             }
+            
+            //校验是否支持此提现方式
+            $check  = RechargeChannel::checkWithdrawChannel($params['channel'], $user->recharge_channel_group_id);
+            if ($check === false) {
+                throw new Exception(lang("不支持此提现方式"));
+            }
+            
             if ($params['channel'] == 'rgtx') {
+                
                 DB::beginTransaction();
                 $amount = $params['amount'];
                 try {

+ 1 - 1
app/Models/PaymentOrder.php

@@ -16,7 +16,7 @@ class PaymentOrder extends BaseModel
 {
 
     protected $table = 'payment_orders';
-    protected $fillable = ['type', 'order_no', 'member_id', 'amount', 'channel', 'admin_note','bank_name', 'account', 'card_no', 'status', 'callback_url', 'callback_data', 'remark', 'pay_no', 'pay_url', 'pay_data', 'fee', 'payment_type', 'is_send'];
+    protected $fillable = ['type', 'order_no', 'member_id', 'amount', 'channel', 'admin_note','bank_name', 'account', 'card_no', 'status', 'callback_url', 'callback_data', 'remark', 'pay_no', 'pay_url', 'pay_data', 'fee', 'payment_type', 'is_send', 'is_locked'];
     protected $hidden = [];
     // // 添加这个
     // protected $visible = [

+ 27 - 6
app/Models/RechargeChannel.php

@@ -50,16 +50,17 @@ class RechargeChannel extends BaseModel
             $field = 'activity_type';
         } 
         $type = RechargeChannelGroup::where('id', $recharge_channel_group_id)->value($field);
-        if ($type) {
-            $query = $query->whereIn($field, $type);
+        if (!$type) {
+            return [];
         }
+        $query = $query->whereIn('type', $type);
         
         $product = $query->orderBy('sort', 'asc')->select(['id', 'data_type','name','type', 'min','max','fixed','rate'])->get()->toArray();
         
         $list = [];
         foreach($product as $key => $pv) {
-            if (isset($list[$pv[$field]]['config'])) {
-                $config = $list[$pv[$field]]['config'];
+            if (isset($list[$pv['type']]['config'])) {
+                $config = $list[$pv['type']]['config'];
                 if (empty($config['range'])) {
                     $config['range'][] = $config;
                 }
@@ -81,10 +82,10 @@ class RechargeChannel extends BaseModel
                 $config = $pv;
             }
             
-            $list[$pv[$field]] = [
+            $list[$pv['type']] = [
                 'key' => $key,
                 'label' => lang($pv['name']),
-                'value' => $pv[$field],
+                'value' => $pv['type'],
                 'config' => $config ?? [],
             ];
         }
@@ -92,4 +93,24 @@ class RechargeChannel extends BaseModel
     
         return array_values($list);
     }
+    
+    //校验是否支持此提现方式
+    public static function checkWithdrawChannel($type, $recharge_channel_group_id = 1) {
+        $withdraw_type = RechargeChannelGroup::where('id', $recharge_channel_group_id)->value('withdraw_type');
+        if (in_array($type, $withdraw_type)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+    
+    //校验是否支持此充值方式
+    public static function checkRechargeChannel($type, $recharge_channel_group_id = 1) {
+        $recharge_type = RechargeChannelGroup::where('id', $recharge_channel_group_id)->value('recharge_type');
+        if (in_array($type, $recharge_type)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
 }

+ 3 - 3
app/Models/RechargeChannelGroup.php

@@ -15,7 +15,7 @@ class RechargeChannelGroup extends BaseModel
     }
 
     // 设置器:将数组转为逗号分隔字符串
-    public function setRechargeAttribute($value)
+    public function setRechargeTypeAttribute($value)
     {
         $this->attributes['recharge_type'] = is_array($value) ? implode(',', $value) : $value;
     }
@@ -25,7 +25,7 @@ class RechargeChannelGroup extends BaseModel
         return $value ? explode(',', $value) : []; 
     }
 
-    public function setWithdrawAttribute($value)
+    public function setWithdrawTypeAttribute($value)
     {
         $this->attributes['withdraw_type'] = is_array($value) ? implode(',', $value) : $value;
     }
@@ -34,7 +34,7 @@ class RechargeChannelGroup extends BaseModel
         return $value ? explode(',', $value) : []; 
     }
 
-    public function setActivityAttribute($value)
+    public function setActivityTypeAttribute($value)
     {
         if (!$value)
             return '';

+ 1 - 1
app/Models/Withdraw.php

@@ -8,7 +8,7 @@ class Withdraw extends BaseModel
 {
 
     protected $table = 'withdraws';
-    protected $fillable = ['member_id', 'amount', 'service_charge', 'to_account', 'address', 'exchange_rate', 'status', 'after_balance', 'remark', 'admin_note'];
+    protected $fillable = ['member_id', 'amount', 'service_charge', 'to_account', 'address', 'exchange_rate', 'status', 'after_balance', 'remark', 'admin_note', 'is_locked'];
     protected $hidden = [];
 
     public function member(): BelongsTo

+ 6 - 0
lang/en/messages.php

@@ -459,4 +459,10 @@ return [
     '提现不能少于' => 'Withdrawal Cannot Be Less Than ',
     '余额不足' => 'Insufficient Balance',
     '充值类型错误' => 'Recharge Type Error',
+    '待处理中,请稍后' => 'Waiting For Processing',
+    '提交成功,请等待人工审核' => 'Submit Success, Please Wait For Manual Review',
+    '提交成功,请等待人工回复' => 'Submit Success, Please Wait For Manual Reply',
+    '请选择提现类型' => 'Please Select Withdrawal Type',
+    '不支持此充值方式' => 'Not Support This Recharge Type', 
+    '不支持此提现方式' =>  'Not Support This Withdrawal Type',
 ];

+ 6 - 0
lang/vi/messages.php

@@ -459,4 +459,10 @@ return [
     '提现不能少于' => 'Số tiền rút tối thiểu là ',
     '余额不足' => 'Số tiền không đủ',
     '充值类型错误' => 'Loại nạp không đúng',
+    '待处理中,请稍后' => 'Đang xử lý, vui lòng chờ',
+    '提交成功,请等待人工审核' => 'Gửi thành công, vui lòng chờ xử lý',
+    '提交成功,请等待人工回复' => 'Gửi thành công, vui lòng chờ phản hồi',
+    '请选择提现类型' => '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',
 ];

+ 3 - 0
lang/zh/messages.php

@@ -462,4 +462,7 @@ return [
     '待处理中,请稍后' => '待处理中,请稍后',
     '提交成功,请等待人工审核' => '提交成功,请等待人工审核',
     '提交成功,请等待人工回复' => '提交成功,请等待人工回复',
+    '请选择提现类型' => '请选择提现类型',
+    '不支持此充值方式' => '不支持此充值方式',
+    '不支持此提现方式' => '不支持此提现方式',
 ];

+ 2 - 0
routes/admin.php

@@ -99,6 +99,7 @@ Route::middleware(['admin.jwt'])->group(function () {
             Route::post('/audit', [PaymentOrder::class, 'audit']);
             Route::post('/setPayData', [PaymentOrder::class, 'setPayData']);
             Route::post('/manual‌Audit', [PaymentOrder::class, 'manual‌Audit']);
+            Route::post('/setIsLocked', [PaymentOrder::class, 'setIsLocked']);
             
         });
 
@@ -151,6 +152,7 @@ Route::middleware(['admin.jwt'])->group(function () {
             Route::post('setStatus', [Withdraw::class, 'setStatus']);
             Route::post('/setNote', [Withdraw::class, 'setNote']);
             Route::post('/setRmbNote', [Withdraw::class, 'setRmbNote']);
+            Route::post('/setIsLocked', [Withdraw::class, 'setIsLocked']);
 
 
         });