解决ecshop后台用户留言列表加载很慢方法

2016-09-07 22:02 来源:www.chinab4c.com 作者:ecshop专家

ecshop 的后台用户留言列表加载得很慢,有时候根本就打不开,不知道是哪里的原因,一直显示正在加载页面,查询了 gg,原来是由于 mysql 语句查询的原因,只能进行修改了,也很简单的说。

首先查找查询语句:

"FROM " . $GLOBALS['ecs']->table('feedback') . " AS f ". "LEFT JOIN " . $GLOBALS['ecs']->table('feedback') . " AS r ON r.parent_id=f.msg_id ".

修改为如下的形式:

$sql = "SELECT f.msg_id, f.user_name, f.msg_title, f.msg_type, f.order_id, f.msg_status, f.msg_time, f.msg_area " . "FROM " . $GLOBALS['ecs']->table('feedback') . " AS f ". //"LEFT JOIN " . $GLOBALS['ecs']->table('feedback') . " AS r ON r.parent_id=f.msg_id ". "WHERE f.parent_id = 0 $where " . "GROUP BY f.msg_id ". "ORDER by $filter[sort_by] $filter[sort_order] ". "LIMIT " . $filter['start'] . ', ' . $filter['page_size'];

再在 foreach 里面添加如下的代码:

$msg_list[$key]['reply'] = $GLOBALS['db']->getOne("sel ect count(msg_id) reply from ".$GLOBALS ['ecs']->table('feedback')." where parent_id ='".$value['msg_id']."'");

好了,这个时候再查看留言已经很快了。


(责任编辑:chinab4c)