Commit bf64c6d9 by mushishixian

修复bug

parent 9f05fc4e
...@@ -108,7 +108,6 @@ func Synchronization(ctx *gin.Context) { ...@@ -108,7 +108,6 @@ func Synchronization(ctx *gin.Context) {
logger.Log("协程超时", "sku", 1) logger.Log("协程超时", "sku", 1)
} }
} }
common.Output(ctx, 0, "success", temp) common.Output(ctx, 0, "success", temp)
} }
......
...@@ -35,13 +35,13 @@ type LySku struct { ...@@ -35,13 +35,13 @@ type LySku struct {
BrandId int64 `json:"brand_id"` BrandId int64 `json:"brand_id"`
//系数相关 //系数相关
Coefficient interface{} `json:"coefficient,omitempty"` Coefficient interface{} `json:"coefficient,omitempty"`
Original []LadderPrice `json:"original_price"` Original interface{} `json:"original_price"`
SuppExtendFee interface{} `json:"supp_extend_fee"` SuppExtendFee interface{} `json:"supp_extend_fee"`
IsBuy int `json:"is_buy"` IsBuy int `json:"is_buy"`
//spu信息 //spu信息
ClassID1 int `json:"class_id1"` ClassID1 int `json:"class_id1"`
ClassID2 int `json:"class_id2"` ClassID2 int `json:"class_id2"`
ClassID3 int `json:"class_id3,omitempty"` ClassID3 int `json:"class_id3"`
SpuName string `json:"spu_name"` SpuName string `json:"spu_name"`
Status int `json:"status"` Status int `json:"status"`
ImagesL string `json:"images_l"` ImagesL string `json:"images_l"`
...@@ -124,6 +124,7 @@ func InitSkuData(sku string) (data LySku) { ...@@ -124,6 +124,7 @@ func InitSkuData(sku string) (data LySku) {
LadderPriceStr := gjson.Get(sku, "ladder_price").String() LadderPriceStr := gjson.Get(sku, "ladder_price").String()
data.LadderPrice = getLadderPrice(LadderPriceStr) data.LadderPrice = getLadderPrice(LadderPriceStr)
data.Original = getOriginPrice(LadderPriceStr)
return return
} }
...@@ -146,3 +147,22 @@ func getLadderPrice(ladderPriceStr string) (ladderPrice []LadderPrice) { ...@@ -146,3 +147,22 @@ func getLadderPrice(ladderPriceStr string) (ladderPrice []LadderPrice) {
} }
return return
} }
//获取原始价格
func getOriginPrice(ladderPriceStr string) (ladderPrice []OriginPrice) {
ladderPriceArr := gjson.Parse(ladderPriceStr).Array()
for _, price := range ladderPriceArr {
ladderPrice = append(ladderPrice, OriginPrice{
Purchases: price.Get("purchases").Int(),
PriceUs: price.Get("price_us").Float(),
PriceCn: price.Get("price_cn").Float(),
PriceAc: price.Get("price_ac").Float(),
CostPrice: price.Get("cost_price").Float(),
})
}
if len(ladderPrice) == 0 {
ladderPrice = []OriginPrice{}
return
}
return
}
...@@ -120,7 +120,6 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -120,7 +120,6 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//判断是否有新客价权利 //判断是否有新客价权利
if isNewCustomer == "true" { if isNewCustomer == "true" {
//获取新客价 //获取新客价
//todo test
sku = ls.GetActivityPrice(sku, "_NewCustomer", power) sku = ls.GetActivityPrice(sku, "_NewCustomer", power)
if sku.AcType > 0 { if sku.AcType > 0 {
hasActivity = true hasActivity = true
......
...@@ -166,6 +166,9 @@ func (ls *LyService) GetExtendFee(supplierId int64, canal string) interface{} { ...@@ -166,6 +166,9 @@ func (ls *LyService) GetExtendFee(supplierId int64, canal string) interface{} {
if supplierId == 17 { if supplierId == 17 {
//为什么专卖的redis键会不一样,专卖的附加费管理在供应商系统,其它的在基石 //为什么专卖的redis键会不一样,专卖的附加费管理在供应商系统,其它的在基石
value, _ := redis.String(redisCon.Do("HGET", "supp_extend_fee", "17."+canal)) value, _ := redis.String(redisCon.Do("HGET", "supp_extend_fee", "17."+canal))
if value == "" {
return false
}
//专卖的存了两种形式的数据,真是搞人心态 //专卖的存了两种形式的数据,真是搞人心态
if strings.Contains(value, "cn") { if strings.Contains(value, "cn") {
var extendFee ExtendFee var extendFee ExtendFee
...@@ -178,6 +181,9 @@ func (ls *LyService) GetExtendFee(supplierId int64, canal string) interface{} { ...@@ -178,6 +181,9 @@ func (ls *LyService) GetExtendFee(supplierId int64, canal string) interface{} {
} }
} else { } else {
value, _ := redis.String(redisCon.Do("HGET", "supp_extend_fee", supplierId)) value, _ := redis.String(redisCon.Do("HGET", "supp_extend_fee", supplierId))
if value == "" {
return false
}
var extendFee ExtendFee var extendFee ExtendFee
json.Unmarshal([]byte(value), &extendFee) json.Unmarshal([]byte(value), &extendFee)
return extendFee return extendFee
...@@ -191,7 +197,6 @@ func (ls *LyService) GetCoefficient(sku model.LySku) model.LySku { ...@@ -191,7 +197,6 @@ func (ls *LyService) GetCoefficient(sku model.LySku) model.LySku {
} }
flag := 0 flag := 0
//专卖 //专卖
originalLadderPrice := sku.LadderPrice
if sku.SupplierId == 17 { if sku.SupplierId == 17 {
ladderPrice := sku.LadderPrice ladderPrice := sku.LadderPrice
for key, price := range ladderPrice { for key, price := range ladderPrice {
...@@ -333,7 +338,6 @@ func (ls *LyService) GetCoefficient(sku model.LySku) model.LySku { ...@@ -333,7 +338,6 @@ func (ls *LyService) GetCoefficient(sku model.LySku) model.LySku {
coefficient.Tax = tax coefficient.Tax = tax
sku.Coefficient = coefficient sku.Coefficient = coefficient
} }
sku.Original = originalLadderPrice
return sku return sku
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment