seven 14 시간 전
부모
커밋
eb60ec2310
2개의 변경된 파일147개의 추가작업 그리고 0개의 파일을 삭제
  1. 142 0
      app/Http/Controllers/admin/Bet.php
  2. 5 0
      routes/admin.php

+ 142 - 0
app/Http/Controllers/admin/Bet.php

@@ -0,0 +1,142 @@
+<?php
+
+namespace App\Http\Controllers\admin;
+
+use App\Constants\HttpStatus;
+use App\Http\Controllers\Controller;
+use App\Services\BetService;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Validation\ValidationException;
+use Exception;
+
+class Bet extends Controller
+{
+    /**
+     * @description: 分页数据
+     * @return {*}
+     */    
+    function index()
+    {
+        try {
+            request()->validate([
+                'issue_no' => ['nullable', 'string'],
+                'member_id' => ['nullable', 'string'],
+                'id' => ['nullable', 'string'],
+                'status' => ['nullable', 'string'],
+            ]);
+            $search = request()->all();
+            $result = BetService::paginate($search);
+        } catch (ValidationException $e) {
+            return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
+        } catch (Exception $e) {
+            return $this->error(intval($e->getCode()));
+        }
+        return $this->success($result);
+    }
+
+    // /**
+    //  * @description: 修改|新增
+    //  * @return {*}
+    //  */    
+    // public function store()
+    // {
+    //     // try {
+    //         $params = request()->all();
+
+    //         $validator = [
+    //             'issue_no' => 'required|string|max:50|alpha_dash|unique:issues,issue_no',
+    //             'winning_numbers' => 'nullable|string|max:100',
+    //             'status' => 'nullable|string',
+    //         ];
+
+    //         request()->validate($validator);
+
+    //         $ret = BetService::submit($params);
+    //         if ($ret['code'] == BetService::NOT) {
+    //             return $this->error($ret['code'], $ret['msg']);
+    //         }
+    //     // } catch (ValidationException $e) {
+    //     //     return $this->error(HttpStatus::VALIDATION_FAILED, '', $e->errors());
+    //     // } catch (Exception $e) {
+    //     //     return $this->error(intval($e->getCode()));
+    //     // }
+    //     return $this->success([], $ret['msg']);
+
+    // }
+
+    // /**
+    //  * @description: 开始
+    //  * @return {*}
+    //  */    
+    // public function betting()
+    // {
+    //     $id = request()->input('id');
+    //     if (!$id) {
+    //         return $this->error(HttpStatus::VALIDATION_FAILED, '参数错误');
+    //     }
+    //     $ret = BetService::betting($id);
+    //     if ($ret['code'] == BetService::NOT) {
+    //         return $this->error($ret['code'], $ret['msg']);
+    //     }
+    //     return $this->success([], $ret['msg']);
+    // }
+
+    // /**
+    //  * @description: 关闭
+    //  * @return {*}
+    //  */    
+    // public function close()
+    // {
+    //     $id = request()->input('id');
+    //     if (!$id) {
+    //         return $this->error(HttpStatus::VALIDATION_FAILED, '参数错误');
+    //     }
+    //     $ret = BetService::closeBetting($id);
+    //     if ($ret['code'] == BetService::NOT) {
+    //         return $this->error($ret['code'], $ret['msg']);
+    //     }
+    //     return $this->success([], $ret['msg']);
+    // }
+    // /**
+    //  * @description: 开奖
+    //  * @return {*}
+    //  */    
+    // public function lotteryDraw()
+    // {
+    //     $id = request()->input('id');
+    //     $winning_numbers = request()->input('winning_numbers');
+    //     $image = request()->input('image');
+    //     $combo = request()->input('combo');
+    //     if (!$id) {
+    //         return $this->error(HttpStatus::VALIDATION_FAILED, '参数错误');
+    //     }
+    //     if (!$winning_numbers) {
+    //         return $this->error(HttpStatus::VALIDATION_FAILED, '参数错误');
+    //     }
+    //     if(explode(',', $winning_numbers) < 3){
+    //         return $this->error(HttpStatus::VALIDATION_FAILED, '开奖号码格式错误');
+    //     }
+    //     $ret = BetService::lotteryDraw($id,$winning_numbers,$combo,$image);
+    //     if ($ret['code'] == BetService::NOT) {
+    //         return $this->error($ret['code'], $ret['msg']);
+    //     }
+    //     return $this->success([], $ret['msg']);
+    // }
+
+    // /**
+    //  * @description: 删除
+    //  */
+    // public function destroy()
+    // {
+    //     $id = request()->post('id');
+    //     // 示例:通过 ID 删除
+    //     $Bet= IssueService::findOne(['id' => $id]);
+    //     if (!$info) {
+    //         return $this->error(0, '期数不存在');
+    //     }
+
+    //     $info->delete();
+
+    //     return $this->success([], '删除成功');
+    // }
+}

+ 5 - 0
routes/admin.php

@@ -18,6 +18,7 @@ use App\Http\Controllers\admin\GameplayRule;
 use App\Http\Controllers\admin\Issue;
 use App\Http\Controllers\admin\Keyboard;
 use App\Http\Controllers\admin\Lottery;
+use App\Http\Controllers\admin\Bet;
 
 
 Route::post('/login', [Admin::class, 'login']);
@@ -62,6 +63,10 @@ Route::middleware(['admin.jwt'])->group(function () {
             Route::post('/lotteryDraw', [Issue::class, 'lotteryDraw']); // 开奖
             Route::post('/delete', [Issue::class, 'destroy']); // 删除
         });
+        // 投注记录
+        Route::prefix('/issue')->group(function () {
+            Route::get('/', [Bet::class, 'index']);
+        });
 
         // 玩法规则路由
         Route::prefix('/gameplayRule')->group(function () {