本文整理汇总了PHP中to_timespan函数的典型用法代码示例。如果您正苦于以下问题:PHP to_timespan函数的具体用法?PHP to_timespan怎么用?PHP to_timespan使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了to_timespan函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update()
{
B('FilterString');
$data = M("ApnsMessages")->create();
$log_info = $data['id'];
//开始验证有效性
$this->assign("jumpUrl", u("MApns/edit", array("id" => $data['id'])));
if (!check_empty($data['content'])) {
$this->error(L("CONTENT_EMPTY_TIP"));
}
if ($data['send_time'] == '') {
$data['send_time'] = get_gmtime();
}
$data['send_time'] = to_timespan($data['send_time']);
if (intval($_REQUEST['resend']) == 1) {
$data['status'] = 0;
}
$list = M("ApnsMessages")->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例2: insert_ticket
public function insert_ticket()
{
if ($_REQUEST['money'] == '') {
$this->error("券的金额不能为空");
}
if ($_REQUEST['amount'] == '') {
$this->error("券的数量不能为空");
}
if ($_REQUEST['use_time'] == '') {
$this->error("券的有效天数不能为空");
}
$ticket_data['money'] = intval($_REQUEST['money']);
$ticket_data['quantity'] = intval($_REQUEST['amount']);
$ticket_data['rest_quantity'] = intval($_REQUEST['amount']);
$ticket_data['use_time'] = intval($_REQUEST['use_time']);
$ticket_data['status'] = intval($_REQUEST['status']);
$ticket_data['value'] = intval($_REQUEST['value']);
$ticket_data['is_deposit'] = 1;
//券的类型 0:赠金券 1代金券
$ticket_data['ticket_type'] = intval($_REQUEST['type']);
//券的使用类型 0:无条件 1:满减优惠
$ticket_data['type'] = intval($_REQUEST['use_type']);
//系统默认时间
$ticket_data['create_time'] = get_gmtime();
$ticket_data['start_use'] = to_timespan(trim($_REQUEST['start_time']));
$ticket_data['deadline'] = to_timespan(trim($_REQUEST['end_time']));
$rs = M("Ticket")->add($ticket_data);
if ($rs) {
$this->success(L("INSERT_SUCCESS"));
} else {
$this->error(L("INSERT_FAILED"));
}
}
示例3: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['name'])) {
$this->error(L("VOUCHER_NAME_EMPTY_TIP"));
}
if (doubleval($data['money']) <= 0) {
$this->error(L("VOUCHER_MONEY_ERROR_TIP"));
}
$data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']);
$data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("use_limit", $data['use_limit']);
//同步可用次数
M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("begin_time", $data['begin_time']);
M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("end_time", $data['end_time']);
M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("money", $data['money']);
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例4: order_referer
/**
* 订单来路的图饼展示
*/
public function order_referer()
{
$where = " 1=1 ";
$where .= " and type <> 1";
$map['type'] = array("neq", 1);
$begin_time = strim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
$end_time = strim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
if ($end_time == 0) {
$where .= " and create_time > " . $begin_time;
$map['create_time'] = array("gt", $begin_time);
} else {
$where .= " and create_time between " . $begin_time . " and " . $end_time;
$map['create_time'] = array("between", array($begin_time, $end_time));
}
$sql = "select referer,count(id) as ct from " . DB_PREFIX . "deal_order where " . $where . " and referer <> '' group by referer having count(id) > 0 order by ct desc limit 8 ";
$total_sql = "select count(*) from " . DB_PREFIX . "deal_order where " . $where;
$colors = array("0xAAAAAA", "0x669999", "0xBBBB55", "0xCC6600", "0x9999FF", "0x0066CC", "0x99CCCC", "0x999999", "0xFFCC00", "0x009999", "0x99CC33", "0xFF9900", "0x999966", "0x66CCCC", "0x339966", "0xCCCC33");
$total = intval($GLOBALS['db']->getOne($total_sql));
$list = $GLOBALS['db']->getAll($sql);
$items = array();
foreach ($list as $k => $v) {
$total -= intval($v['ct']);
$items[] = array("value" => intval($v['ct']), "tip" => $v['referer'], "on-click" => "jump_to('" . u("DealOrder/deal_index", array("referer" => $v['referer'])) . "')");
}
$items[] = array("value" => $total, "tip" => "直接访问", "on-click" => "jump_to('" . u("DealOrder/deal_index", array("referer" => -1)) . "')");
$data['bg_colour'] = "#ffffff";
$data['elements'] = array(array("type" => "pie", "colours" => $colors, "alpha" => 1, "border" => 2, "start-angle" => 35, "values" => $items));
ajax_return($data);
}
示例5: index
public function index()
{
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
$user_id = $GLOBALS['user_info']['id'];
$status = isset($_REQUEST['stauts']) ? intval($_REQUEST['stauts']) : 3;
$time = isset($_REQUEST['time']) ? to_timespan($_REQUEST['time'], "Ymd") : "";
$deal_name = strim($_REQUEST['deal_name']);
$condition = "";
if ($deal_name != "") {
$condition .= " and d.name = '" . $deal_name . "' ";
$GLOBALS['tmpl']->assign('deal_name', $deal_name);
}
if ($time != "") {
$condition .= " and dlr.repay_time = " . $time . " ";
$GLOBALS['tmpl']->assign('time', to_date($time, "Y-m-d"));
}
$result = getUcRepayPlan($user_id, $status, $limit, $condition);
if ($result['rs_count'] > 0) {
$page = new Page($result['rs_count'], app_conf("PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign('list', $result['list']);
}
$GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_REPAY_PLAN']);
$GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_repay_plan.html");
$GLOBALS['tmpl']->assign("status", $status);
$GLOBALS['tmpl']->display("page/uc.html");
}
示例6: index
public function index()
{
$order_sn = strim($_REQUEST['order_sn']);
$time = isset($_REQUEST['time']) ? to_date(to_timespan($_REQUEST['time'], "Y-m-d"), "Y-m-d") : "";
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
$condition = " 1=1 ";
if ($order_sn != "") {
$condition .= " and go.order_sn = '" . $order_sn . "' ";
}
if ($time != "") {
$condition .= " and go.ex_date = '" . $time . "' ";
$GLOBALS['tmpl']->assign('time', $time);
}
$user_id = $GLOBALS['user_info']['id'];
$result = get_order($limit, $user_id, $condition);
$page = new Page($result['count'], app_conf("PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("order_sn", $order_sn);
$GLOBALS['tmpl']->assign("order_info", $result['list']);
$GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_goods_order.html");
$GLOBALS['tmpl']->display("page/uc.html");
}
示例7: update
public function update()
{
B('FilterString');
$data = M(MODULE_NAME)->create();
$user_names = preg_split("/[ ,]/i", $data['user_names']);
$user_ids = "";
foreach ($user_names as $k => $v) {
$uid = M("User")->where("user_name = '" . $v . "'")->getField("id");
if ($uid) {
$user_ids .= $uid . "|";
}
}
$data['user_ids'] = $user_ids;
$data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
$log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title");
//开始验证有效性
$this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
if (!check_empty($data['title'])) {
$this->error(L("MSY_TITLE_EMPTY_TIP"));
}
if (!check_empty($data['content'])) {
$this->error(L("MSY_CONTENT_EMPTY_TIP"));
}
// 更新数据
$list = M(MODULE_NAME)->save($data);
if (false !== $list) {
//成功提示
save_log($log_info . L("UPDATE_SUCCESS"), 1);
$this->success(L("UPDATE_SUCCESS"));
} else {
//错误提示
save_log($log_info . L("UPDATE_FAILED"), 0);
$this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
}
}
示例8: index
public function index()
{
$GLOBALS['tmpl']->assign("page_title", "投资奖励");
$start_time = strim($_REQUEST['start_time']);
$end_time = strim($_REQUEST['end_time']);
$d = explode('-', $start_time);
if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) {
$this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)");
exit;
}
$d = explode('-', $end_time);
if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) {
$this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)");
exit;
}
if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) {
$this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time);
exit;
}
if (strim($start_time) != "") {
$where .= " and gr.release_date >='" . strim($start_time) . "'";
}
if (strim($end_time) != "") {
$where .= " and gr.release_date <='" . strim($end_time) . "'";
}
if (isset($_REQUEST['gift_type'])) {
$gift_type = $_REQUEST['gift_type'];
if ($gift_type != 5) {
$where .= " and gr.gift_type ='" . $gift_type . "'";
$GLOBALS['tmpl']->assign("gift_type", $gift_type);
}
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
if ($limit) {
$limit = " limit " . $limit;
}
$list_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "gift_record gr left join " . DB_PREFIX . "deal d on d.id = gr.deal_id WHERE gr.user_id='" . $GLOBALS['user_info']['id'] . "' {$where} ");
$list = array();
if ($list_count > 0) {
$sql = "select gr.*,d.name,vg.name as gift_name,sum(dlr.true_reward_money) as reward_money from " . DB_PREFIX . "gift_record gr " . "left join " . DB_PREFIX . "deal d on d.id = gr.deal_id " . "left join " . DB_PREFIX . "vip_gift vg on vg.id = gr.gift_value AND gr.gift_type='4' " . "left join " . DB_PREFIX . "deal_load_repay dlr on dlr.load_id = gr.load_id " . "WHERE gr.user_id='" . $GLOBALS['user_info']['id'] . "' AND ((gr.gift_type = 2 AND dlr.true_reward_money >0 ) OR (gr.gift_type <> 2)) {$where} GROUP BY gr.load_id order by gr.id desc " . $limit;
$list = $GLOBALS['db']->getAll($sql);
foreach ($list as $k => $v) {
$list[$k]['url'] = url("index", "deal#index", array("id" => $v['deal_id']));
}
}
$page = new Page($list_count, app_conf("PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("list", $list);
$GLOBALS['tmpl']->assign("start_time", $start_time);
$GLOBALS['tmpl']->assign("end_time", $end_time);
$GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_gift_record.html");
$GLOBALS['tmpl']->display("page/uc.html");
}
示例9: index
public function index()
{
init_app_page();
$s_account_info = $GLOBALS["account_info"];
$supplier_id = intval($s_account_info['supplier_id']);
$name = strim($_REQUEST['name']);
$begin_time = strim($_REQUEST['begin_time']);
$end_time = strim($_REQUEST['end_time']);
$begin_time_s = to_timespan($begin_time, "Y-m-d H:i");
$end_time_s = to_timespan($end_time, "Y-m-d H:i");
$condition = "";
if ($name != "") {
$youhui_ids = $GLOBALS['db']->getRow("select group_concat(id SEPARATOR ',') as ids from " . DB_PREFIX . "youhui where name like '%" . $name . "%'");
$condition .= " and log.youhui_id in (" . $youhui_ids['ids'] . ") ";
}
if ($begin_time_s) {
$condition .= " and log.create_time > " . $begin_time_s . " ";
}
if ($end_time_s) {
$condition .= " and log.create_time < " . $end_time_s . " ";
}
$GLOBALS['tmpl']->assign("name", $name);
$GLOBALS['tmpl']->assign("begin_time", $begin_time);
$GLOBALS['tmpl']->assign("end_time", $end_time);
//分页
$page_size = 15;
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$list = $GLOBALS['db']->getAll("select distinct(log.id),log.* from " . DB_PREFIX . "youhui_log as log left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = log.youhui_id where l.location_id in (" . implode(",", $s_account_info['location_ids']) . ") " . $condition . " order by log.create_time desc limit " . $limit);
foreach ($list as $k => $v) {
$list[$k]['user_name'] = load_user($v['user_id']);
$list[$k]['user_name'] = $list[$k]['user_name']['user_name'];
$youhui_info = load_auto_cache("youhui", array('id' => $v['youhui_id']));
$list[$k]['youhui_name'] = $youhui_info['name'];
$location_info = load_auto_cache("store", array('id' => $v['location_id']));
$list[$k]['location_name'] = $location_info['name'];
if ($list[$k]['expire_time'] != 0 && $list[$k]['expire_time'] < NOW_TIME) {
$list[$k]['expire_time'] = "已过期";
} elseif ($list[$k]['expire_time'] == 0) {
$list[$k]['expire_time'] = "永久有效";
} else {
$list[$k]['expire_time'] = to_date($list[$k]['expire_time']);
}
$list[$k]['url'] = url('index', 'youhui#' . $v['youhui_id']);
}
$total = $GLOBALS['db']->getOne("select count(distinct(log.id)) from " . DB_PREFIX . "youhui_log as log left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = log.youhui_id where l.location_id in (" . implode(",", $s_account_info['location_ids']) . ") " . $condition);
$page = new Page($total, $page_size);
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("list", $list);
$GLOBALS['tmpl']->assign("head_title", "优惠券下载记录");
$GLOBALS['tmpl']->display("pages/youhuio/index.html");
}
示例10: getlist
private function getlist($extwhere)
{
//分类
$cate_tree = M("DealCate")->where('is_delete = 0')->findAll();
$cate_tree = D("DealCate")->toFormatTree($cate_tree, 'name');
$this->assign("cate_tree", $cate_tree);
$conditon = " 1=1 ";
//开始加载搜索条件
if (intval($_REQUEST['deal_id']) > 0) {
$conditon .= " and d.deal_id = " . intval($_REQUEST['deal_id']);
}
if (intval($_REQUEST['cate_id']) > 0) {
require_once APP_ROOT_PATH . "system/utils/child.php";
$child = new Child("deal_cate");
$cate_ids = $child->getChildIds(intval($_REQUEST['cate_id']));
$cate_ids[] = intval($_REQUEST['cate_id']);
$conditon .= " and d.cate_id in (" . implode(",", $cate_ids) . ")";
}
if (trim($_REQUEST['user_name']) != '') {
$sql = "select group_concat(id) from " . DB_PREFIX . "user where user_name like '%" . trim($_REQUEST['user_name']) . "%'";
$ids = $GLOBALS['db']->getOne($sql);
if ($ids) {
$conditon .= " and dl.user_id in ({$ids}) ";
} else {
$conditon .= " and dl.user_id = 0 ";
}
}
if (intval($_REQUEST['user_id']) > 0) {
$sql = "select user_name from " . DB_PREFIX . "user where id='" . intval($_REQUEST['user_id']) . "'";
$_REQUEST['user_name'] = $GLOBALS['db']->getOne($sql);
$conditon .= " and dl.user_id = " . intval($_REQUEST['user_id']);
}
$begin_time = trim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
$end_time = trim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
if ($begin_time > 0 || $end_time > 0) {
if ($end_time == 0) {
$conditon .= " and dl.create_time >= {$begin_time} ";
} else {
$conditon .= " and dl.create_time between {$begin_time} and {$end_time} ";
}
}
$count = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_load dl LEFT JOIN " . DB_PREFIX . "deal d ON d.id =dl.deal_id where {$conditon} {$extwhere} ORDER BY dl.id DESC ");
if (!empty($_REQUEST['listRows'])) {
$listRows = $_REQUEST['listRows'];
} else {
$listRows = '';
}
$p = new Page($count, $listRows);
if ($count > 0) {
$list = $GLOBALS['db']->getAll("SELECT dl.*,d.name,d.repay_time,d.repay_time_type,d.loantype,d.rate,d.cate_id FROM " . DB_PREFIX . "deal_load dl LEFT JOIN " . DB_PREFIX . "deal d ON d.id =dl.deal_id where {$conditon} {$extwhere} ORDER BY dl.id DESC limit " . $p->firstRow . ',' . $p->listRows);
$this->assign("list", $list);
}
$page = $p->show();
$this->assign("page", $page);
}
示例11: index
public function index()
{
if (trim($_REQUEST['log_info']) != '') {
$map['log_info'] = array('like', '%' . trim($_REQUEST['log_info']) . '%');
}
$log_begin_time = trim($_REQUEST['log_begin_time']) == '' ? 0 : to_timespan($_REQUEST['log_begin_time']);
$log_end_time = trim($_REQUEST['log_end_time']) == '' ? 0 : to_timespan($_REQUEST['log_end_time']);
if ($log_end_time == 0) {
$map['log_time'] = array('gt', $log_begin_time);
} else {
$map['log_time'] = array('between', array($log_begin_time, $log_end_time));
}
$this->assign("default_map", $map);
parent::index();
}
示例12: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$id = intval($GLOBALS['request']['id']);
//$user_id = intval($GLOBALS['user_info']['id']);
$page = intval($GLOBALS['request']['page']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
require APP_ROOT_PATH . 'app/Lib/deal.php';
require APP_ROOT_PATH . 'app/Lib/uc_goods_func.php';
$root['user_login_status'] = 1;
$root['response_code'] = 1;
$order_sn = strim($_REQUEST['order_sn']);
$time = isset($_REQUEST['time']) ? to_date(to_timespan($_REQUEST['time'], "Y-m-d"), "Y-m-d") : "";
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
$condition = " 1=1 ";
if ($order_sn != "") {
$condition .= " and go.order_sn = '" . $order_sn . "' ";
}
if ($time != "") {
$condition .= " and go.ex_date = '" . $time . "' ";
$root['time'] = $time;
}
$root['user_id'] = $user_id;
$orders = get_order($limit, $user_id, $condition);
$root['page'] = array("page" => $page, "page_total" => ceil($orders['count'] / app_conf("DEAL_PAGE_SIZE")), "page_size" => app_conf("DEAL_PAGE_SIZE"));
$root['order_sn'] = $order_sn;
$root['order_info'] = $orders['list'];
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
$root['program_title'] = "我的兑现";
output($root);
}
示例13: index
public function index()
{
$GLOBALS['tmpl']->assign("page_title", "节日福利");
$start_time = strim($_REQUEST['start_time']);
$end_time = strim($_REQUEST['end_time']);
$d = explode('-', $start_time);
if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) {
$this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)");
exit;
}
$d = explode('-', $end_time);
if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) {
$this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)");
exit;
}
if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) {
$this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time);
exit;
}
if (strim($start_time) != "") {
$where .= " and send_date >='" . strim($start_time) . "'";
}
if (strim($end_time) != "") {
$where .= " and send_date <='" . strim($end_time) . "'";
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
if ($limit) {
$limit = " limit " . $limit;
}
$list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "given_record gr left join " . DB_PREFIX . "user u on u.id = gr.user_id left join " . DB_PREFIX . "vip_festivals vf on vf.id = gr.gift_id WHERE u.id='" . $GLOBALS['user_info']['id'] . "' {$where} order by gr.id desc " . $limit);
$list_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "given_record gr left join " . DB_PREFIX . "user u on u.id = gr.user_id left join " . DB_PREFIX . "vip_festivals vf on vf.id = gr.gift_id WHERE u.id='" . $GLOBALS['user_info']['id'] . "' {$where} ");
$page = new Page($list_count, app_conf("PAGE_SIZE"));
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("list", $list);
$GLOBALS['tmpl']->assign("start_time", $start_time);
$GLOBALS['tmpl']->assign("end_time", $end_time);
$GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_given_record.html");
$GLOBALS['tmpl']->display("page/uc.html");
}
示例14: index
public function index()
{
//用于处理团购搜索的处理程序
$se_name = trim(addslashes($_POST['se_name']));
$se_begin = trim(addslashes($_POST['se_begin']));
$se_end = trim(addslashes($_POST['se_end']));
$se_begin = to_timespan($se_begin, 'Y-m-d');
$se_end = to_timespan($se_end, 'Y-m-d');
$se_end = $se_end != 0 ? $se_end + 24 * 3600 - 1 : $se_end;
$search['se_name'] = $se_name;
$search['se_begin'] = $se_begin;
$search['se_end'] = $se_end;
$se_module = trim(addslashes($_POST['se_module']));
$se_action = trim(addslashes($_POST['se_action']));
$se_id = intval(addslashes($_POST['se_id']));
$search_code = urlencode(base64_encode(serialize($search)));
$url = APP_ROOT . "/tuan.php?ctl=" . $se_module . "&act=" . $se_action . "&id=" . $se_id . "&search=" . $search_code;
app_redirect($url);
}
示例15: reply
public function reply()
{
$ajax = 1;
global_run();
if (!$GLOBALS['user_info']) {
$result['status'] = -1000;
$result['info'] = "未登录";
ajax_return($result);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
/*验证每天只允许评论5次*/
$day_send_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where create_time>" . to_timespan(to_date(NOW_TIME, "Y-m-d"), "Y-m-d") . " and create_time<" . NOW_TIME);
if ($day_send_count >= 8) {
showErr('今天你已经发很多了哦~', $ajax);
}
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$topic_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . intval($_REQUEST['topic_id']));
if (!$topic_info) {
showErr("主题不存在", $ajax);
}
$reply_data = array();
$reply_data['topic_id'] = intval($_REQUEST['topic_id']);
$reply_data['user_id'] = intval($GLOBALS['user_info']['id']);
$reply_data['user_name'] = $GLOBALS['user_info']['user_name'];
$reply_data['reply_id'] = intval($_REQUEST['reply_id']);
$reply_data['create_time'] = NOW_TIME;
$reply_data['is_effect'] = 1;
$reply_data['is_delete'] = 0;
$reply_data['content'] = strim(valid_str(addslashes($_REQUEST['content'])));
require_once APP_ROOT_PATH . 'system/model/topic.php';
$reply_id = insert_topic_reply($reply_data);
//返回页面的数据
$reply_data['reply_id'] = $reply_id;
$reply_data['create_time'] = to_date(NOW_TIME, "Y-m-d H:i");
$reply_data['avatar'] = show_avatar($reply_data['user_id'], "small");
$reply_data['user_url'] = url("index", "uc_home#index", array("id" => $reply_data['user_id']));
$reply_data['status'] = 1;
ajax_return($reply_data);
}