$model=M('');
$model->table(C('DB_PREFIX').'goods as g')
->join(C('DB_PREFIX').'orders as o on o.goods_id=g.id')
->where('o.user_id='.$userid.' and o.state=1 and o.id not in(select c.order_id from '.C('DB_PREFIX').'comment as c where c.user_id='.$userid.' and c.goods_id=g.id )')