Compare commits

...

2 Commits

Author SHA1 Message Date
jcadmin d9eb6a72e0 统计优化 2025-10-08 20:52:21 +08:00
jcadmin fc9a52c9ee 北京单场比分 2025-07-19 10:32:11 +08:00
5 changed files with 76 additions and 2 deletions

View File

@ -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)
]);
}
}

View File

@ -253,10 +253,11 @@ class ReportController extends BaseController
}
$query = Order::select([
DB::raw('sum(money) as money'),
DB::raw('sum(IF(type = 3, union_money, money)) as money'),
DB::raw('count(*) as count'),
'lottery_type_id',
])
->usable()
->where('draft_shop_id', $this->shopId());
if ($dateStart) {

View File

@ -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);

View File

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

View File

@ -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');