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
576fd30c
authored
Jan 12, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
bc8f6310
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
25 deletions
model/ly_sku.go
service/service_activity.go
service/service_ly.go
service/service_zy.go
service/service_zy_common.go
model/ly_sku.go
View file @
576fd30c
...
...
@@ -64,26 +64,27 @@ type LySku struct {
//活动信息
HasGiftActivity
int
`json:"has_gift_activity"`
GiftActivity
GiftActivity
`json:"gift_activity"`
ActivityInfo
struct
{
ActivityId
int
`json:"activity_id,omitempty"`
ActivityName
string
`json:"activity_name,omitempty"`
}
`json:"activity_info"`
ActivityInfo
PriceActivity
`json:"activity_info"`
}
type
PriceActivity
struct
{
HasActivity
bool
`json:"-"`
ActivityId
int
`json:"activity_id,omitempty"`
ActivityName
string
`json:"activity_name,omitempty"`
AllowCoupon
int
`json:"-"`
ActivityCommon
Ratio
float64
`json:"ratio"`
}
type
GiftActivity
struct
{
ActivityCommon
ItemList
[]
ActivityItem
`json:"items,omitempty"`
}
type
ActivityCommon
struct
{
HasActivity
bool
`json:"-"`
ActivityId
int
`json:"activity_id,omitempty"`
ActivityName
int
`json:"activity_name,omitempty"`
ActivityName
string
`json:"activity_name,omitempty"`
AllowCoupon
int
`json:"-"`
ItemList
[]
ActivityItem
`json:"items,omitempty"`
SignText
string
`json:"sign_text"`
Sign
string
`json:"sign"`
ShowName
string
`json:"show_name"`
}
//为什么不直接映射到结构,而要用gjson,因为redis存的数据结构不一定正常,可能类型不一致
...
...
service/service_activity.go
View file @
576fd30c
...
...
@@ -61,38 +61,52 @@ func (as *ActivityService) GetGiftActivity(checkData model.ActivityCheckData, ac
//如果是整个供应商搞活动,则直接返回系数
if
activity
.
EntireSupplierActivity
{
hasActivity
=
true
giftActivity
.
ItemList
=
activity
.
ItemList
giftActivity
.
ActivityId
=
activity
.
ActivityId
goto
INFO
}
//判断是否是排除的sku或者品牌,如果是的话,直接返回没活动
if
as
.
CheckExcludeSku
(
checkData
.
GoodsId
,
activity
)
||
as
.
CheckExcludeBrand
(
checkData
.
BrandId
,
activity
)
{
hasActivity
=
false
goto
INFO
}
//判断是否是搞活动的品牌
if
as
.
CheckBrand
(
checkData
.
BrandId
,
activity
)
{
hasActivity
=
true
giftActivity
.
ItemList
=
activity
.
ItemList
giftActivity
.
ActivityId
=
activity
.
ActivityId
goto
INFO
}
//如果是专卖,则要去判断canal,如果是自营,则去判断分类
if
checkData
.
SupplierId
==
17
{
if
as
.
CheckCanal
(
checkData
.
Canal
,
activity
)
{
hasActivity
=
true
giftActivity
.
ItemList
=
activity
.
ItemList
giftActivity
.
ActivityId
=
activity
.
ActivityId
goto
INFO
}
}
else
{
if
as
.
CheckClass
(
checkData
.
ClassId
,
activity
)
{
hasActivity
=
true
giftActivity
.
ItemList
=
activity
.
ItemList
goto
INFO
}
}
INFO
:
if
hasActivity
{
giftActivity
.
ActivityName
=
activity
.
ActivityName
giftActivity
.
ActivityId
=
activity
.
ActivityId
giftActivity
=
model
.
GiftActivity
{
ItemList
:
activity
.
ItemList
,
ActivityCommon
:
model
.
ActivityCommon
{
HasActivity
:
hasActivity
,
ActivityId
:
activity
.
ActivityId
,
ActivityName
:
activity
.
ActivityName
,
AllowCoupon
:
activity
.
AllowCoupon
,
SignText
:
activity
.
SignText
,
Sign
:
activity
.
Sign
,
ShowName
:
activity
.
ShowName
,
},
}
}
}
giftActivity
.
HasActivity
=
hasActivity
return
}
...
...
@@ -108,36 +122,49 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
//如果是整个供应商搞活动,则直接返回系数
if
activity
.
EntireSupplierActivity
{
hasActivity
=
true
priceActivity
.
Ratio
=
activity
.
Ratio
goto
INFO
}
//判断是否是排除的sku或者品牌,如果是的话,直接返回没活动
if
as
.
CheckExcludeSku
(
checkData
.
GoodsId
,
activity
)
||
as
.
CheckExcludeBrand
(
checkData
.
BrandId
,
activity
)
{
hasActivity
=
false
goto
INFO
}
//判断是否是搞活动的品牌
if
as
.
CheckBrand
(
checkData
.
BrandId
,
activity
)
{
hasActivity
=
true
priceActivity
.
Ratio
=
activity
.
Ratio
goto
INFO
}
//如果是专卖,则要去判断canal,如果是自营,则去判断分类
if
checkData
.
SupplierId
==
17
{
if
as
.
CheckCanal
(
checkData
.
Canal
,
activity
)
{
hasActivity
=
true
priceActivity
.
Ratio
=
activity
.
Ratio
goto
INFO
}
}
else
{
if
as
.
CheckClass
(
checkData
.
ClassId
,
activity
)
{
hasActivity
=
true
priceActivity
.
Ratio
=
activity
.
Ratio
goto
INFO
}
}
INFO
:
if
hasActivity
{
priceActivity
.
AllowCoupon
=
activity
.
AllowCoupon
priceActivity
.
ActivityName
=
activity
.
ActivityName
priceActivity
.
ActivityId
=
activity
.
ActivityId
priceActivity
=
model
.
PriceActivity
{
Ratio
:
activity
.
Ratio
,
ActivityCommon
:
model
.
ActivityCommon
{
HasActivity
:
hasActivity
,
ActivityId
:
activity
.
ActivityId
,
ActivityName
:
activity
.
ActivityName
,
AllowCoupon
:
activity
.
AllowCoupon
,
SignText
:
activity
.
SignText
,
Sign
:
activity
.
Sign
,
ShowName
:
activity
.
ShowName
,
},
}
}
}
...
...
service/service_ly.go
View file @
576fd30c
...
...
@@ -188,8 +188,7 @@ func (ls *LyService) GetActivity(sku model.LySku) model.LySku {
if
priceActivity
.
HasActivity
{
sku
.
AcType
=
10
sku
.
Ratio
=
priceActivity
.
Ratio
sku
.
ActivityInfo
.
ActivityId
=
priceActivity
.
ActivityId
sku
.
ActivityInfo
.
ActivityName
=
priceActivity
.
ActivityName
sku
.
ActivityInfo
=
priceActivity
}
if
giftActivity
.
HasActivity
{
sku
.
HasGiftActivity
=
gconv
.
Int
(
giftActivity
.
HasActivity
)
...
...
service/service_zy.go
View file @
576fd30c
This diff is collapsed.
Click to expand it.
service/service_zy_common.go
View file @
576fd30c
This diff is collapsed.
Click to expand it.
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