Commit 2133e8b7 by 杨树贤

Merge branch 'ysx-特殊币种人民币是否含税-20230828' into dev

# Conflicts:
#	service/service_ly.go
parents 960949d6 caa83cd8
...@@ -40,7 +40,7 @@ type LySku struct { ...@@ -40,7 +40,7 @@ type LySku struct {
BrandId int64 `json:"brand_id"` BrandId int64 `json:"brand_id"`
//系数相关 //系数相关
Coefficient interface{} `json:"coefficient,omitempty"` Coefficient interface{} `json:"coefficient,omitempty"`
OriginalPrice interface{} `json:"original_price,omitempty"` OriginalPrice []OriginPrice `json:"original_price,omitempty"`
//数据库存的价格,因为数据库存的是什么币种都有可能,但是也要展示数据库存的,所以要有这个字段 //数据库存的价格,因为数据库存的是什么币种都有可能,但是也要展示数据库存的,所以要有这个字段
DatabasePrice interface{} `json:"database_price,omitempty"` DatabasePrice interface{} `json:"database_price,omitempty"`
SuppExtendFee interface{} `json:"supp_extend_fee"` SuppExtendFee interface{} `json:"supp_extend_fee"`
...@@ -278,5 +278,6 @@ func getOriginPrice(ladderPriceStr string) (ladderPrice []OriginPrice) { ...@@ -278,5 +278,6 @@ func getOriginPrice(ladderPriceStr string) (ladderPrice []OriginPrice) {
ladderPrice = []OriginPrice{} ladderPrice = []OriginPrice{}
return return
} }
return return
} }
...@@ -117,9 +117,9 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -117,9 +117,9 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
sku.StandardBrand = ls.GetStandardBrand(brandId) sku.StandardBrand = ls.GetStandardBrand(brandId)
//处理过期,todo 2022.7.13 专卖没有过期 //处理过期,todo 2022.7.13 专卖没有过期
// if sku.SupplierId != 17 && gjson.Get(skuStr, "is_expire").Int() != 0 { if sku.SupplierId != 17 && gjson.Get(skuStr, "is_expire").Int() != 0 {
// sku.LadderPrice = nil sku.LadderPrice = nil
// } }
//处理活动 //处理活动
sku.AcType = 0 sku.AcType = 0
...@@ -172,19 +172,9 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -172,19 +172,9 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//判断是否可以购买 //判断是否可以购买
sku.IsBuy = ls.GetIsBuy(sku) sku.IsBuy = ls.GetIsBuy(sku)
sku.IsBuy = 1
//过期修改库存为0 //过期修改库存为0
if sku.IsExpire == 1 && sku.SupplierId != 17 { if sku.IsExpire == 1 && sku.SupplierId != 17 {
// sku.Stock = 0
}
//特殊判断,如果是罗侧斯特的ADI的商品,价格为0,库存为0
if sku.StandardBrand.StandardBrandId == 8 && sku.SupplierId == 3 {
sku.Stock = 0 sku.Stock = 0
sku.LadderPriceResult = []int{}
sku.IsBuy = 0
sku.BatchSn = ""
sku.Attrs = []int{}
} }
//获取标签信息 //获取标签信息
...@@ -211,7 +201,6 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku { ...@@ -211,7 +201,6 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku {
GoodsId: sku.GoodsId, GoodsId: sku.GoodsId,
Canal: sku.Canal, Canal: sku.Canal,
ClassId: sku.ClassID2, ClassId: sku.ClassID2,
GoodsName: sku.GoodsName,
} }
var activityService ActivityService var activityService ActivityService
priceActivity, giftActivity := activityService.GetActivityData(checkData) priceActivity, giftActivity := activityService.GetActivityData(checkData)
......
...@@ -11,7 +11,9 @@ import ( ...@@ -11,7 +11,9 @@ import (
"go_sku_server/pkg/gredis" "go_sku_server/pkg/gredis"
"go_sku_server/pkg/logger" "go_sku_server/pkg/logger"
_ "go_sku_server/pkg/mongo" _ "go_sku_server/pkg/mongo"
"go_sku_server/service/sorter"
_ "gopkg.in/mgo.v2/bson" _ "gopkg.in/mgo.v2/bson"
"sort"
"strings" "strings"
) )
...@@ -267,6 +269,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -267,6 +269,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
flag := 0 flag := 0
var data []model.LadderPrice var data []model.LadderPrice
var originalPrice []model.OriginPrice var originalPrice []model.OriginPrice
sort.Sort(sorter.OriginPriceSorter(sku.OriginalPrice))
//专卖价格获取 //专卖价格获取
if sku.SupplierId == 17 { if sku.SupplierId == 17 {
ladderPrice := sku.LadderPrice ladderPrice := sku.LadderPrice
......
package sorter
import "go_sku_server/model"
// 阶梯价格排序算法
type OriginPriceSorter []model.OriginPrice
func (a OriginPriceSorter) Len() int {
return len(a)
}
func (a OriginPriceSorter) Swap(i, j int) {
a[i], a[j] = a[j], a[i]
}
func (a OriginPriceSorter) Less(i, j int) bool {
return a[j].Purchases > a[i].Purchases
}
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