|
@@ -40,16 +40,23 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
|
|
|
return result, err
|
|
|
}
|
|
|
var reProducts []vo.ReProductPreview
|
|
|
- var creatorName string
|
|
|
for _, product := range products {
|
|
|
+ var createrName string
|
|
|
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 = ""
|
|
|
}
|
|
|
+ if product.SubAccountID == 0 {
|
|
|
+ enterprise, err := dao.EnterpriseDao{}.GetEnterprise(product.EnterpriseID)
|
|
|
+ if err == nil && enterprise != nil {
|
|
|
+ createrName = enterprise.BusinessName
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ subAccount, err := dao.SubAccountDao{}.GetSubAccount(product.SubAccountID)
|
|
|
+ if err == nil && subAccount != nil {
|
|
|
+ createrName = subAccount.SubAccountName
|
|
|
+ }
|
|
|
+ }
|
|
|
reProduct := vo.ReProductPreview{
|
|
|
ProductID: product.ProductID,
|
|
|
ProductName: product.ProductName,
|
|
@@ -59,7 +66,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,
|
|
|
+ CreateName: createrName,
|
|
|
}
|
|
|
reProducts = append(reProducts, reProduct)
|
|
|
}
|