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); }
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 = " . $user_id . "))"); $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; $comment_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where deal_id = " . $id . " and log_id = 0 order by create_time desc limit " . $limit); // $comment_list = $GLOBALS['db']->getAll("select * from // ".DB_PREFIX."deal_comment where deal_id = ".$id." and log_id = 0 // order by create_time desc "); $comment_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where deal_id = " . $id . " and log_id = 0"); foreach ($comment_list as $k => $v) { $comment_list[$k]['create_time'] = to_date($v['create_time'], 'Y-m-d'); $comment_list[$k]["image"] = get_user_avatar_root($v["user_id"], "middle"); $comment_list[$k]["url"] = url_root("home", array("id" => $v["user_id"])); } $root['comment_list'] = $comment_list; $root['comment_count'] = $comment_count; // require APP_ROOT_PATH.'app/Lib/page.php'; // $page = new Page($comment_count,$page_size); //初始化分页对象 // $p = $page->show(); // $root['pages'] = $p; $root['page'] = array("page" => $page, "page_total" => ceil($comment_count / $page_size), "page_size" => intval($page_size), 'total' => intval($comment_count)); output($root); }
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); }
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"); }
public function info() { //获取项目的ID $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")); } if ($deal_info['is_effect'] == 1) { log_deal_visit($deal_info['id']); } $deal_info = cache_deal_extra($deal_info); init_deal_page($deal_info); $GLOBALS['tmpl']->assign("deal_index_url", url_wap("deal#index", array("id" => $id))); $GLOBALS['tmpl']->assign("usermessage_url", url_wap("ajax#usermessage", array("id" => $deal_info['user_id']))); $GLOBALS['tmpl']->assign("home_url", url_wap("deal#home", array("id" => $deal_info['user_id']))); $GLOBALS['tmpl']->assign("deal_info", $deal_info); $GLOBALS['tmpl']->display("deal_info.html"); }