64], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'sku_id' => 'Sku ID', 'mall_goods_id' => 'Mall Goods ID', 'chain_goods_id' => 'Chain Goods ID', 'attr_id' => 'Attr ID', 'is_delete' => 'Is Delete', ]; } /** * 删除商品对应的Attr * * @param integer $goods_id * @return int */ public static function removeGoodsAttr(int $goods_id) { return static::updateAll(['is_delete' => 1], ['mall_goods_id' => $goods_id]); } /** * 获取一个SKUID * * @param integer $goods_id * @param integer $attr_id * @return GoodsSkuModel */ public static function getSku($goods_id, $attr_id, $field = null) { $model = self::find(); $field && $model->select($field); return $model->where(['mall_goods_id' => $goods_id, 'attr_id' => $attr_id, 'is_delete' => 0]) ->one(); } /** * 通过SKUIDs获取SKU信息 * * @param array $attr_id * @param string $field * @return array */ public static function getSkuByAttrIDs(array $attr_id, string $field = '') { $model = self::find(); $field && $model->select($field); return $model ->where(['attr_id' => $attr_id, 'is_delete' => 0]) ->asArray() ->all(); } }