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
90f06e0a
authored
Dec 02, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
5b66b21a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
controller/sku_controller.go
controller/sku_controller.go
View file @
90f06e0a
...
@@ -61,7 +61,7 @@ func Synchronization(ctx *gin.Context) {
...
@@ -61,7 +61,7 @@ func Synchronization(ctx *gin.Context) {
//wg.Add(1) //协程计数一
//wg.Add(1) //协程计数一
go
zyService
.
ZyGoodsDetail
(
ctx
,
zyGoodsId
,
ch
)
go
zyService
.
ZyGoodsDetail
(
ctx
,
zyGoodsId
,
ch
)
zyGoodsId
=
zyGoodsId
[
:
0
:
0
]
zyGoodsId
=
zyGoodsId
[
:
0
:
0
]
p
++
p
++
}
}
}
else
{
//联营
}
else
{
//联营
lyGoodsId
=
append
(
lyGoodsId
,
goodsId
)
lyGoodsId
=
append
(
lyGoodsId
,
goodsId
)
...
@@ -71,7 +71,7 @@ func Synchronization(ctx *gin.Context) {
...
@@ -71,7 +71,7 @@ func Synchronization(ctx *gin.Context) {
//wg.Add(1)
//wg.Add(1)
go
lyService
.
LyGoodsDetail
(
ctx
,
lyGoodsId
,
ch
)
go
lyService
.
LyGoodsDetail
(
ctx
,
lyGoodsId
,
ch
)
lyGoodsId
=
lyGoodsId
[
:
0
:
0
]
lyGoodsId
=
lyGoodsId
[
:
0
:
0
]
p
++
p
++
}
}
}
}
}
}
...
@@ -81,7 +81,7 @@ func Synchronization(ctx *gin.Context) {
...
@@ -81,7 +81,7 @@ func Synchronization(ctx *gin.Context) {
common
.
PrintDebugHtml
(
ctx
,
zyGoodsId
)
common
.
PrintDebugHtml
(
ctx
,
zyGoodsId
)
//wg.Add(1) //协程计数一
//wg.Add(1) //协程计数一
go
zyService
.
ZyGoodsDetail
(
ctx
,
zyGoodsId
,
ch
)
go
zyService
.
ZyGoodsDetail
(
ctx
,
zyGoodsId
,
ch
)
p
++
p
++
}
}
if
len
(
lyGoodsId
)
>
0
{
if
len
(
lyGoodsId
)
>
0
{
...
@@ -89,30 +89,29 @@ func Synchronization(ctx *gin.Context) {
...
@@ -89,30 +89,29 @@ func Synchronization(ctx *gin.Context) {
common
.
PrintDebugHtml
(
ctx
,
zyGoodsId
)
common
.
PrintDebugHtml
(
ctx
,
zyGoodsId
)
//wg.Add(1)
//wg.Add(1)
go
lyService
.
LyGoodsDetail
(
ctx
,
lyGoodsId
,
ch
)
go
lyService
.
LyGoodsDetail
(
ctx
,
lyGoodsId
,
ch
)
p
++
p
++
}
}
//wg.Wait()
//wg.Wait()
//异步map最后转成map
//异步map最后转成map
temp
:=
make
(
map
[
string
]
interface
{})
temp
:=
make
(
map
[
string
]
interface
{})
for
i
:=
0
i
<
p
i
++
{
for
i
:=
0
;
i
<
p
;
i
++
{
select
{
select
{
case
GoodsRes
:=
<-
ch
:
case
GoodsRes
:=
<-
ch
:
GoodsRes
.
Range
(
func
(
k
,
v
interface
{})
bool
{
GoodsRes
.
Range
(
func
(
k
,
v
interface
{})
bool
{
s
,
_
:=
k
.
(
string
)
s
,
_
:=
k
.
(
string
)
temp
[
s
]
=
v
temp
[
s
]
=
v
return
true
return
true
})
})
case
<-
time
.
After
(
time
.
Second
*
6
)
:
case
<-
time
.
After
(
time
.
Second
*
6
)
:
logger
.
Log
(
"协程超时"
,
"sku"
,
1
)
logger
.
Log
(
"协程超时"
,
"sku"
,
1
)
}
}
}
}
common
.
Output
(
ctx
,
0
,
"success"
,
temp
)
common
.
Output
(
ctx
,
0
,
"success"
,
temp
)
}
}
/*
/*
健康监测
健康监测
*/
*/
...
...
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