', TIMESTAMP), ); if ($presell_type) { $condition[] = array('presell_type', '=', $presell_type); } if ($start_time) { $start_time = strtotime($start_time); if ($start_time) { if ($start_time < TIMESTAMP) { $condition[] = array('presell_start_time', '<', $start_time + 86399); } else { $condition[] = array('presell_start_time', 'between', [$start_time, $start_time + 86399]); } } } $presell_list = $presell_model->getPresellList($condition, $this->pagesize); foreach ($presell_list as $key => $presell) { $goods_info = $goods_model->getGoodsInfoByID($presell['goods_id']); if (!$goods_info || $goods_info['goods_state'] != 1 || $goods_info['goods_verify'] != 1) { unset($presell_list[$key]); continue; } $presell_list[$key]['goods_price'] = $goods_info['goods_price']; $presell_list[$key]['goods_image_url'] = goods_cthumb($goods_info['goods_image'], 240); } $page_count = $presell_model->page_info; $result = array_merge(array('presell_list' => $presell_list,), mobile_page($page_count)); ds_json_encode(10000, '', $result); } public function time_list() { $presell_type = input('param.presell_type'); $presell_model = model('presell'); $condition = array( array('presell_state', 'in', [1, 2]), array('presell_end_time', '>', TIMESTAMP), ); if ($presell_type) { $condition[] = array('presell_type', '=', $presell_type); } $time_list = Db::name('presell')->fieldRaw('FROM_UNIXTIME(presell_start_time,"%Y-%m-%d") AS time')->where(array_merge($condition, array(array('presell_start_time', '>', TIMESTAMP))))->order('presell_start_time asc')->distinct(true)->limit(10)->select()->toArray(); foreach ($time_list as $key => $val) { $time_list[$key]['text'] = str_replace('-', '.', substr($val['time'], 5)); } if (empty($time_list) || ($time_list[0]['time'] != date('Y-m-d'))) { if ($presell_model->getPresellInfo(array_merge($condition, array(array('presell_start_time', '<', TIMESTAMP))))) { array_unshift($time_list, array('time' => date('Y-m-d'), 'text' => date('m.d'))); } } ds_json_encode(10000, '', array('time_list' => $time_list)); } }