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
f024c72d
authored
Aug 06, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'ysx-售价组的或判断改成与判断-20250805' into dev
parents
766455de
7bf43ffe
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
397 additions
and
62 deletions
doc/sku_price_flow_documentation.md
service/service_price.go
doc/sku_price_flow_documentation.md
0 → 100644
View file @
f024c72d
This diff is collapsed.
Click to expand it.
service/service_price.go
View file @
f024c72d
...
...
@@ -67,7 +67,6 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
//然后确定排序
sortNumbers
=
sorter
.
IntSliceSortDesc
(
sortNumbers
)
//确定排序以后,就可以进行按排序(从大到小)取系数
outerLoop
:
for
_
,
sortNumber
:=
range
sortNumbers
{
priceRatioSort
=
sortNumber
priceRatioList
=
nil
...
...
@@ -81,17 +80,17 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
priceRatio
.
Purchases
=
gjson
.
Get
(
value
.
String
(),
"purchases"
)
.
Int
()
priceRatioList
=
append
(
priceRatioList
,
priceRatio
)
}
//是否满足特定条件的判断
//是否满足特定条件的判断
var
hasSpecialCheck
=
false
conditionsMet
:=
true
//判断是否有符合的商品名称
goodsNames
:=
gjson
.
Get
(
priceRatioCache
,
"goods_name."
+
sortString
)
.
String
()
if
goodsNames
!=
""
{
hasSpecialCheck
=
true
goodsNameList
:=
strings
.
Split
(
goodsNames
,
"@€@"
)
//找到有对应的商品名称,那么优先级肯定是最高的了
if
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
foundRatio
=
true
break
if
!
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
conditionsMet
=
false
}
}
...
...
@@ -100,12 +99,9 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
if
brandIds
!=
""
{
hasSpecialCheck
=
true
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
","
)
//fmt.Println(standardBrandIdList)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
foundRatio
=
true
break
if
!
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
conditionsMet
=
false
}
}
...
...
@@ -115,10 +111,8 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
hasSpecialCheck
=
true
classIdList
:=
strings
.
Split
(
classIds
,
","
)
classId
:=
strconv
.
Itoa
(
sku
.
ClassID2
)
//找到有对应的分类ID,那么优先级肯定是最高的了
if
php2go
.
InArray
(
classId
,
classIdList
)
{
foundRatio
=
true
break
if
!
php2go
.
InArray
(
classId
,
classIdList
)
{
conditionsMet
=
false
}
}
...
...
@@ -126,11 +120,9 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
eccns
:=
gjson
.
Get
(
priceRatioCache
,
"eccn."
+
sortString
)
.
String
()
if
eccns
!=
""
{
hasSpecialCheck
=
true
eccnMatched
:=
false
eccnList
:=
strings
.
Split
(
eccns
,
","
)
//找到有对应的eccn,那么优先级肯定是最高的了
for
_
,
eccn
:=
range
eccnList
{
//判断是否有百分号匹配
//如果是纯%,那就是不对的,要跳过
if
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
==
""
{
continue
}
...
...
@@ -140,36 +132,44 @@ func (ps *PriceService) GenerateLadderPrice(sku model.LySku) model.LySku {
if
hasPrefix
&&
hasSuffix
{
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
Contains
(
sku
.
Eccn
,
eccn
)
{
foundRatio
=
true
break
outerLoop
eccnMatched
=
true
break
}
}
if
hasPrefix
&&
!
hasSuffix
{
}
else
if
hasPrefix
{
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
HasSuffix
(
sku
.
Eccn
,
eccn
)
{
foundRatio
=
true
break
outerLoop
eccnMatched
=
true
break
}
}
if
!
hasPrefix
&&
hasSuffix
{
}
else
if
hasSuffix
{
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
HasPrefix
(
sku
.
Eccn
,
eccn
)
{
foundRatio
=
true
break
outerLoop
eccnMatched
=
true
break
}
}
}
else
{
if
sku
.
Eccn
==
eccn
{
foundRatio
=
true
break
outerLoop
eccnMatched
=
true
break
}
}
}
if
!
eccnMatched
{
conditionsMet
=
false
}
}
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if
hasSpecialCheck
{
continue
if
conditionsMet
{
foundRatio
=
true
break
}
else
{
continue
}
}
// 如果没有设置任何特殊条件,则默认匹配
foundRatio
=
true
break
}
...
...
@@ -554,7 +554,6 @@ func (ps PriceService) GetPriceRatio(sku model.LySku) (model.LySku, []model.Pric
//然后确定排序
sortNumbers
=
sorter
.
IntSliceSortDesc
(
sortNumbers
)
//确定排序以后,就可以进行按排序(从大到小)取系数
outerLoop
:
for
_
,
sortNumber
:=
range
sortNumbers
{
priceRatioSort
=
sortNumber
priceRatioList
=
nil
...
...
@@ -568,16 +567,15 @@ func (ps PriceService) GetPriceRatio(sku model.LySku) (model.LySku, []model.Pric
}
var
hasSpecialCheck
=
false
conditionsMet
:=
true
//判断是否有符合的商品名称
goodsNames
:=
gjson
.
Get
(
priceRatioCache
,
"goods_name."
+
sortString
)
.
String
()
if
goodsNames
!=
""
{
hasSpecialCheck
=
true
goodsNameList
:=
strings
.
Split
(
goodsNames
,
"@€@"
)
//找到有对应的商品名称,那么优先级肯定是最高的了
if
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
foundRatio
=
true
break
if
!
php2go
.
InArray
(
sku
.
GoodsName
,
goodsNameList
)
{
conditionsMet
=
false
}
}
...
...
@@ -587,10 +585,8 @@ func (ps PriceService) GetPriceRatio(sku model.LySku) (model.LySku, []model.Pric
hasSpecialCheck
=
true
standardBrandIdList
:=
strings
.
Split
(
brandIds
,
","
)
standardBrandId
:=
strconv
.
Itoa
(
sku
.
StandardBrand
.
StandardBrandId
)
//找到有对应的品牌,那么优先级肯定是最高的了
if
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
foundRatio
=
true
break
if
!
php2go
.
InArray
(
standardBrandId
,
standardBrandIdList
)
{
conditionsMet
=
false
}
}
...
...
@@ -600,10 +596,8 @@ func (ps PriceService) GetPriceRatio(sku model.LySku) (model.LySku, []model.Pric
hasSpecialCheck
=
true
classIdList
:=
strings
.
Split
(
classIds
,
","
)
classId
:=
strconv
.
Itoa
(
sku
.
ClassID2
)
//找到有对应的分类ID,那么优先级肯定是最高的了
if
php2go
.
InArray
(
classId
,
classIdList
)
{
foundRatio
=
true
break
if
!
php2go
.
InArray
(
classId
,
classIdList
)
{
conditionsMet
=
false
}
}
...
...
@@ -611,11 +605,9 @@ func (ps PriceService) GetPriceRatio(sku model.LySku) (model.LySku, []model.Pric
eccns
:=
gjson
.
Get
(
priceRatioCache
,
"eccn."
+
sortString
)
.
String
()
if
eccns
!=
""
{
hasSpecialCheck
=
true
eccnMatched
:=
false
eccnList
:=
strings
.
Split
(
eccns
,
","
)
//找到有对应的eccn,那么优先级肯定是最高的了
for
_
,
eccn
:=
range
eccnList
{
//判断是否有百分号匹配
//如果是纯%,那就是不对的,要跳过
if
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
==
""
{
continue
}
...
...
@@ -625,36 +617,44 @@ func (ps PriceService) GetPriceRatio(sku model.LySku) (model.LySku, []model.Pric
if
hasPrefix
&&
hasSuffix
{
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
Contains
(
sku
.
Eccn
,
eccn
)
{
foundRatio
=
true
break
outerLoop
eccnMatched
=
true
break
}
}
if
hasPrefix
&&
!
hasSuffix
{
}
else
if
hasPrefix
{
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
HasSuffix
(
sku
.
Eccn
,
eccn
)
{
foundRatio
=
true
break
outerLoop
eccnMatched
=
true
break
}
}
if
!
hasPrefix
&&
hasSuffix
{
}
else
if
hasSuffix
{
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
HasPrefix
(
sku
.
Eccn
,
eccn
)
{
foundRatio
=
true
break
outerLoop
eccnMatched
=
true
break
}
}
}
else
{
if
sku
.
Eccn
==
eccn
{
foundRatio
=
true
break
outerLoop
eccnMatched
=
true
break
}
}
}
if
!
eccnMatched
{
conditionsMet
=
false
}
}
//如果没有设置品牌和商品,那么这个优先级高的就会覆盖下面的了,不需要再去判断品牌和型号了
if
hasSpecialCheck
{
continue
if
conditionsMet
{
foundRatio
=
true
break
}
else
{
continue
}
}
// 如果没有设置任何特殊条件,则默认匹配
foundRatio
=
true
break
}
...
...
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