Bladeren bron

fix_创建商品销量&服务商列表角标

Ethan 2 weken geleden
bovenliggende
commit
51d9dc83b1
4 gewijzigde bestanden met toevoegingen van 6 en 7 verwijderingen
  1. 1 1
      app/entity/product.go
  2. 3 5
      app/service/cooperation_service.go
  3. 1 0
      app/service/product_service.go
  4. 1 1
      app/vo/product_create_param.go

+ 1 - 1
app/entity/product.go

@@ -16,7 +16,7 @@ type Product struct {
 	CommissionPrice     float64   `gorm:"column:commission_price"`                    // 佣金金额
 	ProductDetail       string    `gorm:"column:product_detail"`                      // 卖点总结
 	KuaishouProductId   string    `gorm:"column:kuaishou_product_id"`                 // 快手商品ID
-	SalesCount          string    `gorm:"column:sales_count"`                         // 商品30天销量
+	SalesCount          int64     `gorm:"column:sales_count"`                         // 商品30天销量
 	CreatedAt           time.Time `gorm:"column:created_at"`                          // 创建时间
 	UpdatedAt           time.Time `gorm:"column:updated_at"`                          // 更新时间
 }

+ 3 - 5
app/service/cooperation_service.go

@@ -230,10 +230,10 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 	var enterpriseOperator string
 	if param.Status == 1 { // 可邀约
 		enterpriseSupplierCooperates, total, _ = dao.EnterpriseSupplierCooperateDao{}.GetSupplierByEnterprise(param.EnterpriseId, param.Page, param.PageSize)
+		var resEnterpriseSuppliers []*entity.EnterpriseSupplierCooperate
 		if param.TaskType == 2 {
 			// 品牌种草
 			// 去除当前project_id、supplier_id已在 s_project_info中的数据
-			var resEnterpriseSuppliers []*entity.EnterpriseSupplierCooperate
 			for _, enterpriseSupplier := range enterpriseSupplierCooperates {
 				var sProject entity.SProjectInfo
 				err1 := dao.Db.Model(&entity.SProjectInfo{}).Where("project_id = ? and supplier_id = ?", param.TaskId, enterpriseSupplier.SupplierId).First(&sProject).Error
@@ -245,11 +245,9 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 					}
 				}
 			}
-			enterpriseSupplierCooperates = resEnterpriseSuppliers
 		} else if param.TaskType == 3 {
 			// 本地生活
 			// 去除当前 local_id、supplier_id 已在 s_local_info中的数据
-			var resEnterpriseSuppliers []*entity.EnterpriseSupplierCooperate
 			for _, enterpriseSupplier := range enterpriseSupplierCooperates {
 				var sLocalLifeInfo entity.SLocalLifeInfo
 				err2 := dao.Db.Model(&entity.SLocalLifeInfo{}).Where("local_id = ? and supplier_id = ?", param.TaskId, enterpriseSupplier.SupplierId).First(&sLocalLifeInfo).Error
@@ -261,8 +259,8 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 					}
 				}
 			}
-			enterpriseSupplierCooperates = resEnterpriseSuppliers
 		}
+		enterpriseSupplierCooperates = resEnterpriseSuppliers
 		total = int64(len(enterpriseSupplierCooperates))
 	} else if param.Status == 2 { // 邀约中
 		if param.TaskType == 2 {
@@ -282,7 +280,7 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 		}
 	}
 	// 针对邀约中、合作中情形
-	if enterpriseSupplierCooperates == nil {
+	if param.Status == 2 || param.Status == 3 {
 		if param.TaskType == 2 { // 种草
 			for _, sProjectInfo := range sProjectInfos {
 				supplierId := sProjectInfo.SupplierID

+ 1 - 0
app/service/product_service.go

@@ -102,6 +102,7 @@ func (p ProductService) CreateProduct(productCreateParam *vo.ProductCreateParam)
 		CommissionPrice:     productCreateParam.CommissionPrice,
 		PublicCommission:    productCreateParam.PublicCommission,
 		ProductUrl:          productCreateParam.ProductUrl,
+		SalesCount:          productCreateParam.SalesCount,
 	}
 	productID, err := dao.ProductDAO{}.CreateProduct(product)
 	if err != nil {

+ 1 - 1
app/vo/product_create_param.go

@@ -19,6 +19,6 @@ type ProductCreateParam struct {
 	CommissionPrice     float64        `json:"commission_price"`     // 佣金金额
 	PublicCommission    float64        `json:"public_commission"`    // 公开佣金
 	ProductPhotos       []ProductPhoto `json:"product_photos"`       // 商品图片列表
-	SalesCount          string         `json:"column:sales_count"`   // 商品30天销量
+	SalesCount          int64          `json:"column:sales_count"`   // 商品30天销量
 	ProductUrl          string         `json:"product_url"`          // 商品链接,可为电商网址、公司官网、大众点评的店铺地址等可以说明商品信息或者品牌信息的线上地址;
 }