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
0a8fd74e
authored
Apr 14, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
兼容销售限价
parent
9bc09bdb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
20 deletions
service/service_ly.go
service/service_price.go
service/service_ly.go
View file @
0a8fd74e
...
...
@@ -185,27 +185,39 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
sku
.
CustomPriceList
,
_
=
customPriceService
.
getCustomPriceList
(
sku
)
}
case
3
:
//如果是寄售的,也不走价格体系
if
sku
.
Source
!=
12
{
//这里还有个特殊判断,要兼容华云改价格体系之前的老数据
//判断组织是3并且阶梯价数量为2的就是老数据
//兼容最近的价格配置,即上传了成本价(阶梯数量0) + 会员价(阶梯数量1) + 企业价(阶梯数量2)
if
(
sku
.
OrgId
==
3
&&
len
(
sku
.
LadderPrice
)
==
2
)
||
(
sku
.
OrgId
==
3
&&
len
(
sku
.
LadderPrice
)
==
3
&&
sku
.
LadderPrice
[
0
]
.
Purchases
==
0
)
{
priceService
:=
PriceService
{}
sku
.
LadderPrice
=
priceService
.
GetIEdgePrice
(
sku
.
LadderPrice
)
}
else
{
//这里猎芯和华云都是走同一套的价格体系了
//获取系数和价格
sku
=
ls
.
GetCoefficientAndPrice
(
sku
)
//获取自定义价格后的阶梯价
customPriceService
:=
CustomPrice
{}
sku
.
CustomPriceList
,
_
=
customPriceService
.
getCustomPriceList
(
sku
)
//这里还要针对华云的阶梯价进行一次转换,因为要兼容目前华云的使用方式
if
sku
.
OrgId
==
3
{
sku
.
LadderPrice
=
customPriceService
.
transformIEdgeLadderPrice
(
sku
)
}
//如果是寄售的,不走价格体系
if
sku
.
Source
==
12
{
break
}
//这里还有个特殊判断,要兼容华云改价格体系之前的老数据
//判断组织是3并且阶梯价数量为2,并且第一个阶梯不是0的就是老数据
//兼容最近的价格配置,即上传了成本价(阶梯数量0) + 会员价(阶梯数量1) + 企业价(阶梯数量2)
//又要兼容新的价格配置,即上传了成本价(阶梯数量0) + 会员价(阶梯数量1) + 企业价(阶梯数量2) + 销售限价(阶梯数量3)
//还有一种特殊情况,那就是只上传成本价和销售限价,那么就是要走价格体系的(最新)
if
(
sku
.
OrgId
==
3
&&
len
(
sku
.
LadderPrice
)
==
2
&&
sku
.
LadderPrice
[
0
]
.
Purchases
!=
0
)
||
(
sku
.
OrgId
==
3
&&
len
(
sku
.
LadderPrice
)
==
3
&&
sku
.
LadderPrice
[
0
]
.
Purchases
==
0
)
||
(
sku
.
OrgId
==
3
&&
len
(
sku
.
LadderPrice
)
==
4
&&
sku
.
LadderPrice
[
0
]
.
Purchases
==
0
)
{
priceService
:=
PriceService
{}
sku
.
LadderPrice
=
priceService
.
GetIEdgePrice
(
sku
.
LadderPrice
)
}
else
{
//判断是不是华云的,如果是的话,还要判断是不是有成本价和销售限价,如果是的话,要把销售限价去掉,因为走的价格体系的前提是有成本价的时候
//只能有一个阶梯,并且阶梯数量为0
if
sku
.
OrgId
==
3
&&
len
(
sku
.
LadderPrice
)
==
2
{
sku
.
LadderPrice
=
sku
.
LadderPrice
[
:
1
]
}
//这里猎芯和华云都是走同一套的价格体系了
//获取系数和价格
sku
=
ls
.
GetCoefficientAndPrice
(
sku
)
fmt
.
Println
(
sku
.
LadderPrice
)
//获取自定义价格后的阶梯价
customPriceService
:=
CustomPrice
{}
sku
.
CustomPriceList
,
_
=
customPriceService
.
getCustomPriceList
(
sku
)
//这里还要针对华云的阶梯价进行一次转换,因为要兼容目前华云的使用方式
if
sku
.
OrgId
==
3
{
sku
.
LadderPrice
=
customPriceService
.
transformIEdgeLadderPrice
(
sku
)
}
}
break
default
:
...
...
service/service_price.go
View file @
0a8fd74e
...
...
@@ -742,6 +742,7 @@ func (ps *PriceService) GetIEdgePrice(ladderPrice []model.LadderPrice) []model.L
0
:
"成本价"
,
1
:
"标准价"
,
2
:
"企业价"
,
3
:
"销售限价"
,
}
for
index
,
price
:=
range
ladderPrice
{
ladderPrice
[
index
]
.
PriceName
=
priceNameMap
[
price
.
Purchases
]
...
...
@@ -752,5 +753,10 @@ func (ps *PriceService) GetIEdgePrice(ladderPrice []model.LadderPrice) []model.L
ladderPrice
=
ladderPrice
[
1
:
]
}
//如果是4个价格,那么只要中间2个
if
len
(
ladderPrice
)
==
4
{
ladderPrice
=
ladderPrice
[
1
:
3
]
}
return
ladderPrice
}
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