255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'name' => '商品名称', 'subtitle' => '副标题', 'original_price' => '原价', 'cost_price' => '成本价', 'detail' => '商品详情,图文', 'cover_pic' => '商品缩略图', 'pic_url' => '商品轮播图', 'video_url' => '商品视频', 'unit' => '单位', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'deleted_at' => 'Deleted At', 'is_delete' => 'Is Delete', 'type' => '商品类型:goods--实体商品 ecard--电子卡密', 'ecard_id' => '卡密id', ]; } public function getGoodsCatRelation() { return $this->hasMany(GoodsCatRelation::className(), ['goods_warehouse_id' => 'id'])->where(['is_delete' => 0]); } public function getCats() { return $this->hasMany(GoodsCats::className(), ['id' => 'cat_id']) ->where(['mch_id' => 0]) ->via('goodsCatRelation'); } public function getMchCats() { return $this->hasMany(GoodsCats::className(), ['id' => 'cat_id']) ->where(['>', 'mch_id', 0]) ->via('goodsCatRelation'); } public function getGoods() { return $this->hasMany(Goods::className(), ['goods_warehouse_id' => 'id']); } public function getGoodsInfo() { return $this->hasOne(Goods::className(), ['goods_warehouse_id' => 'id'])->where(['sign' => ['', 'mch']]); } public function getEcard() { return $this->hasOne(Ecard::className(), ['id' => 'ecard_id']); } }