|
@@ -13,25 +13,26 @@ import (
|
|
|
"eta/eta_mini_ht_api/service/order"
|
|
|
reportService "eta/eta_mini_ht_api/service/report"
|
|
|
"fmt"
|
|
|
- "github.com/shopspring/decimal"
|
|
|
"strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
type ProductDTO struct {
|
|
|
- Title string
|
|
|
- SourceTile string
|
|
|
- SourceAbstract string
|
|
|
- SourceSrc string
|
|
|
- PermissionNames string
|
|
|
- Description string
|
|
|
- Price decimal.Decimal
|
|
|
- CoverSrc string
|
|
|
- RiskLevel string
|
|
|
- Type string
|
|
|
- BeginDate string
|
|
|
- EndDate string
|
|
|
- SourceId int
|
|
|
+ Title string `json:"title"`
|
|
|
+ SourceTile string `json:"sourceTile"`
|
|
|
+ Abstract string `json:"abstract"`
|
|
|
+ Src string `json:"src"`
|
|
|
+ PermissionNames string `json:"permissionNames"`
|
|
|
+ Description string `json:"description"`
|
|
|
+ Price string `json:"price"`
|
|
|
+ CoverSrc string `json:"coverSrc"`
|
|
|
+ RiskLevel string `json:"riskLevel"`
|
|
|
+ Type string `json:"type"`
|
|
|
+ BeginDate string `json:"beginDate"`
|
|
|
+ EndDate string `json:"endDate"`
|
|
|
+ SourceId int `json:"sourceId"`
|
|
|
+ ReportId int `json:"reportId"`
|
|
|
+ MediaId int `json:"mediaId"`
|
|
|
}
|
|
|
|
|
|
func GetProductRiskLevel(product merchantService.MerchantProductDTO) (riskLevel, sourceTitle, sourceAbsract, sourceSrc, permissionNames string, err error) {
|
|
@@ -102,7 +103,7 @@ func GetProductInfoById(productId int) (product ProductDTO, err error) {
|
|
|
return
|
|
|
}
|
|
|
product = convertToProductDTO(merchantProduct)
|
|
|
- product.RiskLevel, product.SourceTile, product.SourceAbstract, product.SourceSrc, product.PermissionNames, err = GetProductRiskLevel(merchantProduct)
|
|
|
+ product.RiskLevel, product.SourceTile, product.Abstract, product.Src, product.PermissionNames, err = GetProductRiskLevel(merchantProduct)
|
|
|
if err != nil {
|
|
|
logger.Error("获取风险等级失败[productId:%d]", productId)
|
|
|
}
|
|
@@ -114,7 +115,7 @@ func convertToProductDTO(product merchantService.MerchantProductDTO) (productDTO
|
|
|
productDTO = ProductDTO{
|
|
|
Title: product.Title,
|
|
|
Description: product.Description,
|
|
|
- Price: product.Price,
|
|
|
+ Price: product.Price.String(),
|
|
|
RiskLevel: product.RiskLevel,
|
|
|
CoverSrc: product.CoverSrc,
|
|
|
Type: product.Type,
|
|
@@ -142,12 +143,12 @@ func OpenProduct(templateUserId int, productOrderNo string) (err error) {
|
|
|
|
|
|
// OpenProduct 开通产品
|
|
|
func CloseProduct(templateUserId int, productOrderNo string) (err error) {
|
|
|
- proudctOrder, err := order.GetProductOrderByUser(templateUserId, productOrderNo)
|
|
|
+ productOrder, err := order.GetProductOrderByUser(templateUserId, productOrderNo)
|
|
|
if err != nil {
|
|
|
logger.Error("获取产品订单信息失败:%v", err)
|
|
|
return
|
|
|
}
|
|
|
- product, err := merchantService.GetMerchantProductById(proudctOrder.ProductID)
|
|
|
+ product, err := merchantService.GetMerchantProductById(productOrder.ProductID)
|
|
|
if err != nil {
|
|
|
logger.Error("获取产品信息失败:%v", err)
|
|
|
return
|