北京单场比分
parent
6e87eb7162
commit
fc9a52c9ee
|
|
@ -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)
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ return [
|
|||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 90,
|
||||
'retry_after' => 600,
|
||||
'block_for' => null,
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue