Commit caa83cd8 by 杨树贤

去掉特殊屏蔽以及排序价格

parent a2f760d9
......@@ -39,8 +39,8 @@ type LySku struct {
AllowCoupon int `json:"allow_coupon"`
BrandId int64 `json:"brand_id"`
//系数相关
Coefficient interface{} `json:"coefficient,omitempty"`
OriginalPrice interface{} `json:"original_price,omitempty"`
Coefficient interface{} `json:"coefficient,omitempty"`
OriginalPrice []OriginPrice `json:"original_price,omitempty"`
//数据库存的价格,因为数据库存的是什么币种都有可能,但是也要展示数据库存的,所以要有这个字段
DatabasePrice interface{} `json:"database_price,omitempty"`
SuppExtendFee interface{} `json:"supp_extend_fee"`
......@@ -277,5 +277,6 @@ func getOriginPrice(ladderPriceStr string) (ladderPrice []OriginPrice) {
ladderPrice = []OriginPrice{}
return
}
return
}
......@@ -172,21 +172,11 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//判断是否可以购买
sku.IsBuy = ls.GetIsBuy(sku)
//过期修改库存为0
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.LadderPriceResult = []int{}
sku.IsBuy = 0
sku.BatchSn = ""
sku.Attrs = []int{}
}
//获取标签信息
var TagService TagsService
sku.GoodsTag = TagService.GetTags(sku.GoodsId, 0)
......
......@@ -11,7 +11,9 @@ import (
"go_sku_server/pkg/gredis"
"go_sku_server/pkg/logger"
_ "go_sku_server/pkg/mongo"
"go_sku_server/service/sorter"
_ "gopkg.in/mgo.v2/bson"
"sort"
"strings"
)
......@@ -267,6 +269,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
flag := 0
var data []model.LadderPrice
var originalPrice []model.OriginPrice
sort.Sort(sorter.OriginPriceSorter(sku.OriginalPrice))
//专卖价格获取
if sku.SupplierId == 17 {
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