| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace App\Http\Model;
- use Illuminate\Database\Eloquent\Model;
- use App\Http\Model\StLqMatch as LqMatchModel;
- use App\Http\Model\StWqMatch as WqMatchModel;
- use App\Http\Model\StBqMatch as BqMatchModel;
- use App\Http\Model\StZqResult as ZqResultModel;
- use App\Http\Model\StLqResult as LqResultModel;
- use App\Http\Model\StWqResult as WqResultModel;
- use App\Http\Model\StBqResult as BqResultModel;
- /**
- * Class Account
- * @package App\Sports\Model
- * 用户账号
- */
- class StZqMatch extends Model
- {
- protected $table = 'st_zq_competition';
- public $timestamps = false;
- /**
- * 赛事异常处理
- * 当前时间大于赛事开始时间,赛事还未开始
- * 则设置为 已取消
- * $time int执行间隔时间 默认60秒
- * $time_sec int 查询范围 默认100秒
- */
- public static function HandleMatch($time = 60,$time_sec = 100){
- //拼接查询条件
- $time_unx_max = time() - $time;//查询最大时间 时间戳 24小时前
- $time_unx_min = $time_unx_max - 600;//查询最小时间 时间戳 十分钟前
- $where = [
- ['match_date','=',date('Y-m-d',$time_unx_min)],
- ['match_time','>',date('H:i:s',$time_unx_min)],
- ['match_time','<',date('H:i:s',$time_unx_max)],
- ['status','=',0]
- ];
- //更新数据
- $up_data = ['status'=>6,'handle_mark'=>trans('handleMatch.re_match_auto')];
- //更新开赛时间为前一分钟 并且 未开始的赛事 为已取消
- self::where($where)->update($up_data);
- LqMatchModel::where($where)->update($up_data);
- WqMatchModel::where($where)->update($up_data);
- BqMatchModel::where($where)->update($up_data);
- //更新赛事结果 表
- $result_where = [
- ['start_time','>',date('Y-m-d H:i:s',$time_unx_min)],
- ['start_time','<',date('Y-m-d H:i:s',$time_unx_max)],
- ['status','=',0]
- ];
- $result_up_data = ['status'=>6];
- ZqResultModel::where($result_where)->update($result_up_data);
- LqResultModel::where($result_where)->update($result_up_data);
- WqResultModel::where($result_where)->update($result_up_data);
- BqResultModel::where($result_where)->update($result_up_data);
- }
- }
|