$data['product'] = model('Product')->field('id,name,price,old_price,category_id,file_id')->with('file,category')->where($map)->order($sortField, 'desc')->select();
也就是field 应在with关联预载入之前调用,并且要把关联的条件字段(category_id,field_id)加进去,否则关联不上.
$data['product'] = model('Product')->field('id,name,price,old_price,category_id,file_id')->with('file,category')->where($map)->order($sortField, 'desc')->select();
也就是field 应在with关联预载入之前调用,并且要把关联的条件字段(category_id,field_id)加进去,否则关联不上.