Commit c83cbe27 by mushishixian

Merge branch 'ysx-魔方改版-20230313' into dev

parents 2e918fed 434aa3a2
......@@ -4,17 +4,18 @@ type Activity struct {
Id int64 `json:"id"`
SupplierIds string `json:"supplier_ids"`
SupplierIdList []string
SupplierType int `json:"supplier_type"`
UserScope int `json:"user_scope"`
CanAdminOrder interface{} `json:"can_admin_order"`
SignText string `json:"sign_text"`
BrandIds string `json:"brand_ids"`
SupplierType int `json:"supplier_type"`
UserScope int `json:"user_scope"`
CanAdminOrder interface{} `json:"can_admin_order"`
SignText string `json:"sign_text"`
BrandIds string `json:"brand_ids"`
BrandIdList []string
ClassIds string `json:"class_ids"`
ClassIdList []string
Canals string `json:"canals"`
CanalList []string
Ratio float64 `json:"ratio"`
RatioUs float64 `json:"ratio_us"`
StartTime int `json:"start_time"`
EndTime int `json:"end_time"`
AddTime int `json:"add_time"`
......
......@@ -2,21 +2,25 @@ package model
//联营统一返回格式
type LyResponse struct {
ErrorCode int `json:"error_code"`
ErrorMsg string `json:"error_msg"`
Data interface{} `json:"data"`
ErrorCode int `json:"error_code"`
ErrorMsg string `json:"error_msg"`
Data interface{} `json:"data"`
}
//原始sku梯度
type LadderPrice struct {
Purchases int64 `json:"purchases"` //购买数量
PriceUs float64 `json:"price_us,omitempty"` //数量对应的英文价格
PriceCn float64 `json:"price_cn"` //数量对应的中文价格
PriceAc float64 `json:"price_ac,omitempty"`
CostPrice float64 `json:"-"`
Purchases int64 `json:"purchases"` //购买数量
PriceUs float64 `json:"price_us,omitempty"` //数量对应的英文价格
PriceCn float64 `json:"price_cn"` //数量对应的中文价格
PriceCostUs float64 `json:"price_cost_us"` //成本价美金
PriceCostCn float64 `json:"price_cost_cn"` //成本价人民币
PriceAc float64 `json:"price_ac,omitempty"` //活动价人民币
PriceAcUs float64 `json:"price_ac_us"` //活动价美金
CostPrice float64 `json:"-"`
}
type OriginPrice struct {
Purchases int64 `json:"purchases"` //购买数量
Purchases int64 `json:"purchases"` //购买数量
PriceUs float64 `json:"price_us"` //数量对应的英文价格
PriceCn float64 `json:"price_cn"` //数量对应的中文价格
PriceAc float64 `json:"price_ac,omitempty"`
......@@ -25,12 +29,12 @@ type OriginPrice struct {
//立创价格梯度
type LadderPriceLc struct {
Purchases int64 `json:"purchases"` //购买数量
Price float64 `json:"price"` //立创价格,人民币
Purchases int64 `json:"purchases"` //购买数量
Price float64 `json:"price"` //立创价格,人民币
}
//自营属性列表
type Attrs struct {
AttrName string `json:"attr_name"` //属性名称
AttrValue string `json:"attr_value"` //属性值
}
\ No newline at end of file
AttrName string `json:"attr_name"` //属性名称
AttrValue string `json:"attr_value"` //属性值
}
......@@ -60,6 +60,7 @@ type LySku struct {
ClassName2 string `json:"class_name2,omitempty"`
ClassName3 string `json:"class_name3,omitempty"`
Ratio float64 `json:"ratio,omitempty"`
RatioUs float64 `json:"ratio_us,omitempty"`
SpuDetail string `json:"spu_detail,omitempty"`
AcType int `json:"ac_type"`
......@@ -70,11 +71,13 @@ type LySku struct {
StandardBrand StandardBrand `json:"standard_brand"`
GoodsTag GoodsTag `json:"goods_tag"`
StockInfo interface{} `json:"stock_info"`
Eccn string `json:"eccn"`
}
type PriceActivity struct {
ActivityCommon
Ratio float64 `json:"ratio,omitempty"`
RatioUs float64 `json:"ratio_us,omitempty"`
SignText string `json:"sign_text,omitempty"`
Sign string `json:"sign,omitempty"`
ShowName string `json:"show_name,omitempty"`
......@@ -155,6 +158,9 @@ func InitSkuData(sku string) (data LySku) {
stock := gjson.Get(sku, "stock").Int()
data.Stock = stock
eccn := gjson.Get(sku, "eccn").String()
data.Eccn = eccn
isExpire := gjson.Get(sku, "is_expire").Int()
data.IsExpire = int(isExpire)
......
......@@ -198,6 +198,11 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
UserScope: activity.UserScope,
},
}
if activity.RatioUs > 0 {
priceActivity.RatioUs = activity.RatioUs
} else {
priceActivity.RatioUs = 1
}
break
}
}
......
......@@ -133,6 +133,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
sku.AllowCoupon = 1
sku.BrandId = brandId
//这里获取活动价格和活动类型
sku = ls.GetActivity(sku)
//处理阶梯价数据
......@@ -146,7 +147,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
}
}
//获取系数
sku = ls.GetCoefficient(sku)
sku = ls.GetCoefficientAndPrice(sku)
//仅提供价格和库存
if fast != "1" {
......@@ -215,6 +216,8 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku {
if priceActivity.HasActivity {
sku.AcType = 10
sku.Ratio = priceActivity.Ratio
sku.RatioUs = priceActivity.RatioUs
sku.ActivityInfo = priceActivity
}
if giftActivity.HasActivity {
......
package sorter
import "sort"
// Define a custom type and methods to implement sort.Interface
type DescendingInts []int
func (d DescendingInts) Len() int { return len(d) }
func (d DescendingInts) Swap(i, j int) { d[i], d[j] = d[j], d[i] }
func (d DescendingInts) Less(i, j int) bool { return d[i] > d[j] }
func IntSliceSortDesc(numbers []int) []int {
sort.Sort(DescendingInts(numbers))
return numbers
}
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