Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskcenter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
taskcenter
Commits
3f0370ec
Commit
3f0370ec
authored
Jan 13, 2025
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add task pass option
parent
6f3e597c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
21 deletions
+24
-21
taskcenter.go
model/db/taskcenter.go
+1
-0
task.go
sync/task.go
+23
-21
No files found.
model/db/taskcenter.go
View file @
3f0370ec
...
...
@@ -80,6 +80,7 @@ type Task struct {
Start
int
`gorm:"type:int;not null;comment:任务开始时间"`
End
int
`gorm:"type:int;index;not null;comment:任务结束时间"`
Daily
bool
`gorm:"type:bool;not null;comment:是否是每日任务"`
Pass
bool
`gorm:"type:bool;not null;comment:是否跳过检查"`
TwitterTaskEndAt
sql
.
NullTime
`gorm:"index;comment:推特可用,推特任务中心已停止"`
TelegramActiveThreshold
int
`gorm:"type:int;not null;comment:telegram群活跃阈值"`
Enable
bool
`gorm:"type:bool;not null;comment:是否启用"`
...
...
sync/task.go
View file @
3f0370ec
...
...
@@ -12,9 +12,7 @@ func (s *Sync) ProcessTasks() {
ticker
:=
time
.
NewTicker
(
time
.
Second
)
defer
ticker
.
Stop
()
log
.
Info
(
"start sync task"
)
for
{
select
{
case
<-
ticker
.
C
:
for
range
ticker
.
C
{
tasks
,
err
:=
s
.
d
.
GetUnprocessedTasks
()
if
err
!=
nil
{
log
.
WithError
(
err
)
.
Error
(
"get unprocessed tasks error"
)
...
...
@@ -37,7 +35,6 @@ func (s *Sync) ProcessTasks() {
}
}
}
}
}
...
...
@@ -51,6 +48,11 @@ func (s *Sync) SyncTask(taskId int, userId string) (ok bool, err error) {
return
}
if
task
.
Pass
{
log
.
WithFields
(
log
.
Fields
{
"task_id"
:
taskId
,
"user_id"
:
userId
})
.
Info
(
"task pass"
)
return
true
,
nil
}
switch
task
.
Platform
{
case
constant
.
TaskPlatformTelegram
:
telegramUserId
,
err
:=
s
.
d
.
GetProviderId
(
userId
,
constant
.
TaskPlatformTelegram
)
...
...
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