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
53214465
authored
Dec 26, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复系数
parent
b0f270d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
service/service_ly_common.go
service/service_ly_common.go
View file @
53214465
...
...
@@ -2,6 +2,7 @@ package service
import
(
"encoding/json"
"fmt"
"go_sku_server/model"
c
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
...
...
@@ -317,13 +318,16 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
// 香港自营(L0018562)WMS同步过来的未税成本单价(美金)
//需更新到 基石该SKU的 成本价——香港交货($)且也需乘美金转人民币汇率, 再乘以关税,填入到基石该SKU的 成本价——国内含税(¥)价
//这里要获取一个第一个阶梯的未税成本价
// L0003270 这个供应商的话
,两种情况都会有
// L0003270 这个供应商的话
var
costNoTax
float64
if
sku
.
Canal
==
"L0018319"
{
if
sku
.
Canal
==
"L0018319"
||
sku
.
Canal
==
"L0003270"
{
for
index
,
price
:=
range
sku
.
OriginalPrice
{
priceCnNoTax
:=
price
.
PriceCn
if
index
==
0
{
costNoTax
=
price
.
PriceCn
costNoTax
=
priceCnNoTax
if
costNoTax
==
0
{
continue
}
}
originalPrice
=
append
(
originalPrice
,
model
.
OriginPrice
{
Purchases
:
price
.
Purchases
,
...
...
@@ -336,7 +340,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
}
if
sku
.
Canal
==
"L0018562"
{
if
sku
.
Canal
==
"L0018562"
||
sku
.
Canal
==
"L0003270"
{
redisCon
:=
gredis
.
Conn
(
"default_r"
)
defer
redisCon
.
Close
()
usdRatio
,
_
:=
redis
.
Float64
(
redisCon
.
Do
(
"HGET"
,
"erp_rate"
,
2
))
...
...
@@ -344,6 +348,9 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
priceCnNoTax
:=
c
.
MulFloat
(
price
.
PriceUs
,
usdRatio
)
if
index
==
0
{
costNoTax
=
priceCnNoTax
if
costNoTax
==
0
{
continue
}
}
originalPrice
=
append
(
originalPrice
,
model
.
OriginPrice
{
Purchases
:
price
.
Purchases
,
...
...
@@ -353,12 +360,15 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
for
index
,
price
:=
range
sku
.
LadderPrice
{
if
costNoTax
==
0
{
continue
}
ladderPrice
[
index
]
.
PriceCn
=
c
.
MyRound
(
c
.
MulFloat
(
price
.
PriceUs
,
usdRatio
*
tax
),
4
)
}
}
fmt
.
Println
(
sku
.
LadderPrice
)
sku
.
CostNoTax
=
costNoTax
//判断redis里面是否有成本价,有的话,那就直接去取价格,不需要生成阶梯价
//如果没有成本价字段,就要去生成阶梯价格
if
len
(
ladderPrice
)
>
0
{
...
...
@@ -395,7 +405,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
data
[
key
]
.
PriceCostCn
=
price
.
PriceCostCn
}
//判断原始价格有变化,那就要覆盖
if
len
(
originalPrice
)
>
0
{
sku
.
OriginalPrice
=
originalPrice
...
...
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