package backstage_service

import (
	"youngmini_server/app/dao/backstage_dao"
	"youngmini_server/app/model/backstage_model"
)

var Product = serviceProduct{}

type serviceProduct struct{}

// CreatProduct   创建品牌信息
func (s *serviceProduct) CreatProduct(product *backstage_model.ProductReq) error {
	err := backstage_dao.CreatProduct(product)
	if err != nil {
		return err
	}
	return nil
}

// DeleteProduct 根据ID删除商品信息
func (s *serviceProduct) DeleteProduct(brandId string) error {
	_, err := backstage_dao.FindByIdBrand(brandId)
	if err != nil {
		return err
	}
	err = backstage_dao.DeleteBrand(brandId)
	if err != nil {
		return err
	}
	return err
}
