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
0cf52465
authored
Jul 15, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
标准品牌
parent
eae0754d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
model/ly_sku.go
service/service_ly.go
service/service_ly_common.go
model/ly_sku.go
View file @
0cf52465
...
...
@@ -65,6 +65,7 @@ type LySku struct {
HasGiftActivity
int
`json:"has_gift_activity"`
GiftActivity
GiftActivity
`json:"gift_activity"`
ActivityInfo
PriceActivity
`json:"activity_info"`
StandardBrand
StandardBrand
`json:"standard_brand"`
}
type
PriceActivity
struct
{
...
...
@@ -89,6 +90,12 @@ type ActivityCommon struct {
UserScope
int
`json:"user_scope,omitempty"`
}
type
StandardBrand
struct
{
StandardBrandId
int
`json:"standard_brand_id,omitempty"`
BrandName
string
`json:"brand_name,omitempty"`
BrandLogo
string
`json:"brand_logo,omitempty"`
}
//为什么不直接映射到结构,而要用gjson,因为redis存的数据结构不一定正常,可能类型不一致
func
InitSkuData
(
sku
string
)
(
data
LySku
)
{
goodsSn
:=
gjson
.
Get
(
sku
,
"goods_sn"
)
.
String
()
...
...
service/service_ly.go
View file @
0cf52465
...
...
@@ -98,6 +98,9 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//继来那边对接的标准品牌(下单的时候)
sku
.
ScmBrand
=
ls
.
GetScmBrand
(
brandId
)
//获取新版的标准品牌
sku
.
StandardBrand
=
ls
.
GetStandardBrand
(
brandId
)
//处理过期
if
gjson
.
Get
(
skuStr
,
"is_expire"
)
.
Int
()
!=
0
{
sku
.
LadderPrice
=
nil
...
...
service/service_ly_common.go
View file @
0cf52465
...
...
@@ -109,6 +109,23 @@ func (ls *LyService) GetScmBrand(brandId int64) (res interface{}) {
}
}
//获取新版标准品牌
func
(
ls
*
LyService
)
GetStandardBrand
(
brandId
int64
)
(
standardBrand
model
.
StandardBrand
)
{
redisCon
:=
gredis
.
Conn
(
"default_r"
)
defer
redisCon
.
Close
()
standardBrandId
,
_
:=
redis
.
Int
(
redisCon
.
Do
(
"HGET"
,
"standard_brand_mapping"
,
brandId
))
if
standardBrandId
!=
0
{
standardBrandStr
,
err
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"standard_brand"
,
standardBrandId
))
if
err
!=
nil
{
logger
.
Select
(
"sku_query"
)
.
Error
(
err
.
Error
())
}
standardBrand
.
BrandName
=
gjson
.
Get
(
standardBrandStr
,
"brand_name"
)
.
String
()
standardBrand
.
StandardBrandId
=
int
(
gjson
.
Get
(
standardBrandStr
,
"standard_brand_id"
)
.
Int
())
standardBrand
.
BrandLogo
=
gjson
.
Get
(
standardBrandStr
,
"brandLogo"
)
.
String
()
}
return
standardBrand
}
type
ExtendFee
struct
{
Cn
struct
{
Max
interface
{}
`json:"max"`
...
...
@@ -323,12 +340,12 @@ func (ls *LyService) GetDelivery(supplierId int64, canal string) (delivery map[s
//为了兼容供应商修改的问题
if
cnDeliveryTime
!=
"周"
&&
cnDeliveryTime
!=
"天"
{
delivery
[
"cn_delivery"
]
=
gjson
.
Get
(
supplierRatio
,
"cn_delivery_time"
)
.
String
()
}
else
{
}
else
{
delivery
[
"cn_delivery"
]
=
""
}
if
usDeliveryTime
!=
"周"
&&
usDeliveryTime
!=
"天"
{
delivery
[
"hk_delivery"
]
=
gjson
.
Get
(
supplierRatio
,
"us_delivery_time"
)
.
String
()
}
else
{
}
else
{
delivery
[
"hk_delivery"
]
=
""
}
}
...
...
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