Commit 56c2b210 by 杨树贤

Merge branch 'ysx-商品活动价逻辑修改-20230823'

parents 94765a4c 0481f707
......@@ -44,6 +44,7 @@ type Activity struct {
ExcludeStandardBrandIdList []string
CurrencyRmb int `json:"currency_rmb"`
CurrencyUs int `json:"currency_us"`
UseType int `json:"use_type"`
}
type ActivityItem struct {
......@@ -58,9 +59,10 @@ type ActivityItem struct {
AddTime int `json:"add_time"`
}
//用于检查是否有活动情况的结构体
// 用于检查是否有活动情况的结构体
type ActivityCheckData struct {
SupplierId int
GoodsName string
BrandId int
StandardBrandId int
GoodsId string
......
......@@ -211,6 +211,7 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku {
GoodsId: sku.GoodsId,
Canal: sku.Canal,
ClassId: sku.ClassID2,
GoodsName: sku.GoodsName,
}
var activityService ActivityService
priceActivity, giftActivity := activityService.GetActivityData(checkData)
......
......@@ -294,11 +294,14 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
priceUs := c.MyRound(price.PriceUs, 4)
priceUs = c.MyRound(c.MulFloat(price.PriceUs, sku.DiscountRatio.RatioUsd), 4)
data[key].PriceUs = priceUs
price.PriceAcUs = priceUs
}
if price.PriceCn != 0 {
priceCn := c.MyRound(price.PriceCn, 4)
priceCn = c.MyRound(c.MulFloat(price.PriceCn, sku.DiscountRatio.Ratio), 4)
data[key].PriceCn = priceCn
price.PriceCn = priceCn
}
//专卖成本价
......
......@@ -93,6 +93,7 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
if brandIds != "" {
hasSpecialCheck = true
standardBrandIdList := strings.Split(brandIds, ",")
//fmt.Println(standardBrandIdList)
standardBrandId := strconv.Itoa(sku.StandardBrand.StandardBrandId)
//找到有对应的品牌,那么优先级肯定是最高的了
if php2go.InArray(standardBrandId, standardBrandIdList) {
......
......@@ -38,7 +38,7 @@ func (qs *ZiyingService) skuLockNum(c *redis.Conn, goodsId string) int64 {
}
/*
获取自营活动价
获取自营活动价
*/
func (qs *ZiyingService) ActivityPrice(ctx *gin.Context, SkuInfo string) *orderedmap.OrderedMap {
data := qs.HDActivityPrice(SkuInfo)
......@@ -48,7 +48,7 @@ func (qs *ZiyingService) ActivityPrice(ctx *gin.Context, SkuInfo string) *ordere
return nil
}
//获取活动相关信息
// 获取活动相关信息
func (qs *ZiyingService) GetActivity(skuInfo string) (priceActivity model.PriceActivity, giftActivity model.GiftActivity) {
//去判断是否有活动(促销打折活动和满赠活动)
var standardBrandId int
......@@ -72,6 +72,7 @@ func (qs *ZiyingService) GetActivity(skuInfo string) (priceActivity model.PriceA
StandardBrandId: standardBrandId,
GoodsId: gjson.Get(skuInfo, "goods_id").String(),
ClassId: int(gjson.Get(skuInfo, "class_id2").Int()),
GoodsName: gjson.Get(skuInfo, "goods_name").String(),
}
var activityService ActivityService
priceActivity, giftActivity = activityService.GetActivityData(checkData)
......@@ -79,13 +80,12 @@ func (qs *ZiyingService) GetActivity(skuInfo string) (priceActivity model.PriceA
}
/*
计算活动价
计算活动价
ac_type说明: 0 没有活动
活动名称 ac_type 类型
自营系数 6 自营
折扣(系数)活动 10 自营/联营
*/
func (qs *ZiyingService) HDActivityPrice(SkuInfo string) *orderedmap.OrderedMap {
priceActivity, giftActivity := qs.GetActivity(SkuInfo)
......@@ -132,7 +132,7 @@ func (qs *ZiyingService) HDActivityPrice(SkuInfo string) *orderedmap.OrderedMap
}
/*
获取当前锁住的库存
获取当前锁住的库存
*/
func (qs *ZiyingService) HDGoodsLimit(SkuID string, Stock string, c *redis.Conn) *orderedmap.OrderedMap {
......
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