From fc9a52c9ee2bf34cb3fad971dc21c17c3d4f415d Mon Sep 17 00:00:00 2001 From: jcadmin Date: Sat, 19 Jul 2025 10:32:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=97=E4=BA=AC=E5=8D=95=E5=9C=BA=E6=AF=94?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Api/Customer/MatchController.php | 64 +++++++++++++++++++ app/Model/Zq/BjdcOdds.php | 8 +++ config/queue.php | 2 +- routes/api_customer.php | 1 + 4 files changed, 74 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/Customer/MatchController.php b/app/Http/Controllers/Api/Customer/MatchController.php index a1175821..5676991c 100755 --- a/app/Http/Controllers/Api/Customer/MatchController.php +++ b/app/Http/Controllers/Api/Customer/MatchController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api\Customer; use App\Model\Lq\JclqOdds; use App\Model\Lq\JclqResult; +use App\Model\Zq\BjdcOdds; use App\Model\Zq\JczqOdds; use App\Model\Zq\JczqResult; use App\Utils\Helps; @@ -132,4 +133,67 @@ class MatchController extends BaseController 'result' => $doing->merge($will)->merge($done) ]); } + + /** + * @api {POST} /api/customer/match/bjdc 比分-北京单场 + * @apiVersion 0.1.0 + * @apiGroup 客户端 + * + * @apiParam {String} [date] 日期 + * + * @apiSuccessExample {json} 返回结果 + * { + * "code": 200, + * "message": "", + * "data": { + * "dates": [{ // 用户信息 + * "date": 2, + * "date_str": 1, + * "week_str": "13511111111" + * }], + * "result" :[{ // 比赛信息 + * }], + * } + * } + */ + public function bjdc(Request $request) + { + $date = $request->input('date'); + + $startDate = date('Ymd', strtotime('-30 day')); + $endDate = date('Ymd', strtotime('+7 day')); + + $dates = []; + for ($d = $startDate; $d <$endDate; $d = date('Ymd', strtotime('+1 day', strtotime($d)))) { + $dates[] = [ + 'date' => date('Y-m-d', strtotime($d)), + 'date_str' => date('m-d', strtotime($d)), + 'week_str' => Helps::getWeek($d), + ]; + } + if (!$date) { + $date = date('Y-m-d'); + } + + $jczq = BjdcOdds::with([ 'score', 'match']) + ->select([ + DB::raw('bjdc_odds.*'), + DB::raw('zq_match.status as match_status') + ]) + ->leftJoin('zq_match', 'zq_match.match_id', 'bjdc_odds.match_id') + ->where('zq_match.start_time', '>=' , date('Y-m-d 00:00:00', strtotime($date))) + ->where('zq_match.start_time', '<' , date('Y-m-d 00:00:00', strtotime('+1 day', strtotime($date)))) + ->orderBy('zq_match.start_time', 'asc') + ->get(); + + $doing = collect($jczq)->where('match_status', 1)->collect(); + $will = collect($jczq)->where('match_status', 0)->collect(); + $done = collect($jczq)->whereNotIn('match_status', [1,0])->collect(); + + return $this->jsonSuccess([ + 'dates' => $dates, + 'result' => $doing->merge($will)->merge($done) + ]); + } + } diff --git a/app/Model/Zq/BjdcOdds.php b/app/Model/Zq/BjdcOdds.php index 02bd0493..12435d9a 100755 --- a/app/Model/Zq/BjdcOdds.php +++ b/app/Model/Zq/BjdcOdds.php @@ -38,6 +38,14 @@ class BjdcOdds extends BaseModel return $query->where('sale_state', SaleState::Selling); } + public function score() { + return $this->belongsTo(JczqScore::class, 'match_id', 'match_id'); + } + + public function match() { + return $this->belongsTo(ZqMatch::class, 'match_id', 'match_id'); + } + public function getCloseTime($earlySecond) { $time = strtotime($this->close_time); diff --git a/config/queue.php b/config/queue.php index 7a30f13c..cd0627a7 100755 --- a/config/queue.php +++ b/config/queue.php @@ -75,7 +75,7 @@ return [ 'driver' => 'redis', 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 90, + 'retry_after' => 600, 'block_for' => null, ], diff --git a/routes/api_customer.php b/routes/api_customer.php index 103f3269..8c079cc9 100755 --- a/routes/api_customer.php +++ b/routes/api_customer.php @@ -48,6 +48,7 @@ Route::middleware(['log', 'app', 'api']) Route::get('match/jczq', 'MatchController@jczq'); Route::get('match/lq', 'MatchController@lq'); + Route::get('match/bjdc', 'MatchController@bjdc'); Route::get('jczq/selling', 'JczqController@selling'); Route::post('jczq/valid', 'JczqController@valid');