assign('priv_ru', 1); }else{ $smarty->assign('priv_ru', 0); } //ecmoban模板堂 --zhuo end /*------------------------------------------------------ */ //-- 满意度列表 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'list') { /* 检查权限 */ admin_priv('comment_seller'); $smarty->assign('ur_here', '商家满意度'); $smarty->assign('full_page', 1); $list = comment_seller_list(); $smarty->assign('rank_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('comment_seller_rank.htm'); } /*------------------------------------------------------ */ //-- 翻页、搜索、排序 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'query') { /* 检查权限 */ admin_priv('comment_seller'); $list = comment_seller_list(); $smarty->assign('rank_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('comment_seller_rank.htm'), '', array('filter' => $list['filter'], 'page_count' => $list['page_count'])); } /** * 商家满意度评分 * @access public * @return array */ function comment_seller_list() { /* 查询条件 */ $filter['keywords'] = empty($_REQUEST['keywords']) ? 0 : trim($_REQUEST['keywords']); if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) { $filter['keywords'] = json_str_iconv($filter['keywords']); } $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'add_time' : trim($_REQUEST['sort_by']); $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); $where = "1"; $where .= (!empty($filter['keywords'])) ? " AND (sp.shop_name LIKE '%" . mysql_like_quote($filter['keywords']) . "%') " : ''; $sql = "SELECT count(*) FROM " .$GLOBALS['ecs']->table('comment_seller'). " AS s ". "LEFT JOIN ". $GLOBALS['ecs']->table('seller_shopinfo') ." AS sp ON sp.ru_id = s.ru_id ". "WHERE $where"; $filter['record_count'] = $GLOBALS['db']->getOne($sql); /* 分页大小 */ $filter = page_and_size($filter); /* 获取评论数据 */ $arr = array(); $sql = "SELECT s.*,o.order_sn,u.user_name FROM " .$GLOBALS['ecs']->table('comment_seller'). " AS s " . "LEFT JOIN ". $GLOBALS['ecs']->table('order_info') ." AS o ON o.order_id = s.order_id ". "LEFT JOIN ". $GLOBALS['ecs']->table('seller_shopinfo') ." AS sp ON sp.ru_id = s.ru_id ". "LEFT JOIN ". $GLOBALS['ecs']->table('users') ." AS u ON u.user_id = s.user_id ". "WHERE $where ORDER BY $filter[sort_by] $filter[sort_order] ". "LIMIT ". $filter['start'] .", $filter[page_size]"; $res = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetchRow($res)) { $row['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']); $row['ru_name'] = get_shop_name($row['ru_id'], 1); $arr[] = $row; } $filter['keywords'] = stripslashes($filter['keywords']); $arr = array('item' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); return $arr; } ?>