hasOne('app\common\model\goods\Goods', 'id', 'goods_id') ->field(['id,name,image,max_price,min_price,market_price,stock']); } /** * @Notes: 关联拼团商品模型 * @Author: 张无忌 */ public function teamGoods() { return $this->hasMany('TeamGoods', 'team_id', 'id') ->alias('TG') ->field(['TG.*', 'GI.spec_value_str,GI.price,GI.market_price,GI.stock']) ->join('goods_item GI', 'TG.item_id = GI.id'); } }