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
87bc7803
authored
Mar 22, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
特殊供应商原始币种处理
parent
30795bf2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
pkg/common/function.go
service/service_ly_common.go
pkg/common/function.go
View file @
87bc7803
...
@@ -612,3 +612,8 @@ func MulFloat(first float64, args ...float64) float64 {
...
@@ -612,3 +612,8 @@ func MulFloat(first float64, args ...float64) float64 {
}
}
return
result
return
result
}
}
//浮点除法
func
DivFloat
(
first
float64
,
second
float64
)
float64
{
return
((
first
*
1000000000
)
/
(
second
*
1000000000
))
}
service/service_ly_common.go
View file @
87bc7803
...
@@ -508,6 +508,29 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
...
@@ -508,6 +508,29 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
//$tax = config('website.tax');
//$tax = config('website.tax');
tax
:=
1.13
tax
:=
1.13
for
key
,
price
:=
range
sku
.
LadderPrice
{
for
key
,
price
:=
range
sku
.
LadderPrice
{
//这里有个前置条件处理美金价,因为element(6)存到美金字段里面的是港币,rs(21)存到美金字段里的是人民币,buerklin(1676)是欧元
//所以要全部先转成正确的美金价才能显示,目前先写死汇率,因为目前没有地方能获取实时的各种转美金的汇率
switch
sku
.
SupplierId
{
case
6
:
fmt
.
Println
(
"特殊处理,原始美金价为 : "
,
price
.
PriceUs
)
customRate
:=
7.85
//港币转美金
price
.
PriceUs
=
c
.
MyRound
(
c
.
DivFloat
(
price
.
PriceUs
,
customRate
),
4
)
fmt
.
Println
(
"特殊处理后的美金价为 : "
,
price
.
PriceUs
)
break
case
21
:
fmt
.
Println
(
"特殊处理,原始美金价为 : "
,
price
.
PriceUs
)
customRate
:=
coefficient
.
Ratio
//人民币转美金
price
.
PriceUs
=
c
.
MyRound
(
c
.
DivFloat
(
price
.
PriceUs
,
customRate
),
4
)
fmt
.
Println
(
"特殊处理后的美金价为 : "
,
price
.
PriceUs
)
break
case
1676
:
fmt
.
Println
(
"特殊处理,原始美金价为 : "
,
price
.
PriceUs
)
customRate
:=
0.93
//欧元转美金
price
.
PriceUs
=
c
.
MyRound
(
c
.
DivFloat
(
price
.
PriceUs
,
customRate
),
4
)
fmt
.
Println
(
"特殊处理后的美金价为 : "
,
price
.
PriceUs
)
break
}
if
price
.
Purchases
==
0
{
if
price
.
Purchases
==
0
{
continue
continue
}
}
...
...
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