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
30795bf2
authored
Mar 22, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
阶梯取值问题
parent
21e8ae00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
service/service_ly_common.go
service/service_ly_common.go
View file @
30795bf2
...
...
@@ -514,15 +514,29 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
data
[
key
]
.
Purchases
=
price
.
Purchases
//找出对应的阶梯,从$priceRatioList找到对应的售价组系数
//这个是为了怕后台存的数据格式不对导致无法获取到对应的系数
//这里去取对应的售价利润阶梯的时候,是往下匹配的,比如 阶梯价是 1,2,3 售价组利润是 1,2,3,4,5,那么123对应的是售价组利润的345
//而且当原始阶梯价为10个的时候,超过了售价利润组的9个,就要去取第9个售价利润组
var
priceRatio
model
.
PriceRatio
if
len
(
priceRatioList
)
>
key
{
priceRatio
=
priceRatioList
[
key
]
//先找出一共有多少个阶梯
ladderCount
:=
len
(
sku
.
LadderPrice
)
ratioCount
:=
len
(
priceRatioList
)
if
ladderCount
>
key
&&
key
<
ratioCount
{
margin
:=
ratioCount
-
ladderCount
if
margin
<
0
{
margin
=
0
}
fmt
.
Println
(
key
+
margin
)
priceRatio
=
priceRatioList
[
key
+
margin
]
}
else
if
key
>=
ratioCount
{
priceRatio
=
priceRatioList
[
ratioCount
-
1
]
fmt
.
Println
(
"超过了售价利润组的9个,取到的售价组是 : "
,
priceRatio
)
}
else
{
priceRatio
=
model
.
PriceRatio
{
Ratio
:
1
,
RatioUsd
:
1
,
}
}
fmt
.
Println
(
"当前循环售价组 : "
,
priceRatio
)
//美金成本价
priceCostUs
:=
c
.
MulFloat
(
price
.
PriceUs
,
usDiscountRatio
)
priceCostUs
=
c
.
MyRound
(
priceCostUs
,
4
)
...
...
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