Commit bf64c6d9 by mushishixian

修复bug

parent 9f05fc4e
......@@ -108,7 +108,6 @@ func Synchronization(ctx *gin.Context) {
logger.Log("协程超时", "sku", 1)
}
}
common.Output(ctx, 0, "success", temp)
}
......
......@@ -6,7 +6,7 @@ import (
//联营sku结构体
type LySku struct {
SpuId string `json:"spu_id"`
SpuId string `json:"spu_id"`
OldGoodsId int64 `json:"old_goods_id"`
UpdateTime int64 `json:"update_time"`
CpTime int64 `json:"cp_time"`
......@@ -34,14 +34,14 @@ type LySku struct {
AllowCoupon int `json:"allow_coupon"`
BrandId int64 `json:"brand_id"`
//系数相关
Coefficient interface{} `json:"coefficient,omitempty"`
Original []LadderPrice `json:"original_price"`
SuppExtendFee interface{} `json:"supp_extend_fee"`
IsBuy int `json:"is_buy"`
Coefficient interface{} `json:"coefficient,omitempty"`
Original interface{} `json:"original_price"`
SuppExtendFee interface{} `json:"supp_extend_fee"`
IsBuy int `json:"is_buy"`
//spu信息
ClassID1 int `json:"class_id1"`
ClassID2 int `json:"class_id2"`
ClassID3 int `json:"class_id3,omitempty"`
ClassID3 int `json:"class_id3"`
SpuName string `json:"spu_name"`
Status int `json:"status"`
ImagesL string `json:"images_l"`
......@@ -124,6 +124,7 @@ func InitSkuData(sku string) (data LySku) {
LadderPriceStr := gjson.Get(sku, "ladder_price").String()
data.LadderPrice = getLadderPrice(LadderPriceStr)
data.Original = getOriginPrice(LadderPriceStr)
return
}
......@@ -146,3 +147,22 @@ func getLadderPrice(ladderPriceStr string) (ladderPrice []LadderPrice) {
}
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
//判断是否有新客价权利
if isNewCustomer == "true" {
//获取新客价
//todo test
sku = ls.GetActivityPrice(sku, "_NewCustomer", power)
if sku.AcType > 0 {
hasActivity = true
......
......@@ -166,6 +166,9 @@ func (ls *LyService) GetExtendFee(supplierId int64, canal string) interface{} {
if supplierId == 17 {
//为什么专卖的redis键会不一样,专卖的附加费管理在供应商系统,其它的在基石
value, _ := redis.String(redisCon.Do("HGET", "supp_extend_fee", "17."+canal))
if value == "" {
return false
}
//专卖的存了两种形式的数据,真是搞人心态
if strings.Contains(value, "cn") {
var extendFee ExtendFee
......@@ -178,6 +181,9 @@ func (ls *LyService) GetExtendFee(supplierId int64, canal string) interface{} {
}
} else {
value, _ := redis.String(redisCon.Do("HGET", "supp_extend_fee", supplierId))
if value == "" {
return false
}
var extendFee ExtendFee
json.Unmarshal([]byte(value), &extendFee)
return extendFee
......@@ -191,7 +197,6 @@ func (ls *LyService) GetCoefficient(sku model.LySku) model.LySku {
}
flag := 0
//专卖
originalLadderPrice := sku.LadderPrice
if sku.SupplierId == 17 {
ladderPrice := sku.LadderPrice
for key, price := range ladderPrice {
......@@ -333,7 +338,6 @@ func (ls *LyService) GetCoefficient(sku model.LySku) model.LySku {
coefficient.Tax = tax
sku.Coefficient = coefficient
}
sku.Original = originalLadderPrice
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