北京单场比分

pull/1/head
jcadmin 2025-07-19 10:32:11 +08:00
parent 6e87eb7162
commit fc9a52c9ee
4 changed files with 74 additions and 1 deletions

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api\Customer;
use App\Model\Lq\JclqOdds; use App\Model\Lq\JclqOdds;
use App\Model\Lq\JclqResult; use App\Model\Lq\JclqResult;
use App\Model\Zq\BjdcOdds;
use App\Model\Zq\JczqOdds; use App\Model\Zq\JczqOdds;
use App\Model\Zq\JczqResult; use App\Model\Zq\JczqResult;
use App\Utils\Helps; use App\Utils\Helps;
@ -132,4 +133,67 @@ class MatchController extends BaseController
'result' => $doing->merge($will)->merge($done) '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)
]);
}
} }

View File

@ -38,6 +38,14 @@ class BjdcOdds extends BaseModel
return $query->where('sale_state', SaleState::Selling); 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) public function getCloseTime($earlySecond)
{ {
$time = strtotime($this->close_time); $time = strtotime($this->close_time);

View File

@ -75,7 +75,7 @@ return [
'driver' => 'redis', 'driver' => 'redis',
'connection' => 'default', 'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'), 'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90, 'retry_after' => 600,
'block_for' => null, 'block_for' => null,
], ],

View File

@ -48,6 +48,7 @@ Route::middleware(['log', 'app', 'api'])
Route::get('match/jczq', 'MatchController@jczq'); Route::get('match/jczq', 'MatchController@jczq');
Route::get('match/lq', 'MatchController@lq'); Route::get('match/lq', 'MatchController@lq');
Route::get('match/bjdc', 'MatchController@bjdc');
Route::get('jczq/selling', 'JczqController@selling'); Route::get('jczq/selling', 'JczqController@selling');
Route::post('jczq/valid', 'JczqController@valid'); Route::post('jczq/valid', 'JczqController@valid');