Commit 48b27d07 by 杨树贤

digikey

parent 9bc09bdb
package service
import (
"fmt"
"go_sku_server/model"
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
......@@ -121,6 +120,12 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
if showStockInfo == "1" && sku.OldGoodsId != 0 {
sku.StockInfo = ls.getStockInfo(sku.SupplierId, sku.OldGoodsId)
}
//格式化为对象返回
if sku.StockInfo == nil {
type StockInfoResult struct {
}
sku.StockInfo = new(StockInfoResult)
}
//判断是否需要返回sku详情
if showSkuDetail == "1" {
......@@ -132,13 +137,6 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
sku.SpuExtra = ls.GetSpuExtra(sku.SpuId)
}
//格式化为对象返回
if sku.StockInfo == nil {
type StockInfoResult struct {
}
sku.StockInfo = new(StockInfoResult)
}
//获取供应链标准品牌
//什么是供应链的标准品牌 供应链那边报关的时候要求他们的标准品牌,所以要吧自己的品牌映射上去
//继来那边对接的标准品牌(下单的时候)
......@@ -321,7 +319,6 @@ func (ls *LyService) GetSpuExtra(spuId string) (spuExtra model.SpuExtra) {
if err != nil && err != mgo.ErrNotFound {
logger.Select("sku_query").Error(err.Error())
}
fmt.Println(spuExtra.Weight)
if spuExtra.Weight != "" {
spuExtra.TransformedWeight, _ = common.ConvertToGrams(spuExtra.Weight)
}
......
......@@ -368,6 +368,8 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
} else {
data = make([]model.LadderPrice, len(sku.LadderPrice))
//去获取各种系数(成本折扣系数,售价组系数,供应商系数)
//这是去找折扣系数
redisCon := gredis.Conn("default_r")
defer redisCon.Close()
......@@ -428,7 +430,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if !hasCoefficient {
coefficient = defaultCoefficient
}
//下面是计算价格
//价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk
// 为何是固定的1.13,关税基本不会变,有变的话跟产品沟通手动修改即可
......@@ -437,8 +438,8 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
var showPriceRatioList []model.PriceRatio
for key, price := range sku.LadderPrice {
//MRO是有人民币得代购
if sku.SupplierId == 1688 {
//MRO和Digikey是有人民币的代购
if sku.SupplierId == 1688 || sku.SupplierId == 7 {
originalPrice = append(originalPrice, model.OriginPrice{
PriceUs: price.PriceUs,
Purchases: price.Purchases,
......@@ -484,8 +485,9 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//fmt.Println("计算美金价的系数", priceRatio.RatioUsd)
priceUs := c.MulFloat(priceCostUs, priceRatio.RatioUsd)
//人民币成本价,mro只有人民币,所以人民币价格不是从美金来的,而且人民币是含税的.就它要特殊处理
//Digikey目前也有人民币
var priceCostCn float64
if sku.SupplierId == 1688 {
if sku.SupplierId == 1688 || sku.SupplierId == 7{
priceCostCn = c.MulFloat(price.PriceCn, 1)
} else {
//这里是去取实时美金汇率,并且计算人民币价格
......
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