|
@@ -0,0 +1,88 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+
|
|
|
|
|
+namespace App\Http\Controllers\admin;
|
|
|
|
|
+
|
|
|
|
|
+use App\Http\Controllers\Controller;
|
|
|
|
|
+use App\Models\LhcOrder as LhcOrderModel;
|
|
|
|
|
+use Exception;
|
|
|
|
|
+use App\Constants\HttpStatus;
|
|
|
|
|
+
|
|
|
|
|
+class LhcOrder extends Controller
|
|
|
|
|
+{
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 订单列表
|
|
|
|
|
+ */
|
|
|
|
|
+ public function list()
|
|
|
|
|
+ {
|
|
|
|
|
+ try {
|
|
|
|
|
+ $params = request()->validate([
|
|
|
|
|
+ 'page' => ['nullable', 'integer', 'min:1'],
|
|
|
|
|
+ 'limit' => ['nullable', 'integer', 'min:1'],
|
|
|
|
|
+ 'issue' => ['nullable', 'string'],
|
|
|
|
|
+ 'ordernum' => ['nullable', 'string'],
|
|
|
|
|
+ 'member_id' => ['nullable', 'integer'],
|
|
|
|
|
+ 'game' => ['nullable', 'string'],
|
|
|
|
|
+ 'gameplay' => ['nullable', 'string'],
|
|
|
|
|
+ 'number' => ['nullable'],
|
|
|
|
|
+ 'lottery_status' => ['nullable', 'integer'],
|
|
|
|
|
+ 'is_faker' => ['nullable', 'integer'],
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $page = request()->input('page', 1);
|
|
|
|
|
+ $limit = request()->input('limit', 15);
|
|
|
|
|
+
|
|
|
|
|
+ $query = new LhcOrderModel();
|
|
|
|
|
+ if (!empty($params['issue'])) {
|
|
|
|
|
+ $query->where('issue', $params['issue']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($params['ordernum'])) {
|
|
|
|
|
+ $query->where('ordernum', $params['ordernum']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($params['member_id'])) {
|
|
|
|
|
+ $query->where('member_id', $params['member_id']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($params['lottery_status']) && $params['lottery_status'] !== null) {
|
|
|
|
|
+ $query->where('lottery_status', $params['lottery_status']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isset($params['is_faker']) && $params['is_faker'] !== null) {
|
|
|
|
|
+ $query->where('is_faker', $params['is_faker']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($params['game'])) {
|
|
|
|
|
+ $query->where('game', $params['game']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($params['gameplay'])) {
|
|
|
|
|
+ $query->where('gameplay', $params['gameplay']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!empty($params['number'])) {
|
|
|
|
|
+ $query->where('number', $params['number']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $count = $query->count();
|
|
|
|
|
+ $list = $query
|
|
|
|
|
+ ->forPage($page, $limit)
|
|
|
|
|
+ ->orderByDesc('created_at')
|
|
|
|
|
+ ->get();
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return $this->success(['total' => $count, 'data' => $list]);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //订单详情
|
|
|
|
|
+ function info()
|
|
|
|
|
+ {
|
|
|
|
|
+ try {
|
|
|
|
|
+ request()->validate([
|
|
|
|
|
+ 'id' => ['required', 'integer'],
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $id = request()->input('id');
|
|
|
|
|
+ $order = LhcOrderModel::where('id', $id)->first();
|
|
|
|
|
+ if (!$order) throw new Exception('订单不存在');
|
|
|
|
|
+ $order = $order->toArray();
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return $this->success($order);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|