作者 何书鹏

bug修改

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