本文整理汇总了PHP中tool::get_date方法的典型用法代码示例。如果您正苦于以下问题:PHP tool::get_date方法的具体用法?PHP tool::get_date怎么用?PHP tool::get_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tool
的用法示例。
在下文中一共展示了tool::get_date方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_results
public function get_results($ticket_type, $play_type, $curtime = NULL)
{
$matchs = array();
$timebeg = date("Y-m-d H:i:s", time() - 100000 * 60);
$matchtime_set = Kohana::config('site_config.match');
//今日结束时间设置
$timeend = $this->count_end_time(tool::get_date());
//print $timeend;
if ($ticket_type == 1) {
$obj = ORM::factory('match_data')->select('match_details.*,match_datas.*')->join('match_details', 'match_details.index_id', 'match_datas.match_id', 'LEFT')->where('match_datas.ticket_type', $ticket_type)->where('match_datas.play_type', $play_type)->where('match_details.status', 0);
if (!empty($curtime)) {
$obj->like('match_details.time', $curtime);
} else {
$obj->where('match_details.time > ', tool::get_date());
}
$obj->orderby('match_details.time', 'ASC');
} elseif ($ticket_type == 6) {
$obj = ORM::factory('match_data')->select('match_bk_details.*,match_datas.*')->join('match_bk_details', 'match_bk_details.index_id', 'match_datas.match_id', 'LEFT')->where('match_datas.ticket_type', $ticket_type)->where('match_datas.play_type', $play_type)->where('match_details.status', 0);
if (!empty($curtime)) {
$obj->like('match_bk_details.time', $curtime);
} else {
$obj->where('match_bk_details.time > ', tool::get_date());
}
$obj->orderby('match_bk_details.time', 'ASC');
}
$results = $obj->find_all();
$groups_dates = array();
$end_dates = array();
foreach ($results as $result) {
$tmp = array();
$tmp = $result->as_array();
if (empty($tmp['index_id'])) {
continue;
}
$timeend_stamp = strtotime($tmp['time']);
//赛事开始时间
$weekday = substr($tmp['match_info'], 0, 6);
if (empty($groups_dates[$weekday])) {
$groups_dates[$weekday] = date("Y-m-d", strtotime(tool::get_date_byweek($weekday, 1, $tmp['time'])));
$end_dates[$weekday] = $this->count_end_time($groups_dates[$weekday]);
}
$tmp['match_date'] = $groups_dates[$weekday];
//销售的赛事日期
$tmp['time_beg'] = date("Y-m-d H:i:s", $timeend_stamp + 60);
//比赛开始时间
$tmp['time_end'] = $this->get_end_time($tmp['time'], $end_dates[$weekday], $matchtime_set['jczq_endtime']);
//销售截止时间
$tmp['match_end'] = 0;
//赛事结束或开始
if (strtotime($tmp['time_end']) < time() || time() > strtotime($tmp['time_beg'])) {
$tmp['match_end'] = 1;
}
$tmp['match_url'] = $this->get_match_detail_url($tmp['match_id'], $ticket_type);
$tmp['color'] = $this->get_match_color($tmp['league']);
$matchs[] = $tmp;
}
return $matchs;
}
示例2: index
/**
* 订单列表
*/
public function index($status = NULL)
{
$time_expired = 60 * 60 * 2;
//将要过期时间
$time_delay = 5 * 60;
//过期延迟显示时间
//$mklasttime = mktime(date("H"), date("i"), date("s"), date("m"), date("d")-5, date("Y"));
//$last_time = date('Y-m-d H:i:s', $mklasttime);
//初始化默认查询结构体
$query_struct_default = array('where' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 10, 'page' => 1));
if (!empty($status)) {
switch ($status) {
case 'hasbuy':
$query_struct_default['where']['status'] = 0;
break;
case 'noprint':
$query_struct_default['where']['status'] = 1;
break;
case 'beexpired':
$query_struct_default['where']['date_end <'] = date("Y-m-d H:i:s", time() + $time_expired);
//当离方案截止时间小于2小时时为将要到期
$query_struct_default['where']['date_end >'] = tool::get_date();
break;
case 'hasexpired':
$query_struct_default['where']['date_end <'] = date("Y-m-d H:i:s", time() + $time_delay);
$query_struct_default['where']['status'] = array(0);
break;
case 'hasprint':
$query_struct_default['where']['status'] = 2;
break;
case 'nobonus':
$query_struct_default['where']['status'] = 3;
break;
case 'hasbonus':
$query_struct_default['where']['status'] = 4;
break;
case 'givehonus':
$query_struct_default['where']['status'] = 5;
break;
case 'cancel':
$query_struct_default['where']['status'] = 6;
break;
default:
}
}
//d($query_struct_default);
/* 搜索功能 */
$search_arr = array('id', 'order_num', 'username');
$search_value = $this->input->get('search_value');
$search_type = $this->input->get('search_type');
$where_view = array();
//$query_struct_default['where']['date_end >='] = tool::get_date();
if (strlen($this->input->get('start_time')) > 0) {
$query_struct_default['where']['date_add >='] = $this->input->get('start_time') . ' 00:00:00';
$where_view['start_time'] = $this->input->get('start_time');
}
if (strlen($this->input->get('end_time')) > 0) {
$query_struct_default['where']['date_add <='] = $this->input->get('end_time') . ' 00:00:00';
$where_view['end_time'] = $this->input->get('end_time');
}
if ($search_arr) {
foreach ($search_arr as $value) {
if ($search_type == $value && strlen($search_value) > 0) {
if ($value == 'lastname') {
$userobj = user::get_instance();
$userinfo = $userobj->get_search($search_value);
$userid = $userinfo['id'];
$query_struct_default['where']['start_user_id'] = $userid;
$query_struct_default['where']['user_id'] = $userid;
} else {
$query_struct_default['like'][$value] = $search_value;
}
}
}
$where_view['search_type'] = $search_type;
$where_view['search_value'] = $search_value;
}
$request_data = $this->input->get();
//初始化当前查询结构体
$query_struct_current = array();
//设置合并默认查询条件到当前查询结构体
$query_struct_current = array_merge($query_struct_current, $query_struct_default);
//列表排序
$orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'));
$orderby = controller_tool::orderby($orderby_arr);
// 排序处理
if (isset($request_data['orderby']) && is_numeric($request_data['orderby'])) {
$query_struct_current['orderby'] = $orderby;
}
$query_struct_current['orderby'] = $orderby;
//每页条目数
controller_tool::request_per_page($query_struct_current, $request_data);
//调用服务执行查询
$return_data['count'] = $this->order_basic_obj->count($query_struct_current);
//统计数量
/* 调用分页 */
$this->pagination = new Pagination(array('total_items' => $return_data['count'], 'items_per_page' => $query_struct_current['limit']['per_page']));
//.........这里部分代码省略.........
示例3: update_bonus
public function update_bonus($ticket_id, $bonus, $num, $password, $manager_id = 0)
{
$obj = ORM::factory('ticket_num', $ticket_id);
if ($obj->loaded) {
$obj->status = 2;
//更新为已兑奖
$obj->bonus = $bonus;
$obj->manager_id = $manager_id;
$obj->num = $num;
$obj->password = $password;
$obj->time_duijiang = tool::get_date();
$obj->time_lastaction = tool::get_date();
$obj->save();
if ($obj->saved) {
return TRUE;
} else {
return FALSE;
}
} else {
return FALSE;
}
}
示例4: expired_plan
public function expired_plan()
{
@set_time_limit(300);
//防止过期处理错误
//检索状态为方案提交及未出票状态的合买方案
$query_struct = array();
$query_struct['where']['plan_type'] = 1;
$query_struct['where']['date_end <'] = tool::get_date();
$query_struct['where']['status'] = 0;
//array(0,1)
$plan_basicobj = Plans_basicService::get_instance();
$results = $plan_basicobj->query_assoc($query_struct);
foreach ($results as $result) {
$flag = FALSE;
switch ($result['ticket_type']) {
case 1:
$flag = Plans_jczqService::get_instance()->expired_plan($result['order_num']);
break;
case 2:
$flag = Plans_sfcService::get_instance()->expired_plan($result['order_num']);
break;
case 6:
$flag = Plans_jclqService::get_instance()->expired_plan($result['order_num']);
break;
case 7:
$flag = Plans_bjdcService::get_instance()->expired_plan($result['order_num']);
break;
}
d($result['order_num'], FALSE);
if ($flag) {
$this->update_status_by_ordernum($result['order_num'], 1);
} else {
$this->get_result($result, FALSE);
if (!empty($result['detail'])) {
$this->cancel_plan($result['order_num']);
}
}
}
}