作者 何书鹏

bug修改

... ... @@ -188,11 +188,12 @@ class Goods extends Api
$model = new GoodsComment();
$goods = [];
$goods['comment_number'] = $model->where('goods_id',$goods_id)->where('status','normal')->count();
$table_name = $model->getTable();
$goods['comment'] = $model
->with(['user'])
->where('goods_id',$goods_id)
->where('status','normal')
->order('id','desc')
->where($table_name.'.goods_id',$goods_id)
->where($table_name.'.status','normal')
->order($table_name.'.id','desc')
->find()??[];
if ($goods['comment'])$goods['comment']->getRelation('user')->visible(['id','nickname']);
$this->success('商品详情页评价',$goods);
... ...