Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
golang-queue-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
86ff877f
authored
Nov 27, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
商品服务的请求问题
parent
100b879b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
order/goods_remind/main.go
order/goods_remind/main.go
View file @
86ff877f
...
...
@@ -89,11 +89,14 @@ func main() {
}
goodsIdsStr
:=
strings
.
Join
(
goodsIds
,
","
)
//去请求商品服务
resp
,
_
:=
req
.
Get
(
util
.
Configs
.
Api_domain
.
GoodsUrl
+
"?goods_id="
+
goodsIdsStr
)
fmt
.
Println
(
util
.
Configs
.
Api_domain
.
GoodsUrl
+
"?goods_id="
+
goodsIdsStr
)
params
:=
req
.
Param
{
"goods_id"
:
goodsIdsStr
,
}
resp
,
_
:=
req
.
Post
(
util
.
Configs
.
Api_domain
.
GoodsUrl
,
params
)
//先判断返回的data是不是字典,不是字典代表可能是返回字符串了
if
gjson
.
Get
(
resp
.
String
(),
"data"
)
.
IsObject
()
{
for
goodsIdKey
,
data
:=
range
gjson
.
Get
(
resp
.
String
(),
"data"
)
.
Map
()
{
fmt
.
Println
(
data
)
//还要去判断是否是bool
if
data
.
IsObject
()
{
goodsId
:=
data
.
Get
(
"goods_id"
)
.
Int
()
...
...
@@ -132,13 +135,12 @@ func main() {
panic
(
err
)
}
}
}
else
{
}
else
{
fmt
.
Println
(
"商品服务获取数据为空"
)
}
return
nil
})
if
err
!=
nil
{
fmt
.
Println
(
err
)
panic
(
err
)
}
}
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