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