|
|
@@ -0,0 +1,48 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Http\Controllers\admin;
|
|
|
+
|
|
|
+use App\Constants\HttpStatus;
|
|
|
+use App\Http\Controllers\Controller;
|
|
|
+use Illuminate\Validation\ValidationException;
|
|
|
+use Exception;
|
|
|
+use App\Models\PcIssue as PcIssueModel;
|
|
|
+
|
|
|
+class PcIssue extends Controller
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * @api {get} /admin/pcIssue 极速28
|
|
|
+ * @apiGroup 极速28
|
|
|
+ *
|
|
|
+ * @apiUse result
|
|
|
+ * @apiUse header
|
|
|
+ * @apiVersion 1.0.0
|
|
|
+ *
|
|
|
+ * @apiParam {int} [page=1]
|
|
|
+ * @apiParam {int} [limit=10]
|
|
|
+ * @apiParam {string} [issue_no] 期号
|
|
|
+ */
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $search = request()->validate([
|
|
|
+ 'page' => ['nullable', 'integer', 'min:1'],
|
|
|
+ 'limit' => ['nullable', 'integer', 'min:1'],
|
|
|
+ 'issue_no' => ['nullable', 'string'],
|
|
|
+ ]);
|
|
|
+ $page = request()->input('page', 1);
|
|
|
+ $limit = request()->input('limit', 15);
|
|
|
+
|
|
|
+ $result['total'] = PcIssueModel::where(PcIssueModel::getWhere($search))->count();
|
|
|
+ $result['data'] = PcIssueModel::where(PcIssueModel::getWhere($search))
|
|
|
+ ->orderByDesc('id')->forPage($page, $limit)->get();
|
|
|
+ } catch (ValidationException $e) {
|
|
|
+ return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
|
|
|
+ } catch (Exception $e) {
|
|
|
+ return $this->error(intval($e->getCode()));
|
|
|
+ }
|
|
|
+ return $this->success($result);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|