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
6ed822cf
authored
Aug 18, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
精度丢失问题
parent
55e7752d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
service/service_ly_common.go
service/service_price.go
service/service_ly_common.go
View file @
6ed822cf
...
@@ -393,7 +393,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -393,7 +393,7 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk
//价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk
// 为何是固定的1.13,关税基本不会变,有变的话跟产品沟通手动修改即可
// 为何是固定的1.13,关税基本不会变,有变的话跟产品沟通手动修改即可
tax
:=
1.13
tax
:=
1.13
//
var showPriceRatioList []model.PriceRatio
var
showPriceRatioList
[]
model
.
PriceRatio
for
key
,
price
:=
range
sku
.
LadderPrice
{
for
key
,
price
:=
range
sku
.
LadderPrice
{
//这里有个前置条件处理美金价,因为element(6)存到美金字段里面的是港币,rs(21)存到美金字段里的是人民币,buerklin(1676)是欧元
//这里有个前置条件处理美金价,因为element(6)存到美金字段里面的是港币,rs(21)存到美金字段里的是人民币,buerklin(1676)是欧元
//所以要全部先转成正确的美金价才能显示,目前先写死汇率,因为目前没有地方能获取实时的各种转美金的汇率
//所以要全部先转成正确的美金价才能显示,目前先写死汇率,因为目前没有地方能获取实时的各种转美金的汇率
...
@@ -452,6 +452,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -452,6 +452,11 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//处理人民币
//处理人民币
data
[
key
]
.
PriceCn
=
c
.
MyRound
(
priceCn
,
4
)
data
[
key
]
.
PriceCn
=
c
.
MyRound
(
priceCn
,
4
)
data
[
key
]
.
PriceCostCn
=
priceCostCn
data
[
key
]
.
PriceCostCn
=
priceCostCn
showPriceRatioList
=
append
(
showPriceRatioList
,
model
.
PriceRatio
{
Ratio
:
priceRatio
.
Ratio
,
RatioUsd
:
priceRatio
.
RatioUsd
,
})
sku
.
PriceRatio
=
showPriceRatioList
//处理活动价和原价相同的情况
//处理活动价和原价相同的情况
if
(
sku
.
GoodsType
==
1
||
sku
.
GoodsType
==
2
||
sku
.
GoodsType
==
6
)
&&
sku
.
AcType
>
1
&&
sku
.
Ratio
>
0
{
if
(
sku
.
GoodsType
==
1
||
sku
.
GoodsType
==
2
||
sku
.
GoodsType
==
6
)
&&
sku
.
AcType
>
1
&&
sku
.
Ratio
>
0
{
priceAc
:=
c
.
MyRound
(
c
.
MulFloat
(
data
[
key
]
.
PriceCn
,
(
sku
.
Ratio
/
100
)),
4
)
priceAc
:=
c
.
MyRound
(
c
.
MulFloat
(
data
[
key
]
.
PriceCn
,
(
sku
.
Ratio
/
100
)),
4
)
...
...
service/service_price.go
View file @
6ed822cf
...
@@ -663,9 +663,8 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku, priceUs f
...
@@ -663,9 +663,8 @@ func (ps *PriceService) TransformSpecialSupplierPrice(sku model.LySku, priceUs f
fmt
.
Println
(
rmbRatio
,
usRatio
)
fmt
.
Println
(
rmbRatio
,
usRatio
)
//人民币汇率转美金汇率
//人民币汇率转美金汇率
usRatio
=
c
.
MyRound
(
c
.
DivFloat
(
rmbRatio
,
usRatio
),
4
)
usRatio
=
c
.
MyRound
(
c
.
DivFloat
(
rmbRatio
,
usRatio
),
6
)
priceUs
=
c
.
MyRound
(
c
.
MulFloat
(
priceUs
,
usRatio
),
4
)
priceUs
=
c
.
MyRound
(
c
.
MulFloat
(
priceUs
,
usRatio
),
4
)
fmt
.
Println
(
priceUs
)
}
}
return
priceUs
return
priceUs
}
}
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