Parcourir la source

Merge branch 'dev'

lip il y a 9 heures
Parent
commit
add7e671be

+ 41 - 0
app/Console/Commands/PaymentOrder.php

@@ -0,0 +1,41 @@
+<?php
+
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use App\Models\PaymentOrder as PaymentOrderModel;
+
+
+class PaymentOrder extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'payment:order';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = '人工提现/人工充值订单24小时未处理的自动失败';
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        //人工充值/提现订单
+        $list = PaymentOrderModel::whereIn('status', [0,1,5])->whereIn('type', [3,4])->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-1 day')))->limit(200)->get();
+        foreach ($list as $item) {
+            $item->status = 3;
+            $item->remark = '超时未处理,自动失败';
+            $item->save();
+        }
+    }
+}

+ 9 - 8
app/Http/Controllers/admin/PaymentOrder.php

@@ -22,18 +22,18 @@ class PaymentOrder extends Controller
     public function unProcessed()
     {
         //USDT充值订单
-        $data['usdtRecharge'] = (int)Recharge::where('status', 0)->count();
+        $data['usdtRecharge'] = (int)Recharge::where('status', 0)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-1 day')))->count();
         //人工充值订单
-        $data['rgRecharge'] = (int)PaymentOrderModel::whereIn('status', [0,1,5])->where('type', 3)->count();
+        $data['rgRecharge'] = (int)PaymentOrderModel::whereIn('status', [0,1,5])->where('type', 3)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-1 day')))->count();
         //人民币充值订单
-        $data['rmbRecharge'] = (int)PaymentOrderModel::whereIn('status', [0,1])->where('type', 1)->count();
+        $data['rmbRecharge'] = (int)PaymentOrderModel::whereIn('status', [0,1])->where('type', 1)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-1 day')))->count();
         
         //USDT提现订单
-        $data['usdtWithdraw'] = (int)Withdraw::where('status', 0)->count();
+        $data['usdtWithdraw'] = (int)Withdraw::where('status', 0)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-1 day')))->count();
         //人工提现订单
-        $data['rgWithdraw'] = (int)PaymentOrderModel::where('status', 0)->where('type', 4)->count();
+        $data['rgWithdraw'] = (int)PaymentOrderModel::where('status', 0)->where('type', 4)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-1 day')))->count();
         //人民币提现订单
-        $data['rmbWithdraw'] = (int)PaymentOrderModel::where('status', 0)->where('type', 2)->count();
+        $data['rmbWithdraw'] = (int)PaymentOrderModel::where('status', 0)->where('type', 2)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-1 day')))->count();
         return $this->success($data);
     }
 
@@ -74,12 +74,13 @@ class PaymentOrder extends Controller
         DB::beginTransaction();
         try {
             $params = request()->validate([
-                'id' => ['required'],
+                'ids' => ['required', 'array', 'min:1'],
+                'ids.*' => ['required', 'integer', 'min:1'],
                 'status' => ['required', 'integer', 'in:2,3'],
                 'remark' => ['nullable', 'string'],
             ]);
             $remark = $params['remark'] ?? '';
-            $ids = is_array($params['id']) ? $params['id'] : [$params['id']];
+            $ids = is_array($params['ids']) ? $params['ids'] : [$params['ids']];
             foreach($ids as $id) {
                 $info = PaymentOrderModel::find($id);
                 if (!$info) throw new Exception('数据不存在', HttpStatus::CUSTOM_ERROR);

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

@@ -53,10 +53,10 @@ class SportGameOrder extends Controller
                 $query = $query->where('sport_game_order.status', $params['status']);
             }
             if (!empty($params['game_name'])) {
-                $query = $query->where('sport_game.name|sport_game.name_en', 'like', '%'.$params['game_name'].'%');
+                $query = $query->where('sport_game.name', 'like', '%'.$params['game_name'].'%');
             }
             if (!empty($params['gameplay_name'])) {
-                $query = $query->where('sport_gameplay.name|sport_gameplay.name_en', 'like', '%'.$params['gameplay_name'].'%');
+                $query = $query->where('sport_gameplay.name', 'like', '%'.$params['gameplay_name'].'%');
             }
             if (!empty($params['first_name'])) {
                 $query = $query->where('users.first_name', 'like', "%{$params['first_name']}%");

+ 1 - 1
app/Services/PaymentOrderService.php

@@ -506,7 +506,7 @@ class PaymentOrderService extends BaseService
     {
         try {
             $order = PaymentOrder::where('id', $orderId)
-                ->where('type', 2)
+                ->whereIn('type', [2,4])
                 ->where('status', self::STATUS_STAY)
                 ->first();
             if (!$order) throw new Exception("订单不存在_{$orderId}", HttpStatus::CUSTOM_ERROR);