| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace App\Http\Model;
- use Illuminate\Database\Eloquent\Model;
- /**
- * 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;//查询最大时间 时间戳
- $time_unx_min = $time_unx_max - $time_sec;//查询最小时间 时间戳
- $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]
- ];
- //更新开赛时间为前一分钟 并且 未开始的赛事 为已取消
- self::where($where)->update(['status'=>6,'handle_mark'=>trans('handleMatch.re_match_auto')]);
- }
- }
|