|
@@ -80,6 +80,15 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
|
|
}
|
|
}
|
|
|
|
|
|
func (p ProductService) CreateProduct(productCreateParam *vo.ProductCreateParam) (int64, error) {
|
|
func (p ProductService) CreateProduct(productCreateParam *vo.ProductCreateParam) (int64, error) {
|
|
|
|
+ if len(productCreateParam.ProductPhotos) == 0 {
|
|
|
|
+ return 0, errors.New("商品主图不能为空!")
|
|
|
|
+ }
|
|
|
|
+ if productCreateParam.ProductType == 1 {
|
|
|
|
+ count := dao.ProductDAO{}.CheckKuaishouProduct(productCreateParam.EnterpriseId, productCreateParam.ProductId)
|
|
|
|
+ if count > 0 {
|
|
|
|
+ return 0, errors.New("该快手商品已存在!")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
product := entity.Product{
|
|
product := entity.Product{
|
|
ProductType: productCreateParam.ProductType,
|
|
ProductType: productCreateParam.ProductType,
|
|
KuaishouProductId: productCreateParam.ProductId,
|
|
KuaishouProductId: productCreateParam.ProductId,
|