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
e1f4d532
authored
Nov 30, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复逻辑
parent
e0717e04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
service/service_ly_common.go
service/service_price.go
service/service_ly_common.go
View file @
e1f4d532
...
@@ -454,11 +454,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -454,11 +454,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//这里是去取实时美金汇率,并且计算人民币价格
//这里是去取实时美金汇率,并且计算人民币价格
var
usdRatio
float64
var
usdRatio
float64
if
sku
.
CustomizeRateRMB
!=
0
{
if
sku
.
CustomizeRateRMB
!=
0
{
usdRatio
=
sku
.
CustomizeRateRMB
priceCostCn
=
c
.
MulFloat
(
price
.
PriceCn
,
1
,
tax
)
}
else
{
}
else
{
usdRatio
,
_
=
redis
.
Float64
(
redisCon
.
Do
(
"HGET"
,
"erp_rate"
,
2
))
usdRatio
,
_
=
redis
.
Float64
(
redisCon
.
Do
(
"HGET"
,
"erp_rate"
,
2
))
priceCostCn
=
c
.
MulFloat
(
price
.
PriceUs
,
usdRatio
,
tax
)
}
}
priceCostCn
=
c
.
MulFloat
(
price
.
PriceUs
,
usdRatio
,
tax
)
}
}
priceCostCn
=
c
.
MulFloat
(
c
.
MyRound
(
priceCostCn
,
4
),
sku
.
DiscountRatio
.
Ratio
)
priceCostCn
=
c
.
MulFloat
(
c
.
MyRound
(
priceCostCn
,
4
),
sku
.
DiscountRatio
.
Ratio
)
priceCostCn
=
c
.
MyRound
(
priceCostCn
,
4
)
priceCostCn
=
c
.
MyRound
(
priceCostCn
,
4
)
...
...
service/service_price.go
View file @
e1f4d532
...
@@ -667,6 +667,21 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
...
@@ -667,6 +667,21 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
//自定义汇率优先级最高
//自定义汇率优先级最高
customizeRateRmb
:=
gjson
.
Get
(
currencyConfig
,
"customize_rate_rmb"
)
.
Float
()
customizeRateRmb
:=
gjson
.
Get
(
currencyConfig
,
"customize_rate_rmb"
)
.
Float
()
customizeRateUsd
:=
gjson
.
Get
(
currencyConfig
,
"customize_rate_usd"
)
.
Float
()
customizeRateUsd
:=
gjson
.
Get
(
currencyConfig
,
"customize_rate_usd"
)
.
Float
()
if
customizeRateRmb
!=
0
{
//因为计算人民币价格的逻辑不在这里,所以记录下来,提供给计算人民币价格的逻辑
sku
.
CustomizeRateRMB
=
customizeRateRmb
for
index
,
price
:=
range
sku
.
LadderPrice
{
priceUs
:=
price
.
PriceUs
priceCn
:=
c
.
MyRound
(
c
.
MulFloat
(
priceUs
,
customizeRateRmb
),
4
)
if
hasTax
{
priceCn
=
c
.
MyRound
(
c
.
DivFloat
(
priceCn
,
1.13
),
4
)
}
sku
.
LadderPrice
[
index
]
.
PriceCn
=
priceCn
sku
.
OriginalPrice
[
index
]
.
PriceCn
=
priceCn
}
}
if
customizeRateUsd
!=
0
{
if
customizeRateUsd
!=
0
{
for
index
,
price
:=
range
sku
.
LadderPrice
{
for
index
,
price
:=
range
sku
.
LadderPrice
{
priceUs
:=
price
.
PriceUs
priceUs
:=
price
.
PriceUs
...
@@ -679,11 +694,6 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
...
@@ -679,11 +694,6 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku) model.LyS
}
}
}
}
if
customizeRateRmb
!=
0
{
//因为计算人民币价格的逻辑不在这里,所以记录下来,提供给计算人民币价格的逻辑
sku
.
CustomizeRateRMB
=
customizeRateRmb
}
if
customizeRateUsd
==
0
{
if
customizeRateUsd
==
0
{
//这里进行转换,因为这里都只能取到对应的币种转人民币的比率,我们没有直接各种币种转美金的数据,所以我这边要
//这里进行转换,因为这里都只能取到对应的币种转人民币的比率,我们没有直接各种币种转美金的数据,所以我这边要
//先根据对应币种转人民币,然后根据人民币转美金,才能得到不同币种对应美金的汇率
//先根据对应币种转人民币,然后根据人民币转美金,才能得到不同币种对应美金的汇率
...
...
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