public function com_search() { $map = array(); if (!isset($_REQUEST['end_time']) || $_REQUEST['end_time'] == '') { $_REQUEST['end_time'] = to_date(get_gmtime(), 'Y-m-d'); } if (!isset($_REQUEST['start_time']) || $_REQUEST['start_time'] == '') { $_REQUEST['start_time'] = dec_date($_REQUEST['end_time'], 7); // $_SESSION['q_start_time_7']; } $map['start_time'] = trim($_REQUEST['start_time']); $map['end_time'] = trim($_REQUEST['end_time']); $map['is_paid'] = 1; $this->assign("start_time", $map['start_time']); $this->assign("end_time", $map['end_time']); if ($map['start_time'] == '') { $this->error('开始时间 不能为空'); exit; } if ($map['end_time'] == '') { $this->error('结束时间 不能为空'); exit; } $d = explode('-', $map['start_time']); if (checkdate($d[1], $d[2], $d[0]) == false) { $this->error("开始时间不是有效的时间格式:{$map['start_time']}(yyyy-mm-dd)"); exit; } $d = explode('-', $map['end_time']); if (checkdate($d[1], $d[2], $d[0]) == false) { $this->error("结束时间不是有效的时间格式:{$map['end_time']}(yyyy-mm-dd)"); exit; } if (to_timespan($map['start_time']) > to_timespan($map['end_time'])) { $this->error('开始时间不能大于结束时间:' . $map['start_time'] . '至' . $map['end_time']); exit; } $q_date_diff = 31; $this->assign("q_date_diff", $q_date_diff); //echo abs(to_timespan($map['end_time']) - to_timespan($map['start_time'])) / 86400 + 1; if ($q_date_diff > 0 && abs(to_timespan($map['end_time']) - to_timespan($map['start_time'])) / 86400 + 1 > $q_date_diff) { $this->error("查询时间间隔不能大于 {$q_date_diff} 天"); exit; } return $map; }
/** * 下一交易日 */ function get_peizi_next_date($time = NOW_TIME, $left = 0) { $date = to_date($time, "Y-m-d"); switch ($left) { case 0: //当天 return $date; break; case 1: //次日生效 $cur_date = dec_date($date, -1); return $cur_date; break; case 2: //下一交易日 for ($i = 1; $i < 30; $i++) { $cur_date = dec_date($date, -$i); if (get_peizi_is_holiday($cur_date) == false) { return $cur_date; } } break; case 3: //下二个交易日 for ($i = 1; $i < 30; $i++) { $i++; $cur_date = dec_date($date, -$i); if (get_peizi_is_holiday($cur_date) == false) { return $cur_date; } } break; default: return null; break; } }
public function online() { $map = $this->com_search(); if (trim($_REQUEST['order_sn']) != '') { $condition['order_id'] = M("DealOrder")->where("order_sn='" . trim($_REQUEST['order_sn']) . "'")->getField("id"); } if (intval($_REQUEST['no_payment_id']) > 0) { $condition['payment_id'] = array("neq", intval($_REQUEST['no_payment_id'])); } if (trim($_REQUEST['notice_sn']) != '') { $condition['notice_sn'] = $_REQUEST['notice_sn']; } $payment_id = M("Payment")->where("class_name = 'Otherpay'")->getField("id"); $condition['payment_id'] = $payment_id; if ($map['start_time'] != '' && $map['end_time']) { $condition['create_time'] = array("between", array(to_timespan($map['start_time'], "Y-m-d"), to_timespan(dec_date($map['end_time'], -1), "Y-m-d"))); } if (intval($_REQUEST['is_paid']) == -1 || !isset($_REQUEST['is_paid'])) { unset($_REQUEST['is_paid']); } $this->assign("default_map", $condition); parent::index(); }