Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
48b27d07
authored
Apr 16, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
digikey
parent
9bc09bdb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
service/service_ly.go
service/service_ly_common.go
service/service_ly.go
View file @
48b27d07
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
)
}
...
...
service/service_ly_common.go
View file @
48b27d07
...
...
@@ -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
{
//这里是去取实时美金汇率,并且计算人民币价格
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment