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
72849c98
authored
Oct 27, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
加入判断逻辑
parent
01f4579f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
controller/sku_controller.go
service/service_ly.go
controller/sku_controller.go
View file @
72849c98
...
@@ -162,6 +162,7 @@ func CommonController(ctx *gin.Context) map[string]interface{} {
...
@@ -162,6 +162,7 @@ func CommonController(ctx *gin.Context) map[string]interface{} {
case
<-
timeout
:
case
<-
timeout
:
logger
.
Log
(
"协程整体处理超时"
,
"sku"
,
1
)
logger
.
Log
(
"协程整体处理超时"
,
"sku"
,
1
)
panic
(
"协程整体处理超时"
)
return
temp
// 超时,返回已经收到的部分数据
return
temp
// 超时,返回已经收到的部分数据
}
}
}
}
...
...
service/service_ly.go
View file @
72849c98
...
@@ -10,6 +10,7 @@ import (
...
@@ -10,6 +10,7 @@ import (
"sort"
"sort"
"strconv"
"strconv"
"sync"
"sync"
"time"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"gopkg.in/mgo.v2/bson"
...
@@ -59,6 +60,12 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
...
@@ -59,6 +60,12 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//是否展示spu额外信息
//是否展示spu额外信息
showSpuExtra
:=
ctx
.
Request
.
FormValue
(
"show_spu_extra"
)
showSpuExtra
:=
ctx
.
Request
.
FormValue
(
"show_spu_extra"
)
//是否超时
timeout
:=
ctx
.
Request
.
FormValue
(
"timeout"
)
if
timeout
==
"1"
{
time
.
Sleep
(
time
.
Second
*
15
)
}
//批量获取商品详情
//批量获取商品详情
skuArr
:=
gredis
.
Hmget
(
"default_r"
,
"sku"
,
goodsIds
)
skuArr
:=
gredis
.
Hmget
(
"default_r"
,
"sku"
,
goodsIds
)
//为了性能着想,这边也先去批量获取spu的信息
//为了性能着想,这边也先去批量获取spu的信息
...
...
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