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
9e181fb6
authored
Dec 04, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.0
parent
aaa2c2e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
service/service_zy.go
service/service_zy.go
View file @
9e181fb6
...
...
@@ -73,10 +73,20 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context,goodsIds []string, ch ch
if
other_attrs
==
""
{
A
.
Set
(
"other_attrs"
,
""
)
}
else
{
A
.
Set
(
"other_attrs"
,
map
[
string
]
string
{
"length"
:
gjson
.
Get
(
other_attrs
,
"length"
)
.
String
(),
"gross_wegiht"
:
gjson
.
Get
(
other_attrs
,
"gross_wegiht"
)
.
String
(),
})
B
:=
make
(
map
[
string
]
string
)
pick_type
:=
gjson
.
Get
(
other_attrs
,
"pick_type"
)
.
String
()
length
:=
gjson
.
Get
(
other_attrs
,
"length"
)
.
String
()
gross_wegiht
:=
gjson
.
Get
(
other_attrs
,
"gross_wegiht"
)
.
String
()
if
pick_type
!=
""
{
B
[
"pick_type"
]
=
pick_type
}
if
length
!=
""
{
B
[
"length"
]
=
length
}
if
gross_wegiht
!=
""
{
B
[
"gross_wegiht"
]
=
gross_wegiht
}
A
.
Set
(
"other_attrs"
,
B
)
}
class_id1
:=
gjson
.
Get
(
info
,
"class_id1"
)
.
Int
()
...
...
@@ -114,11 +124,18 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context,goodsIds []string, ch ch
A
.
Set
(
"mpl"
,
gjson
.
Get
(
info
,
"mpl"
)
.
Int
())
//
//处理库存
lockStock
:=
qs
.
skuLockNum
(
&
redisConn
,
goods_id
)
//当前锁库库存
dbStock
:=
gjson
.
Get
(
info
,
"stock"
)
.
Int
()
//当前db库存
stock
:=
dbStock
-
lockStock
//当前可购买库存
A
.
Set
(
"stock"
,
stock
)
if
dbStock
>
0
{
lockStock
:=
qs
.
skuLockNum
(
&
redisConn
,
goods_id
)
//当前锁库库存
stockG
:=
dbStock
-
lockStock
//当前可购买库存
if
stockG
>
0
{
A
.
Set
(
"actual_stock"
,
gjson
.
Get
(
info
,
"actual_stock"
)
.
Int
())
//锁定库存
A
.
Set
(
"stock"
,
dbStock
)
}
else
{
A
.
Set
(
"stock"
,
0
)
}
A
.
Set
(
"saler_atio"
,
""
)
//
}
if
len
(
attrs
)
==
0
{
A
.
Set
(
"attrs"
,
""
)
//属性值
...
...
@@ -192,10 +209,7 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context,goodsIds []string, ch ch
}
A
.
Set
(
"scm_brand_name"
,
gjson
.
Get
(
info
,
"scm_brand_name"
)
.
String
())
//
A
.
Set
(
"actual_stock"
,
gjson
.
Get
(
info
,
"actual_stock"
)
.
Int
())
//
A
.
Set
(
"ac_type"
,
gjson
.
Get
(
info
,
"ac_type"
)
.
Int
())
//
A
.
Set
(
"saler_atio"
,
gjson
.
Get
(
info
,
"saler_atio"
)
.
String
())
//
//处理活动价
A
.
Set
(
"ac_type"
,
0
)
...
...
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