商品评论和咨询隐藏会员手机号中间四位
商品评论和咨询隐蔽会员手机号中间四位
只需要修改一个文件 b2c/lib/message/disask.php 找到如下方法替换即可
function getGoodsIndexComments($gid,$item,$page=1,$type_id=null,$limit){
if($limit){
$list_listnum = $limit;
}else{
$list_listnum = intval($this->app->getConf('comment.index.listnum'));
}
$this->objComment->type = $item;
$filter['for_comment_id'] = 0;
$filter['type_id'] = $gid;
$filter['display'] = 'true';
if($type_id) $filter['gask_type'] = $type_id;
$count = $this->count($filter);
$maxPage = ceil($count / $list_listnum);
if($page > $maxPage) $page = $maxPage;
$start = ($page-1) * $list_listnum;
$start = $start<0 ? 0 : $start;
$aData = $this->getList('*',$filter,$start,$list_listnum);
$data = array();
$point_status = app::get('b2c')->getConf('goods.point.status') ? app::get('b2c')->getConf('goods.point.status'): 'on';
$goods_point = $this->app->model('comment_goods_point');
foreach((array)$aData as $key=>$val){
if($val['object_type'] == 'discuss' && $point_status == 'on'){
$row = $goods_point->get_comment_point($val['comment_id']);
$val['goods_point'] = $row;
}
//如果是手机号那就隐蔽中间四位
if(preg_match('/^1[345789]{1}[0-9]{9}/',$val['author'])){
$val['author']=preg_replace('/(1[345789]{1}[0-9])[0-9]{4}([0-9]{4})/i','$1****$2',$val['author']);
}
$data[] = $val;
}
$result['start'] = $start+1;
$result['end'] = $start+$list_listnum;
$result['total'] = $count;
$result['data'] = $data;
$result['page'] = $maxPage;
$result['current_page'] = $page;
return $result;
}
如有任何疑问都可以直接联系QQ:2392521892来解答。
