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
f9b51644
authored
Oct 15, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1..0
parent
75a28d2b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
21 deletions
cmd/cron/cron_server.go
routes/router.go
service/service_zy.go
cmd/cron/cron_server.go
View file @
f9b51644
...
...
@@ -2,11 +2,9 @@ package main
import
(
"flag"
"fmt"
"go_sku_server/boot"
"go_sku_server/pkg/logger"
"go_sku_server/service"
"github.com/jasonlvhit/gocron"
)
//定时任务计算系数价格
...
...
@@ -25,21 +23,4 @@ func main() {
logger
.
Log
(
"启动任务"
,
"ratio"
,
1
)
ZyCronService
:=
service
.
ZyCronService
{}
ZyCronService
.
ZyDiscount
(
goods_id
)
if
goods_id
!=
""
{
//定时任务,每隔3天统计一次
err
:=
gocron
.
Every
(
3
)
.
Day
()
.
At
(
"1:20"
)
.
Do
(
ZyDiscount
,
goods_id
)
<-
gocron
.
Start
()
fmt
.
Print
(
"启动任务状态"
,
err
)
}
}
/*
任务执行
*/
func
ZyDiscount
(
goods_id
string
)
{
logger
.
Log
(
"定时执行任务"
,
"ratio"
,
1
)
ZyCronService
:=
service
.
ZyCronService
{}
ZyCronService
.
ZyDiscount
(
goods_id
)
}
\ No newline at end of file
routes/router.go
View file @
f9b51644
...
...
@@ -16,6 +16,9 @@ func InitRouter() *gin.Engine {
r
.
GET
(
"synchronization"
,
controller
.
Synchronization
)
r
.
POST
(
"synchronization"
,
controller
.
Synchronization
)
//联营参数选择搜索
r
.
GET
(
"Synchronization"
,
controller
.
Synchronization
)
r
.
POST
(
"Synchronization"
,
controller
.
Synchronization
)
//心跳
r
.
GET
(
"Health"
,
controller
.
Health
)
r
.
POST
(
"Health"
,
controller
.
Health
)
...
...
service/service_zy.go
View file @
f9b51644
...
...
@@ -32,7 +32,6 @@ type ZiyingService struct {
@param power[verify_blacklist] 是否验证黑名单,用于折扣活动提交订单页面与后台下单 :true
*/
func
(
qs
*
ZiyingService
)
ZyGoodsDetail
(
ctx
*
gin
.
Context
,
goodsIds
[]
string
,
goodsRes
*
sync
.
Map
,
wg
*
sync
.
WaitGroup
)
{
redisConn
:=
gredis
.
Conn
(
"search_r"
)
defer
func
()
{
wg
.
Done
();
...
...
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