You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

138 lines
4.9 KiB

<?php
/**
* ECSHOP 用户评论管理程序
* ============================================================================
* * 版权所有 2005-2016 上海商创网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecmoban.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: liubo $
* $Id: comment_manage.php 17217 2011-01-19 06:29:08Z liubo $
*/
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
/* act操作项的初始化 */
if (empty($_REQUEST['act']))
{
$_REQUEST['act'] = 'list';
}
else
{
$_REQUEST['act'] = trim($_REQUEST['act']);
}
//ecmoban模板堂 --zhuo start
$adminru = get_admin_ru_id();
if($adminru['ru_id'] == 0){
$smarty->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;
}
?>