seven 2 주 전
부모
커밋
79898c15c5
3개의 변경된 파일28개의 추가작업 그리고 0개의 파일을 삭제
  1. 23 0
      app/Http/Controllers/admin/Issue.php
  2. 4 0
      app/Services/IssueService.php
  3. 1 0
      routes/admin.php

+ 23 - 0
app/Http/Controllers/admin/Issue.php

@@ -39,6 +39,29 @@ class Issue extends Controller
         return $this->success($result);
     }
 
+    /**
+     * @description: 异常分页数据
+     * @return {*}
+     */    
+    function abnormal()
+    {
+        try {
+            request()->validate([
+                'issue_no' => ['nullable', 'string'],
+                'id' => ['nullable', 'string'],
+                'status' => ['nullable', 'string'],
+            ]);
+            $search = request()->all();
+            $search['abnormal'] = 1;
+            $result = IssueService::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 {*}

+ 4 - 0
app/Services/IssueService.php

@@ -63,6 +63,10 @@ class IssueService extends BaseService
         if (isset($search['status']) && !empty($search['status'])) {
             $where[] = ['status', '=', $search['status']];
         }
+        if(isset($search['abnormal']) && !empty($search['abnormal'])){
+            $where[] = ['end_time' ,'<' ,date('Y-m-d H:i:s',time() - 1800)];
+            $where[] = ['status' ,'!=' ,self::model()::STATUS_DRAW];
+        }
         return $where;
     }
 

+ 1 - 0
routes/admin.php

@@ -76,6 +76,7 @@ Route::middleware(['admin.jwt'])->group(function () {
         // 期数路由
         Route::prefix('/issue')->group(function () {
             Route::get('/', [Issue::class, 'index']);
+            Route::get('/abnormal', [Issue::class, 'abnormal']);
             Route::post('/submit', [Issue::class, 'store']);
             Route::post('/betting', [Issue::class, 'betting']);
             Route::post('/close', [Issue::class, 'close']);