Ken 2 天之前
父节点
当前提交
fde1089fc2
共有 1 个文件被更改,包括 81 次插入0 次删除
  1. 81 0
      app/Http/Controllers/api/NewPc.php

+ 81 - 0
app/Http/Controllers/api/NewPc.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers\api;
 
+use App\Models\PcCao;
 use App\Models\PcCaoHistory;
 use App\Models\PcIssue;
 use App\Models\PcPrediction;
@@ -229,4 +230,84 @@ class NewPc extends BaseController
         }
         return $this->success($res);
     }
+
+    /**
+     * @api {get} /newPc/cao 统计,历史
+     * @apiGroup newPc
+     * @apiVersion 1.0.0
+     *
+     * @apiSuccess {int} code
+     * @apiSuccess {int} timestamp
+     * @apiSuccess {String} msg
+     * @apiSuccess {Object} data
+     * @apiSuccess {int} data.total 总期数
+     * @apiSuccess {Object[]} data.list 列表
+     *
+     */
+    public function cao()
+    {
+        $type = [1, 2, 3, 4];
+        $list = [];
+        $list['dxds'] = PcCao::whereIn('id', $type)->get();
+        $type = [5, 6, 7, 8];
+        $list['zh'] = PcCao::whereIn('id', $type)->get();
+        $type = [9, 10];
+        $list['jz'] = PcCao::whereIn('id', $type)->get();
+        $list['hb'] = [
+            ['field' => '2.8回本', 'val' => 0],
+            ['field' => '3.2回本', 'val' => 0],
+        ];
+        $type = [11, 12, 13];
+        $list['bsd'] = PcCao::whereIn('id', $type)->get();
+        $list['ddsz'] = PcCao::where('id', '>=', 14)
+            ->where('id', '<=', 41)
+            ->orderBy('id')
+            ->get();
+        $list['tslx'] = [
+            ['field' => '龙', 'val' => 0],
+            ['field' => '虎', 'val' => 0],
+            ['field' => '合', 'val' => 0],
+            ['field' => '鸡', 'val' => 0],
+            ['field' => '鸭', 'val' => 0],
+            ['field' => '狗', 'val' => 0],
+        ];
+        $list['zbtj'] = [
+            ['field' => '中', 'val' => 0],
+            ['field' => '边', 'val' => 0],
+            ['field' => '大边', 'val' => 0],
+            ['field' => '小边', 'val' => 0],
+        ];
+        $list['wei_shu'] = PcCao::where('id', '>=', 42)
+            ->where('id', '<=', 49)
+            ->get();
+        $list['san_jun'] = [
+            ['field' => '三军0点', 'val' => 0],
+            ['field' => '三军1点', 'val' => 0],
+            ['field' => '三军2点', 'val' => 0],
+            ['field' => '三军3点', 'val' => 0],
+            ['field' => '三军4点', 'val' => 0],
+            ['field' => '三军5点', 'val' => 0],
+            ['field' => '三军6点', 'val' => 0],
+            ['field' => '三军7点', 'val' => 0],
+            ['field' => '三军8点', 'val' => 0],
+            ['field' => '三军9点', 'val' => 0],
+        ];
+        $list['qu_a'] = PcCao::where('id', '>=', 50)
+            ->where('id', '<=', 63)
+            ->get();
+        $list["qu_b"] = PcCao::where('id', '>=', 64)
+            ->where('id', '<=', 77)
+            ->get();
+        $list["qu_c"] = PcCao::where('id', '>=', 78)
+            ->where('id', '<=', 91)
+            ->get();
+
+        $count = PcCao::whereIn('id', [1, 2])->sum('val');
+        $data = [
+            'total' => intval($count),
+            'list' => $list
+        ];
+
+        return $this->success($data);
+    }
 }