本文整理汇总了PHP中pass_date函数的典型用法代码示例。如果您正苦于以下问题:PHP pass_date函数的具体用法?PHP pass_date怎么用?PHP pass_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pass_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$result = do_login_user($email, $pwd);
$GLOBALS['user_info'] = $user_data = es_session::get('user_info');
$page = intval($GLOBALS['request']['page']) > 0 ? intval($GLOBALS['request']['page']) : 1;
$page_size = 20;
$limit = ($page - 1) * $page_size . "," . $page_size;
$user_id = intval($GLOBALS['user_info']['id']);
$sql = "select group_key,count(group_key) as total from " . DB_PREFIX . "msg_box \r\n\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) \r\n\t\t\t\tgroup by group_key \r\n\t\t\t\torder by system_msg_id desc,max(create_time) desc limit " . $limit;
$sql_count = "select count(distinct(group_key)) from " . DB_PREFIX . "msg_box \r\n\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1))";
$list = $GLOBALS['db']->getAll($sql);
foreach ($list as $k => $v) {
$list[$k] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_box where group_key = '" . $v['group_key'] . "' and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) order by create_time desc limit 1");
$list[$k]['total'] = $v['total'];
if ($list[$k]['system_msg_id'] > 0) {
$sys_msgs[] = array("mid" => $list[$k]['group_key'], "uid" => $list[$k]['to_user_id'], "status" => 1, "title" => $list[$k]['title'], "time" => pass_date($list[$k]['create_time']));
} else {
$msg_list[] = array("content" => $list[$k]['content'], "uid" => $list[$k]['from_user_id'], "user_name" => $list[$k]['from_user_id'] == $user_data['id'] ? "我" : $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($list[$k]['from_user_id'])), "user_avatar" => get_abs_img_root(get_muser_avatar($list[$k]['from_user_id'], "big")), "tuid" => $list[$k]['to_user_id'], "tuser_name" => $list[$k]['to_user_id'] == $user_data['id'] ? "我" : $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($list[$k]['to_user_id'])), "tuser_avatar" => get_abs_img_root(get_muser_avatar($list[$k]['to_user_id'], "big")), "time" => pass_date($list[$k]['create_time']), "msg_count" => $list[$k]['total'], "mlid" => $list[$k]['group_key']);
}
}
$count = $GLOBALS['db']->getOne($sql_count);
$root['return'] = 1;
$root['sys_msgs'] = $sys_msgs;
$root['msg_list'] = $msg_list;
//分页
$page_info['page'] = $page;
$page_info['page_total'] = ceil($count / $page_size);
$root['page'] = $page_info;
output($root);
}
示例2: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$user_data = $GLOBALS['user_info'];
$page = intval($GLOBALS['request']['page']) > 0 ? intval($GLOBALS['request']['page']) : 1;
$page_size = PAGE_SIZE;
$limit = ($page - 1) * $page_size . "," . $page_size;
$user_id = intval($GLOBALS['user_info']['id']);
$group_key = addslashes(trim($GLOBALS['request']['mid']));
$sql = "select count(*) as count,max(system_msg_id) as system_msg_id,max(id) as id from " . DB_PREFIX . "msg_box \n\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) \n\t\t\t\tand group_key = '" . $group_key . "'";
$row = $GLOBALS['db']->getRow($sql);
if ($row['count'] == 0) {
$root['return'] = 0;
} elseif ($row['system_msg_id'] > 0) {
//系统消息,仅查看
$data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_box where id = " . $row['id'] . " and is_delete = 0");
$GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set is_read = 1 where id = " . $row['id']);
$root['return'] = 1;
$root['msg'] = array('mid' => $group_key, 'title' => $data['title'], 'message' => $data['content'], 'time' => pass_date($data['create_time']));
} else {
$root['return'] = 1;
$root['lid'] = $group_key;
//消息记录
$sql = "select * from " . DB_PREFIX . "msg_box \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) \n\t\t\t\t\tand group_key = '" . $group_key . "' \n\t\t\t\t\torder by create_time desc limit " . $limit;
$sql_count = "select count(*) from " . DB_PREFIX . "msg_box \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) and group_key = '" . $group_key . "'";
$upd_sql = "update " . DB_PREFIX . "msg_box set is_read = 1 \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) \n\t\t\t\t\tand group_key = '" . $group_key . "' ";
$GLOBALS['db']->query($upd_sql);
$list = $GLOBALS['db']->getAll($sql);
foreach ($list as $k => $v) {
if ($v['to_user_id'] != $user_id) {
$dest_user_id = $v['to_user_id'];
break;
}
if ($v['from_user_id'] != $user_id) {
$dest_user_id = $v['from_user_id'];
break;
}
}
$dest_user_name = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $dest_user_id);
$root['title'] = "与" . $dest_user_name . "的交流";
$root['t_name'] = $dest_user_name;
$count = $GLOBALS['db']->getOne($sql_count);
$page_info['page'] = $page;
$page_info['page_total'] = ceil($count / $page_size);
$page_info['page_size'] = $page_size;
$root['page'] = $page_info;
$msg_list = array();
foreach ($list as $k => $v) {
$msg_list[] = array("miid" => $v['id'], "mlid" => $v['group_key'], "uid" => $v['from_user_id'], "message" => $v['content'], "time" => pass_date($v['create_time']), "tuid" => $v['to_user_id'], "tuser_name" => $v['to_user_id'] == $user_id ? "我" : $dest_user_name, "tuser_avatar" => get_abs_img_root(get_muser_avatar($v['to_user_id'], "big")), "content" => $v['content'], "user_name" => $v['from_user_id'] == $user_id ? "我" : $dest_user_name, "user_avatar" => get_abs_img_root(get_muser_avatar($v['from_user_id'], "big")));
}
$root['msg_list'] = $msg_list;
}
if (strim($GLOBALS['request']['from']) == "wap") {
$root['f_link_data'] = get_link_list();
$root['email'] = $email;
}
// fwb add 2014-08-27
output($root);
}
示例3: index
public function index()
{
$root = array();
$root['response_code'] = 1;
$id = intval($_REQUEST['id']);
$email = strim($GLOBALS['request']['email']);
// 用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
// 密码 // 检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))");
if (!$deal_info) {
app_redirect(url("index"));
}
$deal_info = cache_deal_extra($deal_info);
init_deal_page($deal_info);
$page_size = $GLOBALS['m_config']['page_size'];
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_log where deal_id = " . $deal_info['id'] . " order by create_time desc limit " . $limit);
$log_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_log where deal_id = " . $deal_info['id']);
$url = url_wap("deal#show", array("id" => $id));
$root['url'] = $url;
$last_time_key = "";
foreach ($log_list as $k => $v) {
$log_list[$k]['image'] = get_user_avatar_root($v["user_id"], "middle");
//用户头像
//$log_list[$k]['image'] = get_abs_img_root(get_spec_image($v['image'],640,240,1));
$log_list[$k]['pass_time'] = pass_date($v['create_time']);
$online_time = online_date($v['create_time'], $deal_info['begin_time']);
$log_list[$k]['online_time'] = $online_time['info'];
$log_list[$k]['comment_data_cache'] = null;
$log_list[$k]['deal_info_cache'] = null;
if ($online_time['key'] != $last_time_key) {
$last_time_key = $log_list[$k]['online_time_key'] = $online_time['key'];
}
$log_list[$k] = cache_log_comment($log_list[$k]);
}
$root['log_list'] = $log_list;
// require APP_ROOT_PATH.'app/Lib/page.php';
// $page = new Page($log_count,$page_size); //初始化分页对象
// $p = $page->show();
// $root['pages'] = $p;
$root['page'] = array("page" => $page, "page_total" => ceil($log_count / $page_size), "page_size" => intval($page_size), 'total' => intval($log_count));
output($root);
}
示例4: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$result = do_login_user($email, $pwd);
$user_data = es_session::get('user_info');
$user_data['id'] = intval($user_data['id']);
$uid = intval($user_data['id']);
if ($uid == 0) {
$root['return'] = 0;
$root['info'] = "请先登陆";
output($root);
}
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
//输出回复
$sql = "select r.* from " . DB_PREFIX . "topic_reply as r left join " . DB_PREFIX . "topic as t on r.topic_id = t.id \r\n\t\t\t\twhere (t.user_id = " . $uid . " or r.user_id = " . $uid . ") and r.is_effect = 1 and r.is_delete = 0 \r\n\t\t\t\torder by r.create_time desc limit " . $limit;
$sql_count = "select count(*) from " . DB_PREFIX . "topic_reply as r left join " . DB_PREFIX . "topic as t on r.topic_id = t.id \r\n\t\t\t\twhere (t.user_id = " . $uid . " or r.user_id = " . $uid . ") and r.is_effect = 1 and r.is_delete = 0";
$list = $GLOBALS['db']->getAll($sql);
$total = $GLOBALS['db']->getOne($sql_count);
$comment_list = array();
foreach ($list as $k => $v) {
$comment_list[$k]['comment_id'] = $v['id'];
$comment_list[$k]['share_id'] = $v['topic_id'];
$comment_list[$k]['uid'] = $v['user_id'];
$comment_list[$k]['parent_id'] = $v['reply_id'];
$comment_list[$k]['content'] = $v['content'];
$comment_list[$k]['create_time'] = $v['create_time'];
$topic = $GLOBALS['db']->getRow("select user_name,content from " . DB_PREFIX . "topic where id = " . $v['topic_id']);
$comment_list[$k]['scontent'] = "//@" . $topic['user_name'] . ":" . $topic['content'];
$comment_list[$k]['user_name'] = $v['user_name'];
$comment_list[$k]['user_avatar'] = get_abs_img_root(get_muser_avatar($v['user_id'], "big"));
$comment_list[$k]['time'] = pass_date($v['create_time']);
$comment_list[$k]['parse_expres'] = get_parse_expres($comment_list[$k]['content'] . $comment_list[$k]['scontent']);
$comment_list[$k]['parse_user'] = get_parse_user($comment_list[$k]['content'] . $comment_list[$k]['scontent']);
}
$root['item'] = $comment_list;
$root['page'] = array("page" => $page, "page_total" => ceil($total / PAGE_SIZE));
$root['return'] = 1;
output($root);
}
示例5: index
public function index()
{
$root = array();
$root['response_code'] = 1;
$id = intval($_REQUEST['id']);
$update_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_log where id = " . $id);
$deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . intval($update_info['deal_id']) . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))");
if (!$deal_info) {
app_redirect(url("index"));
}
$deal_info = cache_deal_extra($deal_info);
init_deal_page($deal_info);
$log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_log where id = " . $id);
foreach ($log_list as $k => $v) {
$log_list[$k]['pass_time'] = pass_date($v['create_time']);
$online_time = online_date($v['create_time'], $deal_info['begin_time']);
$log_list[$k]['online_time'] = $online_time['info'];
if ($online_time['key'] != $last_time_key) {
$last_time_key = $log_list[$k]['online_time_key'] = $online_time['key'];
}
$log_list[$k]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " and deal_id = " . $deal_info['id']);
$page_size = $GLOBALS['m_config']['page_size'];
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$log_list[$k]['comment_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " and deal_id = " . $deal_info['id'] . " order by create_time desc limit " . $limit);
// require APP_ROOT_PATH.'app/Lib/page.php';
// $page = new Page($log_list[$k]['comment_count'],$page_size); //初始化分页对象
// $p = $page->show();
// $GLOBALS['tmpl']->assign('pages',$p);
$root['page'] = array("page" => $page, "page_total" => ceil($log_list[$k]['comment_count'] / $page_size), "page_size" => intval($page_size), 'total' => intval($log_list[$k]['comment_count']));
}
$root['log_list'] = $log_list;
output($root);
}
示例6: newsfav
public function newsfav()
{
$page_size = DEALUPDATE_PAGE_SIZE;
$step_size = DEALUPDATE_STEP_SIZE;
$step = intval($_REQUEST['step']);
if ($step == 0) {
$step = 1;
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
if (app_conf("INVEST_STATUS") == 0) {
$condition = " 1=1 ";
} elseif (app_conf("INVEST_STATUS") == 1) {
$condition = " de.type=0 ";
} elseif (app_conf("INVEST_STATUS") == 2) {
$condition = " de.type=1 ";
}
$sql = "select dl.* from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id left join " . DB_PREFIX . "deal as de on de.id=dl.deal_id where {$condition} and dfl.user_id = " . intval($GLOBALS['user_info']['id']) . " order by dl.create_time desc limit " . $limit;
$sql_count = "select count(*) from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id " . DB_PREFIX . "deal as de on de.id=dl.deal_id where {$condition} and dfl.user_id = " . intval($GLOBALS['user_info']['id']);
$log_list = $GLOBALS['db']->getAll($sql);
$log_count = $GLOBALS['db']->getOne($sql_count);
foreach ($log_list as $k => $v) {
$log_list[$k]['pass_time'] = pass_date($v['create_time']);
$log_list[$k] = cache_log_comment($log_list[$k]);
$log_list[$k] = cache_log_deal($log_list[$k]);
}
$GLOBALS['tmpl']->assign('log_list', $log_list);
$data['html'] = $GLOBALS['tmpl']->fetch("inc/news_item.html");
if ($step * $step_size < $page_size) {
if ($log_count <= ($page - 1) * $page_size + ($step - 1) * $step_size + $step_size) {
$data['step'] = 0;
ajax_return($data);
} else {
$data['step'] = $step + 1;
ajax_return($data);
}
} else {
$data['step'] = 0;
ajax_return($data);
}
}
示例7: deal_log_list
function deal_log_list($limit = "", $condition = "", $orderby = "d.create_time desc")
{
$log_list = $GLOBALS['db']->getAll("select l.*,d.name as deal_name from " . DB_PREFIX . "deal_log as l left join " . DB_PREFIX . "deal as d on d.id=l.deal_id where {$condition} order by {$orderby} limit " . $limit);
$full_list = array();
foreach ($log_list as $k => $v) {
if (!empty($v['id'])) {
$v['left_time'] = pass_date($v['create_time']);
$log_list[$k]['left_time'] = $v['left_time'];
if ($k <= 1) {
$deal = get_deal_list("0,1", "d.id=" . $v['deal_id']);
$v['deal_info'] = $deal['list'][0];
$full_list[] = $v;
unset($log_list[$k]);
}
}
}
return array("right_list" => $log_list, "left_list" => $full_list);
}
示例8: fav
public function fav()
{
if (!$GLOBALS['user_info']) {
app_redirect(url("user#login"));
}
$GLOBALS['tmpl']->assign("page_title", "我关注的项目动态");
$cate_result = load_dynamic_cache("INDEX_CATE_LIST");
if ($cate_result === false) {
$cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc");
$cate_result = array();
foreach ($cate_list as $k => $v) {
$cate_result[$v['id']] = $v;
}
set_dynamic_cache("INDEX_CATE_LIST", $cate_result);
}
$GLOBALS['tmpl']->assign("cate_list", $cate_result);
$rand_deals = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and begin_time < " . NOW_TIME . " and (end_time >" . NOW_TIME . " or end_time = 0) order by rand() limit 3");
$GLOBALS['tmpl']->assign("rand_deals", $rand_deals);
$page_size = DEALUPDATE_PAGE_SIZE;
$step_size = DEALUPDATE_STEP_SIZE;
$step = intval($_REQUEST['step']);
if ($step == 0) {
$step = 1;
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
$GLOBALS['tmpl']->assign("current_page", $page);
$sql = "select dl.* from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id where dfl.user_id = " . intval($GLOBALS['user_info']['id']) . " order by dl.create_time desc limit " . $limit;
$sql_count = "select count(*) from " . DB_PREFIX . "deal_log as dl left join " . DB_PREFIX . "deal_focus_log as dfl on dl.deal_id = dfl.deal_id where dfl.user_id = " . intval($GLOBALS['user_info']['id']);
$log_list = $GLOBALS['db']->getAll($sql);
$log_count = $GLOBALS['db']->getOne($sql_count);
foreach ($log_list as $k => $v) {
$log_list[$k]['pass_time'] = pass_date($v['create_time']);
$online_time = online_date($v['create_time'], $deal_info['begin_time']);
$log_list[$k]['online_time'] = $online_time['info'];
$log_list[$k]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $v['id']);
$log_list[$k]['comment_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " order by create_time desc limit 3");
if ($log_list[$k]['comment_count'] <= count($log_list[$k]['comment_list'])) {
$log_list[$k]['more_comment'] = false;
} else {
$log_list[$k]['more_comment'] = true;
}
$log_list[$k]['deal_info'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $v['deal_id']);
if ($log_list[$k]['deal_info']) {
$log_list[$k]['deal_info']['remain_days'] = floor(($log_list[$k]['deal_info']['end_time'] - NOW_TIME) / (24 * 3600));
$log_list[$k]['deal_info']['percent'] = round($log_list[$k]['deal_info']['support_amount'] / $log_list[$k]['deal_info']['limit_price'] * 100);
}
}
$GLOBALS['tmpl']->assign('log_list', $log_list);
$pager = new Page($log_count, $page_size);
//初始化分页对象
$p = $pager->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("ajaxurl", url("ajax#newsfav", array("p" => $page)));
$GLOBALS['tmpl']->display("news.html");
}
示例9: index
public function index()
{
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$cate_id = intval($GLOBALS['request']['cate_id']);
$city_id = intval($GLOBALS['request']['city_id']);
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
$ytop = $latitude_top = floatval($GLOBALS['request']['latitude_top']);
//最上边纬线值 ypoint
$ybottom = $latitude_bottom = floatval($GLOBALS['request']['latitude_bottom']);
//最下边纬线值 ypoint
$xleft = $longitude_left = floatval($GLOBALS['request']['longitude_left']);
//最左边经度值 xpoint
$xright = $longitude_right = floatval($GLOBALS['request']['longitude_right']);
//最右边经度值 xpoint
$ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
//ypoint
$xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
//xpoint
if ($GLOBALS['request']['from'] == "wap") {
/*输出分类*/
$bigcate_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "event_cate where is_effect=1 order by sort");
/*输出商圈*/
$all_quan_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "area where city_id=" . $city_id . "");
$quan_list = array();
$quan_sub_list = array();
$quan_list[0]['id'] = 0;
$quan_list[0]['name'] = '全城';
$quan_list[0]['quan_sub'][0]['id'] = 0;
$quan_list[0]['quan_sub'][0]['pid'] = 0;
$quan_list[0]['quan_sub'][0]['name'] = '全城';
foreach ($all_quan_list as $k => $v) {
if ($v['pid'] == 0) {
$quan_list[] = $v;
}
if ($v['pid'] > 0) {
$quan_sub_list[$v['pid']][] = $v;
}
}
foreach ($quan_list as $k => $v) {
if ($v['name'] != "全城") {
if ($quan_sub_list[$v['id']] == null || $quan_sub_list[$v['id']] == '') {
$quan_list[$k]['quan_sub'] = array();
} else {
$quan_list[$k]['quan_sub'] = $quan_sub_list[$v['id']];
}
}
}
$root[quan_list] = $quan_list;
}
$keyword = strim($GLOBALS['request']['keyword']);
if ($xpoint > 0) {
$pi = 3.14159265;
//圆周率
$r = 6378137;
//地球平均半径(米)
$field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance ";
if ($ybottom != 0 && $ytop != 0 && $xleft != 0 && $xright != 0) {
$where = " ypoint > {$ybottom} and ypoint < {$ytop} and xpoint > {$xleft} and xpoint < {$xright} ";
}
$order = " distance asc,is_recommend desc,sort desc,id desc";
} else {
$field_append = $where = $order = "";
}
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
if ($keyword) {
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$ukeyword = implode(" ", $kw);
$where .= " (match(name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%') ";
}
$res = m_search_event_list($limit, $cate_id, $city_id, $where, $order, $field_append);
$pattern = "/<img([^>]*)\\/>/i";
$replacement = "<img width=300 \$1 />";
foreach ($res['list'] as $k => $v) {
if ($v['ypoint'] == '') {
$res['list'][$k]['ypoint'] = 0;
}
if ($v['xpoint'] == '') {
$res['list'][$k]['xpoint'] = 0;
}
$res['list'][$k]['icon'] = get_abs_img_root(get_spec_image($v['icon'], 140, 85, 0));
$res['list'][$k]['distance'] = round($v['distance']);
$res['list'][$k]['date_time'] = pass_date($v['submit_begin_time']);
$res['list'][$k]['event_begin_time'] = to_date($v['event_begin_time'], 'Y-m-d');
$res['list'][$k]['event_end_time'] = to_date($v['event_end_time'], 'Y-m-d');
$res['list'][$k]['submit_end_time'] = to_date($v['submit_end_time'], 'Y-m-d');
$res['list'][$k]['submit_begin_time'] = to_date($v['submit_begin_time'], 'Y-m-d');
$res['list'][$k]['content'] = preg_replace($pattern, $replacement, get_abs_img_root($v['content']));
}
$root = array();
$root['bigcate_list'] = $bigcate_list;
$root['return'] = 1;
$root['item'] = $res['list'];
$root['page'] = array("page" => $page, "page_total" => ceil($res['count'] / PAGE_SIZE), "page_size" => PAGE_SIZE);
//.........这里部分代码省略.........
示例10: index
public function index()
{
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$cate_id = intval($GLOBALS['request']['cate_id']);
$city_id = intval($GLOBALS['request']['city_id']);
$ytop = $latitude_top = floatval($GLOBALS['request']['latitude_top']);
//最上边纬线值 ypoint
$ybottom = $latitude_bottom = floatval($GLOBALS['request']['latitude_bottom']);
//最下边纬线值 ypoint
$xleft = $longitude_left = floatval($GLOBALS['request']['longitude_left']);
//最左边经度值 xpoint
$xright = $longitude_right = floatval($GLOBALS['request']['longitude_right']);
//最右边经度值 xpoint
$ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
//ypoint
$xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
//xpoint
$keyword = strim($GLOBALS['request']['keyword']);
if ($xpoint > 0) {
$pi = 3.14159265;
//圆周率
$r = 6378137;
//地球平均半径(米)
$field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance ";
if ($ybottom != 0 && $ytop != 0 && $xleft != 0 && $xright != 0) {
$where = " ypoint > {$ybottom} and ypoint < {$ytop} and xpoint > {$xleft} and xpoint < {$xright} ";
}
$order = " distance asc ";
} else {
$field_append = $where = $order = "";
}
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
if ($keyword) {
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$ukeyword = implode(" ", $kw);
$where .= " (match(name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%') ";
}
$res = m_search_event_list($limit, $cate_id, $city_id, $where, $order, $field_append);
$pattern = "/<img([^>]*)\\/>/i";
$replacement = "<img width=300 \$1 />";
foreach ($res['list'] as $k => $v) {
if ($v['ypoint'] == '') {
$res['list'][$k]['ypoint'] = 0;
}
if ($v['xpoint'] == '') {
$res['list'][$k]['xpoint'] = 0;
}
$res['list'][$k]['icon'] = get_abs_img_root($v['icon']);
$res['list'][$k]['distance'] = round($v['distance']);
$res['list'][$k]['date_time'] = pass_date($v['submit_begin_time']);
$res['list'][$k]['content'] = preg_replace($pattern, $replacement, get_abs_img_root($v['content']));
}
$root = array();
$root['return'] = 1;
$root['item'] = $res['list'];
$root['page'] = array("page" => $page, "page_total" => ceil($res['count'] / PAGE_SIZE));
output($root);
}
示例11: updatedetail
public function updatedetail()
{
$id = intval($_REQUEST['id']);
$update_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_log where id = " . $id);
$deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . intval($update_info['deal_id']) . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))");
if (!$deal_info) {
app_redirect(url("index"));
}
init_deal_page($deal_info);
$log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_log where id = " . $id);
foreach ($log_list as $k => $v) {
$log_list[$k]['pass_time'] = pass_date($v['create_time']);
$online_time = online_date($v['create_time'], $deal_info['begin_time']);
$log_list[$k]['online_time'] = $online_time['info'];
if ($online_time['key'] != $last_time_key) {
$last_time_key = $log_list[$k]['online_time_key'] = $online_time['key'];
}
$log_list[$k]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " and deal_id = " . $deal_info['id']);
$page_size = DEAL_COMMENT_PAGE_SIZE;
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$log_list[$k]['comment_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " and deal_id = " . $deal_info['id'] . " order by create_time desc limit " . $limit);
require APP_ROOT_PATH . 'app/Lib/page.php';
$page = new Page($log_list[$k]['comment_count'], $page_size);
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
}
$GLOBALS['tmpl']->assign("log_list", $log_list);
$GLOBALS['tmpl']->display("deal_updatedetail.html");
}
示例12: index
public function index()
{
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
// ypoint
$xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
// xpoint
// 检查用户,用户密码
$user = $GLOBALS['user_info'];
$user_id = intval($user['id']);
if ($user_id > 0) {
$root['user_login_status'] = 1;
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
// $res =
// m_search_event_list($limit,$cate_id,$city_id,$where,$order,$field_append);
if ($xpoint > 0) {
$pi = 3.14159265;
// 圆周率
$r = 6378137;
// 地球平均半径(米)
$field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance ";
} else {
$field_append = "";
}
$count_sql = "select count(e.id) from " . DB_PREFIX . "event_submit es " . "LEFT JOIN " . DB_PREFIX . "event e on e.id= es.event_id " . " where es.user_id = " . $user_id;
$events_count = $GLOBALS['db']->getOne($count_sql);
$sql = "select e.* " . $field_append . " from " . DB_PREFIX . "event_submit es " . "LEFT JOIN " . DB_PREFIX . "event e on e.id= es.event_id " . " where es.user_id = " . $user_id . " limit " . $limit;
$events = $GLOBALS['db']->getAll($sql);
$res = array('list' => $events, 'count' => $events_count);
$pattern = "/<img([^>]*)\\/>/i";
$replacement = "<img width=300 \$1 />";
foreach ($res['list'] as $k => $v) {
if ($v['ypoint'] == '') {
$res['list'][$k]['ypoint'] = 0;
}
if ($v['xpoint'] == '') {
$res['list'][$k]['xpoint'] = 0;
}
$res['list'][$k]['icon'] = get_abs_img_root($v['icon']);
$res['list'][$k]['distance'] = round($v['distance']);
$res['list'][$k]['date_time'] = pass_date($v['submit_begin_time']);
$res['list'][$k]['event_begin_time'] = to_date($v['event_begin_time'], 'Y-m-d');
$res['list'][$k]['event_end_time'] = to_date($v['event_end_time'], 'Y-m-d');
$res['list'][$k]['content'] = preg_replace($pattern, $replacement, get_abs_img_root($v['content']));
}
$root = array();
$root['return'] = 1;
$root['item'] = $res['list'];
$root['page'] = array("page" => $page, "page_total" => ceil($res['count'] / PAGE_SIZE), "page_size" => PAGE_SIZE);
$root['page_title'] = "活动列表";
output($root);
} else {
$root['user_login_status'] = 0;
$root['status'] = 0;
$root['info'] = '请先登录';
output($root);
}
}
示例13: update
public function update()
{
$id = intval($_REQUEST['id']);
$deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))");
$deal_info['deal_type'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id=" . $deal_info['cate_id']);
if (!$deal_info) {
app_redirect(url_wap("index"));
}
$deal_info = cache_deal_extra($deal_info);
init_deal_page_wap($deal_info);
$page_size = 15;
$step_size = 5;
$step = intval($_REQUEST['step']);
if ($step == 0) {
$step = 1;
}
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size;
$GLOBALS['tmpl']->assign("current_page", $page);
$log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_log where deal_id = " . $deal_info['id'] . " order by create_time desc limit " . $limit);
$log_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_log where deal_id = " . $deal_info['id']);
if (!$log_list || ($page - 1) * $page_size + ($step - 1) * $step_size + count($log_list) >= $log_count) {
//最后一页
$log_list[] = array("deal_id" => $deal_info['id'], "create_time" => $deal_info['begin_time'] + 1, "id" => 0);
}
$last_time_key = "";
foreach ($log_list as $k => $v) {
$log_list[$k]['pass_time'] = pass_date($v['create_time']);
$online_time = online_date($v['create_time'], $deal_info['begin_time']);
$log_list[$k]['online_time'] = $online_time['info'];
if ($online_time['key'] != $last_time_key) {
$last_time_key = $log_list[$k]['online_time_key'] = $online_time['key'];
}
$log_list[$k] = cache_log_comment($log_list[$k]);
}
$GLOBALS['tmpl']->assign("log_list", $log_list);
require APP_ROOT_PATH . 'wap/app/page.php';
$page = new Page($log_count, $page_size);
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->display("deal_update.html");
}
示例14: detail
public function detail()
{
$dp_id = intval($_REQUEST['id']);
$page = intval($_REQUEST['p']);
$review_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $dp_id);
if (!$review_item) {
app_redirect(url("index", "index"));
}
//验证是否为当前商家会员管理的点评
$s_account_info = es_session::get("account_info");
if (in_array($review_item['supplier_location_id'], $s_account_info['location_ids']) && $review_item['from_data'] != "") {
$is_admin = 1;
$GLOBALS['tmpl']->assign("is_admin", $is_admin);
}
$review_item = sys_get_dp_detail($review_item);
$store_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $review_item['supplier_location_id']);
//供应商的地址列表
//定义location_id
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier_location where id = " . $review_item['supplier_location_id']);
$json_location = array();
$location_ids = array(0);
foreach ($locations as $litem) {
$location_ids[] = $litem['id'];
$arr = array();
$arr['title'] = $litem['name'];
$arr['address'] = $litem['address'];
$arr['tel'] = $litem['tel'];
$arr['lng'] = $litem['xpoint'];
$arr['lat'] = $litem['ypoint'];
$json_location[] = $arr;
}
$GLOBALS['tmpl']->assign("json_location", json_encode($json_location));
$GLOBALS['tmpl']->assign("locations", $locations);
$GLOBALS['tmpl']->assign("store_info", $store_info);
//输出回应列表
$sql_count = "select count(*) from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id;
$count = $GLOBALS['db']->getOne($sql_count);
$page_size = app_conf("PAGE_SIZE");
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$sql = "select * from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id . " order by create_time desc limit " . $limit;
$reply_list = $GLOBALS['db']->getAll($sql);
foreach ($reply_list as $k => $v) {
$reply_list[$k]['user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $v['user_id']);
$reply_list[$k]['create_time_format'] = pass_date($v['create_time']);
}
$page = new Page($count, $page_size);
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign('reply_list', $reply_list);
$GLOBALS['tmpl']->assign('user_auth', get_user_auth());
$review_list_html = decode_topic($GLOBALS['tmpl']->fetch('inc/review/reply_list.html'));
$GLOBALS['tmpl']->assign('review_list_html', $review_list_html);
$GLOBALS['tmpl']->assign('review_item', $review_item);
$GLOBALS['tmpl']->display('review_detail.html');
}
示例15: m_get_topic_item
function m_get_topic_item($topic)
{
$share_item['share_id'] = $topic['id'];
$share_item['uid'] = $topic['user_id'];
$share_item['user_name'] = $topic['user_name'];
if ($topic['fav_id'] > 0) {
$share_item['content'] = "我喜欢这个,谢谢你的分享[爱心]";
} else {
$share_item['content'] = $topic['content'];
}
$share_item['share_content'] = msubstr($topic['content']) . get_domain() . str_replace("sjmapi/", "", url("index", "topic", array("id" => $topic['id'])));
$share_item['collect_count'] = $topic['fav_count'];
$share_item['comment_count'] = $topic['reply_count'];
$share_item['relay_count'] = $topic['relay_count'];
$share_item['click_count'] = $topic['click_count'];
$share_item['title'] = $topic['title'];
$share_item['type'] = 'default';
$share_item['share_data'] = 'photo';
if ($topic['source_type'] == 0) {
$source_name = "来自" . app_conf("SHOP_TITLE") . $topic['source_name'];
} else {
$source_name = "来自" . $topic['source_name'];
}
$share_item['source'] = $source_name;
$share_item['time'] = pass_date($topic['create_time']);
$share_item['parse_expres'] = get_parse_expres($topic['content']);
$share_item['parse_user'] = get_parse_user($topic['content']);
$share_item['user_avatar'] = get_abs_img_root(get_muser_avatar($topic['user_id'], "big"));
$share_item['imgs'] = m_get_topic_list_img($topic);
if ($topic['fav_id'] > 0 || $topic['relay_id'] > 0) {
$share_item['is_relay'] = 1;
}
$share_item['user'] = array("uid" => $topic['user_id'], "user_name" => $topic['user_name'], "user_avatar" => $share_item['user_avatar']);
return $share_item;
}