|
|
@@ -6,6 +6,10 @@ use App\Http\Controllers\Controller;
|
|
|
use App\Models\LhcOrder as LhcOrderModel;
|
|
|
use App\Models\FundsRecord;
|
|
|
use App\Models\Wallet;
|
|
|
+use App\Models\LhcLottery;
|
|
|
+use App\Models\PcIssue;
|
|
|
+use App\Models\Issue;
|
|
|
+use App\Models\JisuLottery;
|
|
|
use Exception;
|
|
|
use App\Constants\HttpStatus;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
@@ -74,11 +78,47 @@ class LhcOrder extends Controller
|
|
|
$query = $query->where('users.first_name', 'like', "%{$params['first_name']}%");
|
|
|
}
|
|
|
$count = $query->count();
|
|
|
- $list = $query->with(['lottery'])
|
|
|
- ->select('lhc_order.*','users.first_name','users.member_id')
|
|
|
+ $list = $query->select('lhc_order.*','users.first_name','users.member_id')
|
|
|
->forPage($page, $limit)
|
|
|
->orderByDesc('lhc_order.created_at')
|
|
|
->get();
|
|
|
+ foreach($list as &$info) {
|
|
|
+ //六合彩彩票
|
|
|
+ if ($info['type'] >= 1 and $info['type'] <= 4) {
|
|
|
+ $lottery = LhcLottery::where('type', $info['type'])->where('issue', $info['issue'])->first();
|
|
|
+ if ($lottery) {
|
|
|
+ $info['lottery'] = [
|
|
|
+ 'open_code' => $lottery->open_code,
|
|
|
+ 'open_code_other' => ''
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //28
|
|
|
+ if ($info['type'] == 5 || $info['type'] == 6) {
|
|
|
+ if ($info['type'] == 6) {
|
|
|
+ $issue = PcIssue::where('issue_no', $info['issue'])->first();
|
|
|
+ } elseif ($info['type'] == 5) {
|
|
|
+ $issue = Issue::where('issue_no', $info['issue'])->first();
|
|
|
+ }
|
|
|
+
|
|
|
+ $info['lottery'] = [
|
|
|
+ 'open_code' => $issue->winning_numbers,
|
|
|
+ 'open_code_other' => $issue->combo
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ //极速彩票
|
|
|
+ if ($info['type'] >= 7 and $info['type'] <= 13) {
|
|
|
+ $lottery = JisuLottery::where('type', $info['type'] - 6)->where('issue', $info['issue'])->first();
|
|
|
+ if ($lottery) {
|
|
|
+ $info['lottery'] = [
|
|
|
+ 'open_code' => $lottery->open_code,
|
|
|
+ 'open_code_other' => $lottery->open_code_other
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception $e) {
|
|
|
return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
|
|
|
}
|
|
|
@@ -94,13 +134,50 @@ class LhcOrder extends Controller
|
|
|
'id' => ['required', 'integer'],
|
|
|
]);
|
|
|
$id = request()->input('id');
|
|
|
- $order = LhcOrderModel::with(['lottery'])->where('id', $id)->first();
|
|
|
- if (!$order) throw new Exception('订单不存在');
|
|
|
- $order = $order->toArray();
|
|
|
+ $info = LhcOrderModel::where('id', $id)->first();
|
|
|
+ if (!$info) throw new Exception('订单不存在');
|
|
|
+ $info = $info->toArray();
|
|
|
+
|
|
|
+ //六合彩彩票
|
|
|
+ if ($info['type'] >= 1 and $info['type'] <= 4) {
|
|
|
+ $lottery = LhcLottery::where('type', $info['type'])->where('issue', $info['issue'])->first();
|
|
|
+ if ($lottery) {
|
|
|
+ $info['lottery'] = [
|
|
|
+ 'open_code' => $lottery->open_code,
|
|
|
+ 'open_code_other' => ''
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //28
|
|
|
+ if ($info['type'] == 5 || $info['type'] == 6) {
|
|
|
+ if ($info['type'] == 6) {
|
|
|
+ $issue = PcIssue::where('issue_no', $info['issue'])->first();
|
|
|
+ } elseif ($info['type'] == 5) {
|
|
|
+ $issue = Issue::where('issue_no', $info['issue'])->first();
|
|
|
+ }
|
|
|
+
|
|
|
+ $info['lottery'] = [
|
|
|
+ 'open_code' => $issue->winning_numbers,
|
|
|
+ 'open_code_other' => $issue->combo
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ //极速彩票
|
|
|
+ if ($info['type'] >= 7 and $info['type'] <= 13) {
|
|
|
+ $lottery = JisuLottery::where('type', $info['type'] - 6)->where('issue', $info['issue'])->first();
|
|
|
+ if ($lottery) {
|
|
|
+ $info['lottery'] = [
|
|
|
+ 'open_code' => $lottery->open_code,
|
|
|
+ 'open_code_other' => $lottery->open_code_other
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
} catch (Exception $e) {
|
|
|
return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
|
|
|
}
|
|
|
- return $this->success($order);
|
|
|
+ return $this->success($info);
|
|
|
}
|
|
|
|
|
|
/**
|