lip 1 неделя назад
Родитель
Сommit
4774d67ec6
2 измененных файлов с 102 добавлено и 7 удалено
  1. 83 6
      app/Http/Controllers/admin/LhcOrder.php
  2. 19 1
      app/Models/LhcOrder.php

+ 83 - 6
app/Http/Controllers/admin/LhcOrder.php

@@ -6,6 +6,10 @@ use App\Http\Controllers\Controller;
 use App\Models\LhcOrder as LhcOrderModel;
 use App\Models\FundsRecord;
 use App\Models\Wallet;
+use App\Models\LhcLottery;
+use App\Models\PcIssue;
+use App\Models\Issue;
+use App\Models\JisuLottery;
 use Exception;
 use App\Constants\HttpStatus;
 use Illuminate\Support\Facades\DB;
@@ -74,11 +78,47 @@ class LhcOrder extends Controller
                 $query = $query->where('users.first_name', 'like', "%{$params['first_name']}%");
             }
             $count = $query->count();
-            $list = $query->with(['lottery'])
-                ->select('lhc_order.*','users.first_name','users.member_id')
+            $list = $query->select('lhc_order.*','users.first_name','users.member_id')
                 ->forPage($page, $limit)
                 ->orderByDesc('lhc_order.created_at')
                 ->get();
+            foreach($list as &$info) {
+                //六合彩彩票
+                if ($info['type'] >= 1 and $info['type'] <= 4) {
+                    $lottery = LhcLottery::where('type', $info['type'])->where('issue', $info['issue'])->first();
+                    if ($lottery) {
+                        $info['lottery'] = [
+                            'open_code' => $lottery->open_code,
+                            'open_code_other' => ''
+                        ];
+                    }
+                }
+
+                //28
+                if ($info['type'] == 5 || $info['type'] == 6) {
+                    if ($info['type'] == 6) {
+                        $issue = PcIssue::where('issue_no', $info['issue'])->first();
+                    } elseif ($info['type'] == 5)  {
+                        $issue = Issue::where('issue_no', $info['issue'])->first();
+                    }
+
+                    $info['lottery'] = [
+                        'open_code' => $issue->winning_numbers,
+                        'open_code_other' => $issue->combo
+                    ];
+                }
+
+                //极速彩票
+                if ($info['type'] >= 7 and $info['type'] <= 13) {
+                    $lottery = JisuLottery::where('type', $info['type'] - 6)->where('issue', $info['issue'])->first();
+                    if ($lottery) {
+                        $info['lottery'] = [
+                            'open_code' => $lottery->open_code,
+                            'open_code_other' => $lottery->open_code_other
+                        ];
+                    }
+                }
+            }
         } catch (Exception $e) {
             return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
         }
@@ -94,13 +134,50 @@ class LhcOrder extends Controller
                 'id' => ['required', 'integer'],
             ]);
             $id = request()->input('id');
-            $order = LhcOrderModel::with(['lottery'])->where('id', $id)->first();
-            if (!$order) throw new Exception('订单不存在');
-            $order = $order->toArray();
+            $info = LhcOrderModel::where('id', $id)->first();
+            if (!$info) throw new Exception('订单不存在');
+            $info = $info->toArray();
+
+            //六合彩彩票
+            if ($info['type'] >= 1 and $info['type'] <= 4) {
+                $lottery = LhcLottery::where('type', $info['type'])->where('issue', $info['issue'])->first();
+                if ($lottery) {
+                    $info['lottery'] = [
+                        'open_code' => $lottery->open_code,
+                        'open_code_other' => ''
+                    ];
+                }
+            }
+
+            //28
+            if ($info['type'] == 5 || $info['type'] == 6) {
+                if ($info['type'] == 6) {
+                    $issue = PcIssue::where('issue_no', $info['issue'])->first();
+                } elseif ($info['type'] == 5)  {
+                    $issue = Issue::where('issue_no', $info['issue'])->first();
+                }
+
+                $info['lottery'] = [
+                    'open_code' => $issue->winning_numbers,
+                    'open_code_other' => $issue->combo
+                ];
+            }
+
+            //极速彩票
+            if ($info['type'] >= 7 and $info['type'] <= 13) {
+                $lottery = JisuLottery::where('type', $info['type'] - 6)->where('issue', $info['issue'])->first();
+                if ($lottery) {
+                    $info['lottery'] = [
+                        'open_code' => $lottery->open_code,
+                        'open_code_other' => $lottery->open_code_other
+                    ];
+                }
+            }
+
         } catch (Exception $e) {
             return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
         }
-        return $this->success($order);
+        return $this->success($info);
     }
 
     /**

+ 19 - 1
app/Models/LhcOrder.php

@@ -26,7 +26,25 @@ class LhcOrder extends BaseModel
             return '澳门六合彩';
         } elseif ($type == 4) {
             return '极速六合彩';
-        } 
+        } elseif ($type == 5) {
+            return '加拿大28';
+        } elseif ($type == 6) {
+            return '极速28';
+        } elseif ($type == 7) {
+            return '极速赛车';
+        } elseif ($type == 8) {
+            return '极速时时彩';
+        } elseif ($type == 9) {
+            return '极速飞艇';
+        } elseif ($type == 10) {
+            return 'SG时时彩';
+        } elseif ($type == 11) {
+            return 'SG飞艇';
+        } elseif ($type == 12) {
+            return '极速快3';
+        } elseif ($type == 13) {
+            return 'SG快3';
+        }
         return '';
     }