page($data['page'], $data['limit']); $model->order('id DESC, sort DESC'); $id = []; $booking = AuctionBooking::where([['uid', '=', $uid], ['create_time', '>', strtotime(date('Y-m-d'), time())]])->field('auction_id')->select(); foreach ($booking as $v) { $id[] = $v['auction_id']; } if ($data['advance']){ $model->where('id', 'in', $id); } $list = $model->select(); $list = count($list) ? $list->toArray() : []; if ($list){ foreach ($list as $k =>$v) { $list[$k]['time'] = strtotime($v['radd_time']) - 1800; $list[$k]['e_time'] = strtotime($v['rend_time']); $list[$k]['day'] = date('Y-m-d H:i:s', strtotime($v['radd_time']) - 1800); if (in_array($v['id'], $id)){ $list[$k]['sta'] = 2; // 进入 $list[$k]['str'] = '进入'; }else{ $list[$k]['sta'] = 1; // 预约 $list[$k]['str'] = '预约'; } } } return $list; } /** * 每日修改场次 * @return void * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function frequency() { $list = self::select(); foreach ($list as $k => $v){ if ($v['day_time'] < time()){ $find = self::find($v['id']); $find['day_time'] = strtotime(date('Y-m-d 23:59:59')); $find['frequency'] = $v['frequency'] + 1; $find->save(); } } } }