模板系统

This commit is contained in:
ryan
2026-06-08 19:13:44 +08:00
parent 3aff95d256
commit b96624a251
15 changed files with 2400 additions and 7 deletions
+459
View File
@@ -1346,6 +1346,367 @@ const docTemplate = `{
}
}
},
"/api/v1/admin/templates": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "返回所有通知模板列表,需要管理员权限",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "获取模板列表",
"responses": {
"200": {
"description": "模板列表",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Template"
}
}
}
}
]
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
},
"post": {
"security": [
{
"SessionCookie": []
}
],
"description": "创建一条新的自定义通知模板,模板标识符(Key)不可重复,需要管理员权限",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "创建模板",
"parameters": [
{
"description": "创建请求参数",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/template.CreateTemplateRequest"
}
}
],
"responses": {
"200": {
"description": "创建成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"type": "string"
}
}
}
]
}
},
"400": {
"description": "参数错误或模板标识符已存在",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
}
},
"/api/v1/admin/templates/{key}": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "根据模板标识符获取对应的模板详情,需要管理员权限",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "获取单个模板",
"parameters": [
{
"type": "string",
"description": "模板标识符",
"name": "key",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "模板详情",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Template"
}
}
}
]
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"404": {
"description": "模板不存在",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
},
"put": {
"security": [
{
"SessionCookie": []
}
],
"description": "根据模板标识符更新对应的模板内容,需要管理员权限",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "更新模板",
"parameters": [
{
"type": "string",
"description": "模板标识符",
"name": "key",
"in": "path",
"required": true
},
{
"description": "更新请求参数",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/template.UpdateTemplateRequest"
}
}
],
"responses": {
"200": {
"description": "更新成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Template"
}
}
}
]
}
},
"400": {
"description": "参数错误",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"404": {
"description": "模板不存在",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
},
"delete": {
"security": [
{
"SessionCookie": []
}
],
"description": "根据模板标识符删除对应模板,系统预置模板不可删除,需要管理员权限",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "删除模板",
"parameters": [
{
"type": "string",
"description": "模板标识符",
"name": "key",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "删除成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/util.ResponseAny"
},
{
"type": "object",
"properties": {
"data": {
"type": "string"
}
}
}
]
}
},
"400": {
"description": "不可删除系统模板",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"401": {
"description": "未登录",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"403": {
"description": "无管理员权限",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"404": {
"description": "模板不存在",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
},
"500": {
"description": "内部错误",
"schema": {
"$ref": "#/definitions/util.ResponseAny"
}
}
}
}
},
"/api/v1/admin/users": {
"get": {
"security": [
@@ -3205,6 +3566,41 @@ const docTemplate = `{
"TaskExecutionStatusFailed"
]
},
"model.Template": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"is_system": {
"type": "boolean"
},
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"subject": {
"type": "string"
},
"type": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"model.Upload": {
"type": "object",
"properties": {
@@ -3677,6 +4073,69 @@ const docTemplate = `{
}
}
},
"template.CreateTemplateRequest": {
"type": "object",
"required": [
"content",
"key",
"name",
"type"
],
"properties": {
"content": {
"type": "string"
},
"description": {
"type": "string",
"maxLength": 255
},
"key": {
"type": "string",
"maxLength": 80
},
"name": {
"type": "string",
"maxLength": 100
},
"subject": {
"type": "string",
"maxLength": 255
},
"type": {
"type": "string",
"maxLength": 20
}
}
},
"template.UpdateTemplateRequest": {
"type": "object",
"required": [
"content",
"name",
"type"
],
"properties": {
"content": {
"type": "string"
},
"description": {
"type": "string",
"maxLength": 255
},
"name": {
"type": "string",
"maxLength": 100
},
"subject": {
"type": "string",
"maxLength": 255
},
"type": {
"type": "string",
"maxLength": 20
}
}
},
"upload.batchDownloadRequest": {
"type": "object",
"required": [