|
@@ -40,8 +40,13 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
|
|
|
return result, err
|
|
|
}
|
|
|
var reProducts []vo.ReProductPreview
|
|
|
+ var creatorName string
|
|
|
for _, product := range products {
|
|
|
photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByProductID(product.ProductID)
|
|
|
+ enterprise, err := dao.EnterpriseDao{}.GetEnterprise(product.EnterpriseID)
|
|
|
+ if err == nil && enterprise != nil {
|
|
|
+ creatorName = enterprise.BusinessName
|
|
|
+ }
|
|
|
if e != nil {
|
|
|
photoUrl = ""
|
|
|
}
|
|
@@ -54,6 +59,7 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
|
|
|
ProductDetail: product.ProductDetail,
|
|
|
CreatedAt: product.CreatedAt.Format("2006-01-02 15:04:05"),
|
|
|
PhotoUrl: photoUrl,
|
|
|
+ CreateName: creatorName,
|
|
|
}
|
|
|
reProducts = append(reProducts, reProduct)
|
|
|
}
|
|
@@ -195,3 +201,16 @@ func (p ProductService) DeleteProduct(param *vo.ProductUpdateParam) (int64, erro
|
|
|
}
|
|
|
return param.ProductId, nil
|
|
|
}
|
|
|
+
|
|
|
+// 获取商品类目
|
|
|
+func (p ProductService) GetProductCategorys() ([]string, error) {
|
|
|
+ var categorys []string
|
|
|
+ productCategorys, err := dao.ProductDAO{}.GetProductCategorys()
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ for _, productCategory := range productCategorys {
|
|
|
+ categorys = append(categorys, productCategory.ProductCategory)
|
|
|
+ }
|
|
|
+ return categorys, nil
|
|
|
+}
|