public function index() { global $tmpl; $rel_table = addslashes(trim($_REQUEST['act'])); $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "' and type_name <> 'supplier'"); if (!$message_type || $message_type['is_fix'] == 0) { app_redirect(APP_ROOT . "/"); } $rel_table = $message_type['type_name']; $condition = ''; $id = intval($_REQUEST['id']); if ($rel_table == 'deal') { $deal = get_deal($id); if ($deal['buy_type'] != 1) { $GLOBALS['tmpl']->assign("deal", $deal); } $id = $deal['id']; } require APP_ROOT_PATH . 'app/Lib/side.php'; if ($id > 0) { $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; } else { $condition = "rel_table = '" . $rel_table . "'"; } if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } $condition .= " and is_buy = " . intval($_REQUEST['is_buy']); //message_form 变量输出 $GLOBALS['tmpl']->assign("post_title", $message_type['show_name']); $GLOBALS['tmpl']->assign("page_title", $message_type['show_name']); $GLOBALS['tmpl']->assign('rel_id', $id); $GLOBALS['tmpl']->assign('rel_table', $rel_table); $GLOBALS['tmpl']->assign('is_buy', intval($_REQUEST['is_buy'])); if (intval($_REQUEST['is_buy']) == 1) { $GLOBALS['tmpl']->assign("post_title", $GLOBALS['lang']['AFTER_BUY']); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['AFTER_BUY']); } if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $message = get_message_list($limit, $condition); $page = new Page($message['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("message_list", $message['list']); $GLOBALS['tmpl']->assign("user_auth", get_user_auth()); $GLOBALS['tmpl']->display("message.html"); }
public function index() { //分页 $page = intval($GLOBALS['request']['p']); if ($page == 0) { $page = 1; } $deal_id = intval($_REQUEST['deal_id']); $rel_table = 'deal'; $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $deal_id; if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { //留言是否需要审核 $message_type = $GLOBALS['db']->getOne("select is_effect from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "'"); if ($message_type == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } $root = array(); //分页 $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $msg_condition = $condition . " AND is_effect = 1 "; $message = get_message_list($limit, $msg_condition); $root['page'] = array("page" => $page, "page_total" => ceil($message['count'] / app_conf("PAGE_SIZE"))); foreach ($message['list'] as $k => $v) { $msg_sub = get_message_list("", "pid=" . $v['id'], false); $message['list'][$k]["sub"] = $msg_sub["list"]; } $root['response_code'] = 1; //$root['show_err'] = ; //当response_code != 0 时,返回:错误内容 $root['message_list'] = $message['list']; output($root); }
function get_side_message() { $where = "rel_table = 'faq'"; if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $where .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name = 'faq'"); if ($message_type['is_effect'] == 0) { $where .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } $side_message = get_message_list(app_conf("SIDE_MESSAGE_COUNT"), $where); foreach ($side_message['list'] as $k => $v) { $side_message['list'][$k]['url'] = url("tuan", "message#faq") . "#consult-entry-" . $v['id']; $side_message['list'][$k]['content'] = empty_tag($v['content']); } return $side_message; }
$order_info = array(); /* 获取用户留言的数量 */ if ($order_id) { $sql = "SELECT COUNT(*) FROM " . $ecs->table('feedback') . " WHERE parent_id = 0 AND order_id = '{$order_id}'"; $order_info = $db->getRow("SELECT * FROM " . $ecs->table('order_info') . " WHERE order_id = '{$order_id}'"); $order_info['url'] = 'user.php?act=order_detail&order_id=' . $order_id; } else { $sql = "SELECT COUNT(*) FROM " . $ecs->table('feedback') . " WHERE parent_id = 0 AND user_id = '{$user_id}' AND user_name = '" . $_SESSION['user_name'] . "' AND order_id=0"; } $record_count = $db->getOne($sql); $act = array('act' => $action); if ($order_id != '') { $act['order_id'] = $order_id; } $pager = get_pager('user.php', $act, $record_count, $page, 5); $smarty->assign('message_list', get_message_list($user_id, $_SESSION['user_name'], $pager['size'], $pager['start'], $order_id)); $smarty->assign('pager', $pager); $smarty->assign('order_info', $order_info); $smarty->display('user_clips.dwt'); } elseif ($action == 'comment_list') { include_once ROOT_PATH . 'includes/lib_clips.php'; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; /* 获取用户留言的数量 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('comment') . " WHERE parent_id = 0 AND user_id = '{$user_id}'"; $record_count = $db->getOne($sql); $pager = get_pager('user.php', array('act' => $action), $record_count, $page, 5); $smarty->assign('comment_list', get_comment_list($user_id, $pager['size'], $pager['start'])); $smarty->assign('pager', $pager); $smarty->display('user_clips.dwt'); } elseif ($action == 'act_add_message') { include_once ROOT_PATH . 'includes/lib_clips.php';
function action_message_list() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; include_once ROOT_PATH . 'includes/lib_clips.php'; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $order_id = empty($_GET['order_id']) ? 0 : intval($_GET['order_id']); $order_info = array(); /* 获取用户留言的数量 */ if ($order_id) { $sql = "SELECT COUNT(*) FROM " . $ecs->table('feedback') . " WHERE parent_id = 0 AND order_id = '{$order_id}' AND user_id = '{$user_id}'"; $order_info = $db->getRow("SELECT * FROM " . $ecs->table('order_info') . " WHERE order_id = '{$order_id}' AND user_id = '{$user_id}'"); $order_info['url'] = 'user.php?act=order_detail&order_id=' . $order_id; } else { $sql = "SELECT COUNT(*) FROM " . $ecs->table('feedback') . " WHERE parent_id = 0 AND user_id = '{$user_id}' AND user_name = '" . $_SESSION['user_name'] . "' AND order_id=0"; } $record_count = $db->getOne($sql); $act = array('act' => $action); if ($order_id != '') { $act['order_id'] = $order_id; } $pager = get_pager('user.php', $act, $record_count, $page, 5); $smarty->assign('message_list', get_message_list($user_id, $_SESSION['user_name'], $pager['size'], $pager['start'], $order_id)); $smarty->assign('pager', $pager); $smarty->assign('order_info', $order_info); $smarty->display('user_clips.dwt'); }
/*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { $smarty->assign('full_page', 1); $smarty->assign('ur_here', $_LANG['msg_list']); $smarty->assign('action_link', array('text' => $_LANG['send_msg'], 'href' => 'message.php?act=send')); $list = get_message_list(); $smarty->assign('message_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); assign_query_info(); $smarty->display('message_list.htm'); } elseif ($_REQUEST['act'] == 'query') { $list = get_message_list(); $smarty->assign('message_list', $list['item']); $smarty->assign('filter', $list['filter']); $smarty->assign('record_count', $list['record_count']); $smarty->assign('page_count', $list['page_count']); $sort_flag = sort_flag($list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); make_json_result($smarty->fetch('message_list.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } elseif ($_REQUEST['act'] == 'send') { /* 获取管理员列表 */ $admin_list = $db->getAll('SELECT user_id, user_name FROM ' . $ecs->table('admin_user')); $smarty->assign('ur_here', $_LANG['send_msg']); $smarty->assign('action_link', array('href' => 'message.php?act=list', 'text' => $_LANG['msg_list'])); $smarty->assign('action', 'add'); $smarty->assign('form_act', 'insert'); $smarty->assign('admin_list', $admin_list);
public function mobile() { /*if(!$GLOBALS['user_info']){ set_gopreview(); app_redirect(url("index","user#login")); }*/ $id = intval($_REQUEST['id']); $deal = get_deal($id); send_deal_contract_email($id, $deal, $deal['user_id']); if (!$deal) { app_redirect(url("index")); } //借款列表 $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $id); $u_info = get_user("*", $deal['user_id']); //可用额度 $can_use_quota = get_can_use_quota($deal['user_id']); $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota); $credit_file = get_user_credit_file($deal['user_id']); $deal['is_faved'] = 0; if ($GLOBALS['user_info']) { $deal['is_faved'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_collect WHERE deal_id = " . $id . " AND user_id=" . intval($GLOBALS['user_info']['id'])); if ($deal['deal_status'] >= 4) { //还款列表 $loan_repay_list = get_deal_load_list($deal); $GLOBALS['tmpl']->assign("loan_repay_list", $loan_repay_list); foreach ($load_list as $k => $v) { $load_list[$k]['remain_money'] = $v['money'] - $GLOBALS['db']->getOne("SELECT sum(self_money) FROM " . DB_PREFIX . "deal_load_repay WHERE user_id=" . $v['user_id'] . " AND deal_id=" . $id); if ($load_list[$k]['remain_money'] <= 0) { $load_list[$k]['remain_money'] = 0; $load_list[$k]['status'] = 1; } } } $user_statics = sys_user_status($deal['user_id'], true); $GLOBALS['tmpl']->assign("user_statics", $user_statics); } $GLOBALS['tmpl']->assign("load_list", $load_list); $GLOBALS['tmpl']->assign("credit_file", $credit_file); $GLOBALS['tmpl']->assign("u_info", $u_info); //工作认证是否过期 $GLOBALS['tmpl']->assign('expire', user_info_expire($u_info)); if ($deal['type_match_row']) { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; } else { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']; } $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $GLOBALS['tmpl']->assign("seo_description", $seo_description . ","); //留言 require APP_ROOT_PATH . 'app/Lib/message.php'; require APP_ROOT_PATH . 'app/Lib/page.php'; $rel_table = 'deal'; $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "'"); $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } //message_form 变量输出 $GLOBALS['tmpl']->assign('rel_id', $id); $GLOBALS['tmpl']->assign('rel_table', "deal"); //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $msg_condition = $condition . " AND is_effect = 1 "; $message = get_message_list($limit, $msg_condition); $page = new Page($message['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); foreach ($message['list'] as $k => $v) { $msg_sub = get_message_list("", "pid=" . $v['id'], false); $message['list'][$k]["sub"] = $msg_sub["list"]; } $GLOBALS['tmpl']->assign("message_list", $message['list']); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->display("deal_mobile.html"); }
public function detail() { /*if(!$GLOBALS['user_info']){ app_redirect(url("index","user#login")); }*/ set_gopreview(); $id = intval($_REQUEST['id']); $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id); if ($deal_id == 0) { echo "不存在的债权"; die; } $deal = get_deal($deal_id); syn_transfer_status($id); $deal['yq_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_repay WHERE has_repay = 1 and deal_id=" . $deal_id . " AND status >= 2"); $GLOBALS['tmpl']->assign('deal', $deal); //借款列表 $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $deal_id); $u_info = get_user("*", $deal['user_id']); if ($deal['view_info'] != "") { $view_info_list = unserialize($deal['view_info']); $GLOBALS['tmpl']->assign('view_info_list', $view_info_list); } //可用额度 $can_use_quota = get_can_use_quota($deal['user_id']); $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota); $credit_file = get_user_credit_file($deal['user_id']); $deal['is_faved'] = 0; if ($GLOBALS['user_info']) { if ($u_info['user_type'] == 1) { $company = $GLOBALS['db']->getRowCached("SELECT * FROM " . DB_PREFIX . "user_company WHERE user_id=" . $u_info['id']); } if ($deal['deal_status'] >= 4) { //还款列表 $loan_repay_list = get_deal_load_list($deal); $GLOBALS['tmpl']->assign("loan_repay_list", $loan_repay_list); if ($loan_repay_list) { $temp_self_money_list = $GLOBALS['db']->getAllCached("SELECT sum(self_money) as total_money,u_key FROM " . DB_PREFIX . "deal_load_repay WHERE has_repay=1 AND deal_id=" . $id . " group by u_key "); $self_money_list = array(); foreach ($temp_self_money_list as $k => $v) { $self_money_list[$v['u_key']] = $v['total_money']; } foreach ($load_list as $k => $v) { $load_list[$k]['remain_money'] = $v['money'] - $self_money_list[$k]; if ($load_list[$k]['remain_money'] <= 0) { $load_list[$k]['remain_money'] = 0; $load_list[$k]['status'] = 1; } } } } $user_statics = sys_user_status($deal['user_id'], true); $GLOBALS['tmpl']->assign("user_statics", $user_statics); $GLOBALS['tmpl']->assign("company", $company); } $GLOBALS['tmpl']->assign("load_list", $load_list); $GLOBALS['tmpl']->assign("credit_file", $credit_file); $GLOBALS['tmpl']->assign("u_info", $u_info); //工作认证是否过期 $GLOBALS['tmpl']->assign('expire', user_info_expire($u_info)); //留言 require APP_ROOT_PATH . 'app/Lib/message.php'; require APP_ROOT_PATH . 'app/Lib/page.php'; $rel_table = 'transfer'; $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "'"); $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } //message_form 变量输出 $GLOBALS['tmpl']->assign('rel_id', $id); $GLOBALS['tmpl']->assign('rel_table', $rel_table); //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $msg_condition = $condition . " AND is_effect = 1 "; $message = get_message_list($limit, $msg_condition); $page = new Page($message['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); foreach ($message['list'] as $k => $v) { $msg_sub = get_message_list("", "pid=" . $v['id'], false); $message['list'][$k]["sub"] = $msg_sub["list"]; } $GLOBALS['tmpl']->assign("message_list", $message['list']); //================================================== $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; $transfer = get_transfer($union_sql, $condition); $GLOBALS['tmpl']->assign('transfer', $transfer); if ($deal['type_match_row']) { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; } else { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']; } $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['TRANSFER'] . " - " . $seo_title); $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['TRANSFER'] . "," . $seo_keyword . ","); $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $GLOBALS['tmpl']->assign("seo_description", $GLOBALS['lang']['TRANSFER'] . "," . $seo_description . ","); $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->display("page/transfer.html"); }
$record_count = $db->getOne($sql); $act = array('act' => $action); if ($order_id != '') { $act['order_id'] = $order_id; } $pager = get_pager('user.php', $act, $record_count, $page, 5); $smarty->assign('message_list', get_message_list($user_id, $_SESSION['user_name'], $pager['size'], $pager['start'], $order_id)); $smarty->assign('pager', $pager); $smarty->assign('order_info', $order_info); $smarty->display('user_clips.dwt'); } elseif ($action == 'async_message_list') { include_once ROOT_PATH . 'include/lib_clips.php'; $order_id = empty($_GET['order_id']) ? 0 : intval($_GET['order_id']); $start = $_POST['last']; $limit = $_POST['amount']; $message_list = get_message_list($user_id, $_SESSION['user_name'], $limit, $start, $order_id); if (is_array($message_list)) { foreach ($message_list as $key => $vo) { $re_message = $vo['re_msg_content'] ? '<tr><td>' . $_LANG['shopman_reply'] . ' (' . $vo['re_msg_time'] . ')<br>' . $vo['re_msg_content'] . '</td></tr>' : ''; $asyList[] = array('message' => '<table width="100%" border="0" cellpadding="5" cellspacing="0" class="ectouch_table_no_border"> <tr> <td><span style="float:right"><a href="user.php?act=del_msg&id=' . $key . '&order_id=' . $vo['order_id'] . '" onclick="if (!confirm(\'' . $_LANG['confirm_remove_msg'] . '\')) return false;" style="color:#1CA2E1">删除</a></span>' . $vo['msg_type'] . ':' . $vo['msg_title'] . ' - ' . $vo['msg_time'] . ' </td> </tr> <tr> <td>' . $vo['msg_content'] . '</td> </tr>' . $re_message . ' </table>'); } } echo json_encode($asyList);
<?php /** * Created by PhpStorm. * User: Pal * Date: 2015/11/13 * Time: 19:04 */ include_once 'linkstart.php'; if (is_login()) { show_head('所有状态'); } else { show_head('最新状态(登录后查看所有内容)'); } show_bar(2); echo '<div class="container">'; show_alert(); echo ' </div>'; //show_send_message(); if (is_login()) { show_message_list(get_message_list()); } else { show_message_list(get_message_list(10)); } show_foot();
public function index() { global $tmpl; //获取当前页的团购商品 $id = addslashes(trim($_REQUEST['id'])); $uname = addslashes(trim($_REQUEST['id'])); $preview = intval($_REQUEST['preview']); if ($id == 0 && $uname == '') { app_redirect(url("tuan", "index")); } //获取当前页的团购商品 if ($preview > 0) { $deal = get_deal_show($id, 0, 0, $preview); $adm_session = es_session::get(md5(app_conf("AUTH_KEY"))); $adm_name = $adm_session['adm_name']; $adm_id = intval($adm_session['adm_id']); if ($adm_id == 0) { //验证是否当前的商家(不是后台管理员) $s_account_info = es_session::get("account_info"); if ($s_account_info) { foreach ($s_account_info['location_ids'] as $id) { $location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id); if ($location) { $locations[] = $location; } } $deal_test = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . intval($deal['id']) . " and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if (!$deal_test) { showErr("产品不存在或者没有预览该产品的权限", 0, APP_ROOT . "/"); } } else { showErr("您不是系统管理员或者商家会员,无法预览", 0, APP_ROOT . "/"); } } } else { $deal = get_deal_show($id); } jump_deal($deal, MODULE_NAME); if ($deal['buy_type'] == 1) { app_redirect(url("tuan", "index")); } if ($deal['is_effect'] == 0 && $preview == 0 && $adm_id == 0) { app_redirect(url("tuan", "index")); } $GLOBALS['tmpl']->assign("deal", $deal); //供应商的地址列表 $GLOBALS['tmpl']->assign("json_location", $deal['json_location']); $GLOBALS['tmpl']->assign("locations", $deal['locations']); require_once './app/Lib/side.php'; //读取边栏信息,需放在deal数据的分配之后 $coupon_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where deal_id = " . intval($deal['id']) . " and is_new = 0 and is_valid = 1 and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign("coupon_data", $coupon_data); if (app_conf("SHOW_DEAL_CATE") == 1) { $deal_cate_id = intval($deal['cate_id']); $GLOBALS['tmpl']->assign("is_index", 1); $GLOBALS['tmpl']->assign("hide_sort", 1); $cache_param = array("id" => $deal_cate_id, "tid" => 0, "qid" => 0, "city_id" => intval($GLOBALS['deal_city']['id'])); $filter_nav_data = load_auto_cache("tuan_filter_nav_cache", $cache_param); $GLOBALS['tmpl']->assign('bquan_list', $filter_nav_data['bquan_list']); //开始输出分类 $GLOBALS['tmpl']->assign("bcate_list", $filter_nav_data['bcate_list']); } //输出促销 if ($deal['allow_promote'] == 1) { $promote = load_auto_cache("cache_promote"); $GLOBALS['tmpl']->assign("promote", $promote); } //输出团购的留言 $rel_table = "deal"; $condition = ''; $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } $before_sale_condition = $condition . " and is_buy = 0"; $after_sale_condition = $condition . " and is_buy = 1"; $limit = "15"; $before_sale_message = get_message_list($limit, $before_sale_condition); $after_sale_message = get_message_list($limit, $after_sale_condition); $GLOBALS['tmpl']->assign("user_auth", get_user_auth()); $GLOBALS['tmpl']->assign("message_list", $before_sale_message['list']); $before_message_html = load_message_list(); $GLOBALS['tmpl']->assign("message_list", $after_sale_message['list']); $after_message_html = load_message_list(); $GLOBALS['tmpl']->assign("before_message_html", $before_message_html); $GLOBALS['tmpl']->assign("after_message_html", $after_message_html); //end 留言 if ($deal) { $GLOBALS['tmpl']->assign("page_title", $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']); $GLOBALS['tmpl']->assign("page_keyword", $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['name']); $GLOBALS['tmpl']->assign("page_description", $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']); $GLOBALS['tmpl']->display("deal.html"); } else { $GLOBALS['tmpl']->assign("page_title", "没有相关的团购"); $GLOBALS['tmpl']->assign("page_keyword", "没有相关的团购"); $GLOBALS['tmpl']->assign("page_description", "没有相关的团购"); $GLOBALS['tmpl']->display("no_deal.html"); } }
public function index() { global $tmpl; //获取当前页的团购商品列表 //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("DEAL_PAGE_SIZE") . "," . app_conf("DEAL_PAGE_SIZE"); //分类 $cate_id = intval($_REQUEST['id']); $uname = addslashes(trim($_REQUEST['id'])); if ($cate_id == 0 && $uname != '') { $cate_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "deal_cate where uname = '" . $uname . "'"); } $sort_field = es_cookie::get("sort_field") ? es_cookie::get("sort_field") : "sort"; $sort_type = es_cookie::get("sort_type") ? es_cookie::get("sort_type") : "desc"; $sort_type = es_cookie::get("shop_sort_type") ? es_cookie::get("shop_sort_type") : "desc"; if ($sort_field != "end_time" && $sort_field != "current_price" && $sort_field != "buy_count" && $sort_field != "sort") { $sort_field = "sort"; } if ($sort_type != "desc" && $sort_type != "asc") { $sort_type = "desc"; } $act = trim($_REQUEST['act']); //显示的类型 if ($act == 'history') { $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['DEAL_HISTORY_LIST']); $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['DEAL_HISTORY_LIST']); $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['DEAL_HISTORY_LIST']); $type = array(DEAL_HISTORY); } elseif ($act == 'notice') { $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['DEAL_NOTICE_LIST']); $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['DEAL_NOTICE_LIST']); $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['DEAL_NOTICE_LIST']); $type = array(DEAL_NOTICE); } elseif ($act == 'comment') { $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['DEAL_COMMENT']); $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['DEAL_COMMENT']); $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['DEAL_COMMENT']); $type = array(DEAL_NOTICE, DEAL_ONLINE, DEAL_HISTORY); } else { $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['DEAL_LIST']); $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['DEAL_LIST']); $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['DEAL_LIST']); $type = array(DEAL_ONLINE, DEAL_HISTORY); } if (app_conf("SHOW_DEAL_CATE") == 1) { //输出分类 $deal_cates_db = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate where is_delete = 0 and is_effect = 1 order by sort desc"); $deal_cates = array(); if ($act == 'history' || $act == 'notice') { $url = url("tuan", "deals#" . $act); } else { $url = url("tuan", "deals"); } $deal_cates[] = array('id' => 0, 'name' => $GLOBALS['lang']['ALL'], 'current' => $cate_id == 0 ? 1 : 0, 'url' => $url); foreach ($deal_cates_db as $k => $v) { if ($cate_id == $v['id']) { $v['current'] = 1; } if ($act == 'history' || $act == 'notice') { $v['url'] = url("tuan", "deals#" . $act, array("id" => $v['id'])); } else { $v['url'] = url("tuan", "deals", array("id" => $v['id'])); } $deal_cates[] = $v; } $GLOBALS['tmpl']->assign("deal_cate_list", $deal_cates); } //获取搜索字段 $no_deal_page = "no_deal.html"; $condition = ' buy_type<>1 '; if ($_REQUEST['search']) { $search_code = unserialize(base64_decode($_REQUEST['search'])); if ($search_code['se_name'] != '') { $condition .= " and name like '%" . $search_code['se_name'] . "%' "; $no_deal_page = 'deals.html'; $GLOBALS['tmpl']->assign("se_name", $search_code['se_name']); } if ($search_code['se_begin'] != 0) { $condition .= " and (begin_time > " . intval($search_code['se_begin']) . " or begin_time = 0) "; $no_deal_page = 'deals.html'; $GLOBALS['tmpl']->assign("se_begin", to_date($search_code['se_begin'], 'Y-m-d')); } if ($search_code['se_end'] != 0) { $condition .= " and (end_time < " . intval($search_code['se_end']) . " or end_time = 0) "; $no_deal_page = 'deals.html'; $GLOBALS['tmpl']->assign("se_end", to_date($search_code['se_end'], 'Y-m-d')); } } $deals = get_deal_list_show($limit, $cate_id, 0, $type, $condition, $sort_field . " " . $sort_type); if ($act == 'comment') { foreach ($deals['list'] as $k => $v) { $deals['list'][$k]['before_buy'] = get_message_list(2, "rel_table='deal' and rel_id=" . $v['id'] . " and is_buy = 0"); $deals['list'][$k]['after_buy'] = get_message_list(2, "rel_table='deal' and rel_id=" . $v['id'] . " and is_buy = 1"); } } $GLOBALS['tmpl']->assign("deals", $deals['list']); $page = new Page($deals['count'], app_conf("DEAL_PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); require './app/Lib/side.php'; //读取边栏信息,需放在deal数据的分配之后 $GLOBALS['tmpl']->assign('sort_field', $sort_field); $GLOBALS['tmpl']->assign('sort_type', $sort_type); if (es_cookie::get("list_type") === null) { $list_type = app_conf("LIST_TYPE"); } else { $list_type = intval(es_cookie::get("list_type")); } $GLOBALS['tmpl']->assign("list_type", $list_type); if ($deals['list']) { if ($act == 'comment') { $GLOBALS['tmpl']->display("deals_comment.html"); } else { if ($list_type == 1) { $GLOBALS['tmpl']->display("deals_grid.html"); } else { $GLOBALS['tmpl']->display("deals.html"); } } } else { if ($act == 'comment') { $GLOBALS['tmpl']->display("deals_comment.html"); } else { $GLOBALS['tmpl']->display($no_deal_page); } } }
public function index() { $root = array(); //set_gopreview(); $deal_id = intval($GLOBALS['request']['id']); $root['deal_id'] = $deal_id; if ($deal_id == 0) { echo "不存在的债权"; die; } $deal = get_deal($deal_id); //syn_transfer_status($id); $deal['yq_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_repay WHERE has_repay = 1 and deal_id=" . $deal_id . " AND status >= 2"); $root['deal'] = $deal; //借款列表 $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $deal_id); $u_info = get_user("*", $deal['user_id']); //可用额度 $can_use_quota = get_can_use_quota($deal['user_id']); $root['can_use_quota'] = $can_use_quota; $credit_file = get_user_credit_file($deal['user_id']); $deal['is_faved'] = 0; $user_statics = sys_user_status($deal['user_id'], true); $root['user_statics'] = $user_statics; $root['load_list'] = $load_list; $root['credit_file'] = $credit_file; $root['u_info'] = $u_info; //工作认证是否过期 $root['expire'] = user_info_expire($u_info); //留言 $message_list = $GLOBALS['db']->getAll("SELECT title,content,a.create_time,rel_id,a.user_id,a.is_effect,b.user_name FROM " . DB_PREFIX . "message as a left join " . DB_PREFIX . "user as b on a.user_id = b.id WHERE rel_id = " . $id); $root['message'] = $message_list; /* //分页 $page = intval($_REQUEST['p']); if($page==0) $page = 1; $limit = (($page-1)*app_conf("PAGE_SIZE")).",".app_conf("PAGE_SIZE"); $msg_condition = $condition." AND is_effect = 1 "; $message = get_message_list($limit,$msg_condition); $page = new Page($message['count'],app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $root['pages']= $p; */ foreach ($message['list'] as $k => $v) { $msg_sub = get_message_list("", "pid=" . $v['id'], false); $message['list'][$k]["sub"] = $msg_sub["list"]; } $root['message_list'] = $message['list']; $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; $transfer = get_transfer($union_sql, $condition); $root['transfer'] = $transfer; if ($deal['type_match_row']) { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; } else { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']; } $root['page_title'] = $seo_title; $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $root['page_keyword'] = $seo_keyword; $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $root['seo_description'] = $seo_description; output($root); }