增加社区列表接口,任务相关接口修改

This commit is contained in:
lianghuanjie
2024-12-19 21:14:14 +08:00
parent 391a9d3481
commit a3c4adfa25
32 changed files with 1163 additions and 197 deletions

View File

@@ -8,6 +8,10 @@ service novatask {
@doc "获取任务列表"
@handler GetTaskList
get /tasks (GetTaskListReq) returns (GetTaskListResp)
@doc "获取社区列表"
@handler GetCommunityList
get /community returns (GetCommunityListResp)
}
@server (
@@ -18,7 +22,7 @@ service novatask {
service novatask {
@doc "校验任务结果"
@handler VerifyTaskResult
get /task/:id (TaskIdPath) returns (VerifyTaskResultResp)
get /task (VerifyTaskResultReq) returns (VerifyTaskResultResp)
@doc "领取任务奖励"
@handler GetTaskReward
@@ -30,25 +34,33 @@ type GetTaskListReq {
}
type Task {
Id uint `json:"id"` // 任务ID
CommunityId uint `json:"community_id"` // 所属社区ID
Title string `json:"title"` // 任务标题
SubTitle string `json:"sub_title"` // 副标题
Description string `json:"description"` // 任务描述
Points int `json:"points"` // 任务积分
ButtonText string `json:"button_text"` // 按钮文字
Type int8 `json:"type"` // 任务类型: 0=follow_twitter,1=bind_twitter,2=cast_twitter,3=publish_twitter,4=repost_twitter,5=watch_youtube,6=follow_youtube,7=bind_discord,8=join_telegram,9=daily_pay
Url string `json:"url"` // 跳转链接
Status int8 `json:"status"` // 任务状态: 0=不启用1=启用
StartAt string `json:"start_at"` // 开始时间
EndAt string `json:"end_at"` // 结束时间
FinishState int8 `json:"finish_state"` // 0:未完成 1:待校验 2:已完成未领取 3:已领取
Id uint `json:"id"` // 任务ID
CommunityId uint `json:"community_id"` // 所属社区ID
Title string `json:"title"` // 任务标题
SubTitle string `json:"sub_title"` // 副标题
Description string `json:"description"` // 任务描述
Points int `json:"points"` // 任务积分
ButtonText string `json:"button_text"` // 按钮文字
Params string `json:"params"` // 参数
Type int8 `json:"type"` // 任务类型: 0=follow_twitter,1=bind_twitter,2=cast_twitter,3=publish_twitter,4=repost_twitter,5=watch_youtube,6=follow_youtube,7=bind_discord,8=join_telegram,9=daily_pay,10=invite_user
Url string `json:"url"` // 跳转链接
Sort int `json:"sort"` // 排序
StartAt string `json:"start_at"` // 开始时间
EndAt string `json:"end_at"` // 结束时间
HasFinishCount int `json:"has_finish_count"` // 当前完成进度
TotalCount int `json:"total_count"` // 总进度
FinishState int8 `json:"finish_state"` // 0:未完成 1:待校验 2:已完成未领取 3:已领取
}
type GetTaskListResp {
Tasks []Task `json:"tasks"`
}
type VerifyTaskResultReq {
ID uint `form:"id"` // 任务ID
Params string `form:"params,optional"` // 额外的参数
}
type TaskIdPath {
ID uint `path:"id"` // 任务ID
}
@@ -61,3 +73,16 @@ type GetTaskRewardResp {
Points int `json:"points"` // 积分
}
type Community {
Id uint `json:"id"` // 社区ID
Title string `json:"title"` // 社区标题
Logo string `json:"logo"` // 社区图标
Description string `json:"description"` // 社区描述
StartAt int64 `json:"start_at"` // 开始时间
EndAt int64 `json:"end_at"` // 结束时间
}
type GetCommunityListResp {
CommunityList []Community `json:"community_list"` // 社区列表
}

View File

@@ -15,6 +15,23 @@
"application/json"
],
"paths": {
"/gapi/task/v1/community": {
"get": {
"summary": "获取社区列表",
"operationId": "GetCommunityList",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/GetCommunityListResp"
}
}
},
"tags": [
"task"
]
}
},
"/gapi/task/v1/reward/{id}": {
"get": {
"summary": "领取任务奖励",
@@ -45,7 +62,7 @@
]
}
},
"/gapi/task/v1/task/{id}": {
"/gapi/task/v1/task": {
"get": {
"summary": "校验任务结果",
"operationId": "VerifyTaskResult",
@@ -60,14 +77,26 @@
"parameters": [
{
"name": "id",
"in": "path",
"description": " 任务ID",
"in": "query",
"required": true,
"type": "integer",
"format": "uint32"
},
{
"name": "params",
"description": " 额外的参数",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"task"
],
"consumes": [
"multipart/form-data"
],
"security": [
{
"apiKey": []
@@ -107,6 +136,63 @@
}
},
"definitions": {
"Community": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "uint32",
"description": " 社区ID"
},
"title": {
"type": "string",
"description": " 社区标题"
},
"logo": {
"type": "string",
"description": " 社区图标"
},
"description": {
"type": "string",
"description": " 社区描述"
},
"start_at": {
"type": "integer",
"format": "int64",
"description": " 开始时间"
},
"end_at": {
"type": "integer",
"format": "int64",
"description": " 结束时间"
}
},
"title": "Community",
"required": [
"id",
"title",
"logo",
"description",
"start_at",
"end_at"
]
},
"GetCommunityListResp": {
"type": "object",
"properties": {
"community_list": {
"type": "array",
"items": {
"$ref": "#/definitions/Community"
},
"description": " 社区列表"
}
},
"title": "GetCommunityListResp",
"required": [
"community_list"
]
},
"GetTaskListReq": {
"type": "object",
"properties": {
@@ -181,19 +267,23 @@
"type": "string",
"description": " 按钮文字"
},
"params": {
"type": "string",
"description": " 参数"
},
"type": {
"type": "integer",
"format": "int8",
"description": " 任务类型: 0=follow_twitter,1=bind_twitter,2=cast_twitter,3=publish_twitter,4=repost_twitter,5=watch_youtube,6=follow_youtube,7=bind_discord,8=join_telegram,9=daily_pay"
"description": " 任务类型: 0=follow_twitter,1=bind_twitter,2=cast_twitter,3=publish_twitter,4=repost_twitter,5=watch_youtube,6=follow_youtube,7=bind_discord,8=join_telegram,9=daily_pay,10=invite_user"
},
"url": {
"type": "string",
"description": " 跳转链接"
},
"status": {
"sort": {
"type": "integer",
"format": "int8",
"description": " 任务状态: 0=不启用1=启用"
"format": "int32",
"description": " 排序"
},
"start_at": {
"type": "string",
@@ -203,6 +293,16 @@
"type": "string",
"description": " 结束时间"
},
"has_finish_count": {
"type": "integer",
"format": "int32",
"description": " 当前完成进度"
},
"total_count": {
"type": "integer",
"format": "int32",
"description": " 总进度"
},
"finish_state": {
"type": "integer",
"format": "int8",
@@ -218,11 +318,14 @@
"description",
"points",
"button_text",
"params",
"type",
"url",
"status",
"sort",
"start_at",
"end_at",
"has_finish_count",
"total_count",
"finish_state"
]
},
@@ -230,6 +333,24 @@
"type": "object",
"title": "TaskIdPath"
},
"VerifyTaskResultReq": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "uint32",
"description": " 任务ID"
},
"params": {
"type": "string",
"description": " 额外的参数"
}
},
"title": "VerifyTaskResultReq",
"required": [
"id"
]
},
"VerifyTaskResultResp": {
"type": "object",
"properties": {