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
6ef9be76
Commit
6ef9be76
authored
Jan 12, 2025
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update groupv2 api
parent
c81cd501
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
2 deletions
+25
-2
api.go
model/api/api.go
+1
-1
group.go
server/group.go
+22
-0
router.go
server/router.go
+1
-0
group.go
service/group.go
+1
-1
No files found.
model/api/api.go
View file @
6ef9be76
...
...
@@ -46,7 +46,7 @@ type CreateGroupRequest struct {
}
type
Task
struct
{
TaskId
int
`json:"taskId,omitempty"`
TaskId
int
erface
{}
`json:"taskId,omitempty"`
Platform
string
`json:"platform" binding:"required"`
Action
string
`json:"action" binding:"required"`
Url
string
`json:"url"`
...
...
server/group.go
View file @
6ef9be76
...
...
@@ -42,6 +42,28 @@ func getGroup(c *gin.Context) {
c
.
JSON
(
200
,
withSuccess
(
resp
))
}
func
getGroupV2
(
c
*
gin
.
Context
)
{
_gid
:=
c
.
Param
(
"gid"
)
gid
,
_
:=
strconv
.
Atoi
(
_gid
)
if
gid
==
0
{
c
.
JSON
(
200
,
withError
(
constant
.
InvalidParam
))
return
}
userId
:=
c
.
GetString
(
"userId"
)
admin
:=
c
.
GetBool
(
"admin"
)
resp
,
err
:=
srv
.
GetGroup
(
gid
,
userId
,
admin
)
if
err
!=
nil
{
c
.
JSON
(
200
,
withError
(
constant
.
InternalError
))
return
}
for
i
:=
0
;
i
<
len
(
resp
.
Tasks
);
i
++
{
resp
.
Tasks
[
i
]
.
TaskId
=
strconv
.
Itoa
(
resp
.
Tasks
[
i
]
.
TaskId
.
(
int
))
}
c
.
JSON
(
200
,
withSuccess
(
resp
))
}
func
listGroup
(
c
*
gin
.
Context
)
{
_page
:=
c
.
DefaultQuery
(
"page"
,
"1"
)
_pageSize
:=
c
.
DefaultQuery
(
"pageSize"
,
"10"
)
...
...
server/router.go
View file @
6ef9be76
...
...
@@ -14,6 +14,7 @@ func initRouter(e *gin.Engine) {
{
group
:=
v1
.
Group
(
"/group"
)
group
.
GET
(
"/:gid"
,
middleware
.
JWTMiddleware
(
d
,
conf
.
Supabase
.
JWTSecret
,
false
),
getGroup
)
// 获取任务组任务详情
group
.
GET
(
"/v2/:gid"
,
middleware
.
JWTMiddleware
(
d
,
conf
.
Supabase
.
JWTSecret
,
false
),
getGroupV2
)
// 获取任务组任务详情,taskId 修改为string返回
group
.
GET
(
"/list"
,
middleware
.
JWTMiddleware
(
d
,
conf
.
Supabase
.
JWTSecret
,
true
),
listGroup
)
// 获取任务组任务详情
group
.
POST
(
"/create"
,
middleware
.
JWTMiddleware
(
d
,
conf
.
Supabase
.
JWTSecret
,
true
),
createGroup
)
// 创建任务组
}
...
...
service/group.go
View file @
6ef9be76
...
...
@@ -74,7 +74,7 @@ func (s *Service) GetGroup(gid int, userId string, admin bool) (resp *apiModel.G
Enable
:
task
.
Enable
,
}
status
,
err
:=
s
.
GetTaskResult
(
_task
.
TaskId
,
userId
)
status
,
err
:=
s
.
GetTaskResult
(
_task
.
TaskId
.
(
int
)
,
userId
)
if
err
!=
nil
{
log
.
WithError
(
err
)
.
Error
(
"group check task"
)
return
nil
,
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