i18n: Translate all Chinese to English across the codebase

Translate Chinese comments, log/error messages, validator labels and
Swagger annotations to English throughout the source code, generated
Swagger docs, config files and CI workflows.

Make the English README primary: README.md now holds the English docs
and README_EN.md holds the Chinese version, with cross-language links
updated accordingly.

Note: the generated docs/ swagger files were translated in place; run
`go generate ./...` (swag init) to regenerate them from the now-English
annotations when a Go toolchain is available.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-27 12:17:04 +02:00
co-authored by Claude Opus 4.8
parent c5687e1506
commit 16e97c8efa
103 changed files with 3088 additions and 3086 deletions
+39 -39
View File
@@ -15,10 +15,10 @@ import (
type AddressBook struct {
}
// Detail 地址簿
// @Tags 地址簿
// @Summary 地址簿详情
// @Description 地址簿详情
// Detail address book
// @Tags address book
// @Summary address book details
// @Description address book details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -38,13 +38,13 @@ func (ct *AddressBook) Detail(c *gin.Context) {
return
}
// Create 创建地址簿
// @Tags 地址簿
// @Summary 创建地址簿
// @Description 创建地址簿
// Create create address book
// @Tags address book
// @Summary create address book
// @Description create address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response{data=model.AddressBook}
// @Failure 500 {object} response.Response
// @Router /admin/address_book/create [post]
@@ -84,13 +84,13 @@ func (ct *AddressBook) Create(c *gin.Context) {
response.Success(c, nil)
}
// BatchCreate 批量创建地址簿
// @Tags 地址簿
// @Summary 批量创建地址簿
// @Description 批量创建地址簿
// BatchCreate batch create address books
// @Tags address book
// @Summary batch create address books
// @Description batch create address books
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response{data=model.AddressBook}
// @Failure 500 {object} response.Response
// @Router /admin/address_book/batchCreate [post]
@@ -113,13 +113,13 @@ func (ct *AddressBook) BatchCreate(c *gin.Context) {
return
}
if ul > 1 {
//多用户置空标签
//clear tags in multi-user mode
f.Tags = []string{}
//多用户只能创建到默认地址簿
//in multi-user mode, can only create in the default address book
f.CollectionId = 0
}
//创建标签
//create tag
/*for _, fu := range f.UserIds {
if fu == 0 {
continue
@@ -148,16 +148,16 @@ func (ct *AddressBook) BatchCreate(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 地址簿
// @Summary 地址簿列表
// @Description 地址簿列表
// List list
// @Tags address book
// @Summary address book list
// @Description address book list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param user_id query int false "用户id"
// @Param is_my query int false "是否是我的"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param user_id query int false "userid"
// @Param is_my query int false "whether it is mine"
// @Success 200 {object} response.Response{data=model.AddressBookList}
// @Failure 500 {object} response.Response
// @Router /admin/address_book/list [get]
@@ -196,13 +196,13 @@ func (ct *AddressBook) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 地址簿
// @Summary 地址簿编辑
// @Description 地址簿编辑
// Update edit
// @Tags address book
// @Summary edit address book
// @Description edit address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response{data=model.AddressBook}
// @Failure 500 {object} response.Response
// @Router /admin/address_book/update [post]
@@ -240,13 +240,13 @@ func (ct *AddressBook) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 地址簿
// @Summary 地址簿删除
// @Description 地址簿删除
// Delete delete
// @Tags address book
// @Summary delete address book
// @Description delete address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/address_book/delete [post]
@@ -277,12 +277,12 @@ func (ct *AddressBook) Delete(c *gin.Context) {
}
// ShareByWebClient
// @Tags 地址簿
// @Summary 地址簿分享
// @Description 地址簿分享
// @Tags address book
// @Summary share address book
// @Description share address book
// @Accept json
// @Produce json
// @Param body body admin.ShareByWebClientForm true "地址簿信息"
// @Param body body admin.ShareByWebClientForm true "address book info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/address_book/share [post]
+27 -27
View File
@@ -14,10 +14,10 @@ import (
type AddressBookCollection struct {
}
// Detail 地址簿名称
// @Tags 地址簿名称
// @Summary 地址簿名称详情
// @Description 地址簿名称详情
// Detail address book name
// @Tags address book name
// @Summary address book name details
// @Description address book name details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -37,13 +37,13 @@ func (abc *AddressBookCollection) Detail(c *gin.Context) {
return
}
// Create 创建地址簿名称
// @Tags 地址簿名称
// @Summary 创建地址簿名称
// @Description 创建地址簿名称
// Create create address book name
// @Tags address book name
// @Summary create address book name
// @Description create address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/address_book_collection/create [post]
@@ -72,16 +72,16 @@ func (abc *AddressBookCollection) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 地址簿名称
// @Summary 地址簿名称列表
// @Description 地址簿名称列表
// List list
// @Tags address book name
// @Summary address book name list
// @Description address book name list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param is_my query int false "是否是我的"
// @Param user_id query int false "用户id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param is_my query int false "whether it is mine"
// @Param user_id query int false "userid"
// @Success 200 {object} response.Response{data=model.AddressBookCollectionList}
// @Failure 500 {object} response.Response
// @Router /admin/address_book_collection/list [get]
@@ -100,13 +100,13 @@ func (abc *AddressBookCollection) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 地址簿名称
// @Summary 地址簿名称编辑
// @Description 地址簿名称编辑
// Update edit
// @Tags address book name
// @Summary edit address book name
// @Description edit address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/address_book_collection/update [post]
@@ -135,13 +135,13 @@ func (abc *AddressBookCollection) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 地址簿名称
// @Summary 地址簿名称删除
// @Description 地址簿名称删除
// Delete delete
// @Tags address book name
// @Summary delete address book name
// @Description delete address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/address_book_collection/delete [post]
@@ -14,17 +14,17 @@ import (
type AddressBookCollectionRule struct {
}
// List 列表
// @Tags 地址簿规则
// @Summary 地址簿规则列表
// @Description 地址簿规则列表
// List list
// @Tags address book rules
// @Summary address book rule list
// @Description address book rule list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param is_my query int false "是否是我的"
// @Param user_id query int false "用户id"
// @Param collection_id query int false "地址簿集合id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param is_my query int false "whether it is mine"
// @Param user_id query int false "userid"
// @Param collection_id query int false "address book collectionid"
// @Success 200 {object} response.Response{data=model.AddressBookCollectionList}
// @Failure 500 {object} response.Response
// @Router /admin/address_book_collection_rule/list [get]
@@ -47,10 +47,10 @@ func (abcr *AddressBookCollectionRule) List(c *gin.Context) {
response.Success(c, res)
}
// Detail 地址簿规则
// @Tags 地址簿规则
// @Summary 地址簿规则详情
// @Description 地址簿规则详情
// Detail address book rules
// @Tags address book rules
// @Summary address book rule details
// @Description address book rule details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -69,13 +69,13 @@ func (abcr *AddressBookCollectionRule) Detail(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
}
// Create 创建地址簿规则
// @Tags 地址簿规则
// @Summary 创建地址簿规则
// @Description 创建地址簿规则
// Create create address book rule
// @Tags address book rules
// @Summary create address book rule
// @Description create address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/address_book_collection_rule/create [post]
@@ -134,7 +134,7 @@ func (abcr *AddressBookCollectionRule) CheckForm(t *model.AddressBookCollectionR
} else {
return "ParamsError", false
}
// 重复检查
// duplicate check
ex := service.AllService.AddressBookService.RuleInfoByToIdAndCid(t.Type, t.ToId, t.CollectionId)
if t.Id == 0 && ex.Id > 0 {
return "ItemExists", false
@@ -145,13 +145,13 @@ func (abcr *AddressBookCollectionRule) CheckForm(t *model.AddressBookCollectionR
return "", true
}
// Update 编辑
// @Tags 地址簿规则
// @Summary 地址簿规则编辑
// @Description 地址簿规则编辑
// Update edit
// @Tags address book rules
// @Summary edit address book rule
// @Description edit address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/address_book_collection_rule/update [post]
@@ -185,13 +185,13 @@ func (abcr *AddressBookCollectionRule) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 地址簿规则
// @Summary 地址簿规则删除
// @Description 地址簿规则删除
// Delete delete
// @Tags address book rules
// @Summary delete address book rule
// @Description delete address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/address_book_collection_rule/delete [post]
+36 -36
View File
@@ -13,16 +13,16 @@ import (
type Audit struct {
}
// ConnList 列表
// @Tags 链接日志
// @Summary 链接日志列表
// @Description 链接日志列表
// ConnList list
// @Tags connection log
// @Summary connection log list
// @Description connection log list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param peer_id query int false "目标设备"
// @Param from_peer query int false "来源设备"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param peer_id query int false "target device"
// @Param from_peer query int false "source device"
// @Success 200 {object} response.Response{data=model.AuditConnList}
// @Failure 500 {object} response.Response
// @Router /admin/audit_conn/list [get]
@@ -45,13 +45,13 @@ func (a *Audit) ConnList(c *gin.Context) {
response.Success(c, res)
}
// ConnDelete 删除
// @Tags 链接日志
// @Summary 链接日志删除
// @Description 链接日志删除
// ConnDelete delete
// @Tags connection log
// @Summary delete connection log
// @Description delete connection log
// @Accept json
// @Produce json
// @Param body body model.AuditConn true "链接日志信息"
// @Param body body model.AuditConn true "connection log info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/audit_conn/delete [post]
@@ -81,13 +81,13 @@ func (a *Audit) ConnDelete(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
}
// BatchConnDelete 删除
// @Tags 链接日志
// @Summary 链接日志批量删除
// @Description 链接日志批量删除
// BatchConnDelete delete
// @Tags connection log
// @Summary batch delete connection logs
// @Description batch delete connection logs
// @Accept json
// @Produce json
// @Param body body admin.AuditConnLogIds true "链接日志"
// @Param body body admin.AuditConnLogIds true "connection log"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/audit_conn/batchDelete [post]
@@ -112,16 +112,16 @@ func (a *Audit) BatchConnDelete(c *gin.Context) {
return
}
// FileList 列表
// @Tags 文件日志
// @Summary 文件日志列表
// @Description 文件日志列表
// FileList list
// @Tags file log
// @Summary file log list
// @Description file log list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param peer_id query int false "目标设备"
// @Param from_peer query int false "来源设备"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param peer_id query int false "target device"
// @Param from_peer query int false "source device"
// @Success 200 {object} response.Response{data=model.AuditFileList}
// @Failure 500 {object} response.Response
// @Router /admin/audit_file/list [get]
@@ -144,13 +144,13 @@ func (a *Audit) FileList(c *gin.Context) {
response.Success(c, res)
}
// FileDelete 删除
// @Tags 文件日志
// @Summary 文件日志删除
// @Description 文件日志删除
// FileDelete delete
// @Tags file log
// @Summary delete file log
// @Description delete file log
// @Accept json
// @Produce json
// @Param body body model.AuditFile true "文件日志信息"
// @Param body body model.AuditFile true "file log info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/audit_file/delete [post]
@@ -180,13 +180,13 @@ func (a *Audit) FileDelete(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
}
// BatchFileDelete 删除
// @Tags 文件日志
// @Summary 文件日志批量删除
// @Description 文件日志批量删除
// BatchFileDelete delete
// @Tags file log
// @Summary batch delete file logs
// @Description batch delete file logs
// @Accept json
// @Produce json
// @Param body body admin.AuditFileLogIds true "文件日志"
// @Param body body admin.AuditFileLogIds true "file log"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/audit_file/batchDelete [post]
+9 -9
View File
@@ -13,10 +13,10 @@ import (
type Config struct {
}
// ServerConfig RUSTDESK服务配置
// ServerConfig RUSTDESKservice config
// @Tags ADMIN
// @Summary RUSTDESK服务配置
// @Description 服务配置,给webclient提供api-server
// @Summary RUSTDESKservice config
// @Description service config, provides an api-server for the webclient
// @Accept json
// @Produce json
// @Success 200 {object} response.Response
@@ -33,10 +33,10 @@ func (co *Config) ServerConfig(c *gin.Context) {
response.Success(c, cf)
}
// AppConfig APP服务配置
// AppConfig APPservice config
// @Tags ADMIN
// @Summary APP服务配置
// @Description APP服务配置
// @Summary APPservice config
// @Description APPservice config
// @Accept json
// @Produce json
// @Success 200 {object} response.Response
@@ -49,10 +49,10 @@ func (co *Config) AppConfig(c *gin.Context) {
})
}
// AdminConfig ADMIN服务配置
// AdminConfig ADMINservice config
// @Tags ADMIN
// @Summary ADMIN服务配置
// @Description ADMIN服务配置
// @Summary ADMINservice config
// @Description ADMINservice config
// @Accept json
// @Produce json
// @Success 200 {object} response.Response
+25 -25
View File
@@ -12,10 +12,10 @@ import (
type DeviceGroup struct {
}
// Detail 设备群组
// @Tags 设备群组
// @Summary 设备群组详情
// @Description 设备群组详情
// Detail device group
// @Tags device group
// @Summary device group details
// @Description device group details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -35,13 +35,13 @@ func (ct *DeviceGroup) Detail(c *gin.Context) {
return
}
// Create 创建设备群组
// @Tags 设备群组
// @Summary 创建设备群组
// @Description 创建设备群组
// Create create device group
// @Tags device group
// @Summary create device group
// @Description create device group
// @Accept json
// @Produce json
// @Param body body admin.DeviceGroupForm true "设备群组信息"
// @Param body body admin.DeviceGroupForm true "device group info"
// @Success 200 {object} response.Response{data=model.DeviceGroup}
// @Failure 500 {object} response.Response
// @Router /admin/device_group/create [post]
@@ -66,14 +66,14 @@ func (ct *DeviceGroup) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 群组
// @Summary 群组列表
// @Description 群组列表
// List list
// @Tags group
// @Summary group list
// @Description group list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Success 200 {object} response.Response{data=model.GroupList}
// @Failure 500 {object} response.Response
// @Router /admin/device_group/list [get]
@@ -88,13 +88,13 @@ func (ct *DeviceGroup) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 设备群组
// @Summary 设备群组编辑
// @Description 设备群组编辑
// Update edit
// @Tags device group
// @Summary edit device group
// @Description edit device group
// @Accept json
// @Produce json
// @Param body body admin.DeviceGroupForm true "群组信息"
// @Param body body admin.DeviceGroupForm true "group info"
// @Success 200 {object} response.Response{data=model.Group}
// @Failure 500 {object} response.Response
// @Router /admin/device_group/update [post]
@@ -123,13 +123,13 @@ func (ct *DeviceGroup) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 设备群组
// @Summary 设备群组删除
// @Description 设备群组删除
// Delete delete
// @Tags device group
// @Summary delete device group
// @Description delete device group
// @Accept json
// @Produce json
// @Param body body admin.DeviceGroupForm true "群组信息"
// @Param body body admin.DeviceGroupForm true "group info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/device_group/delete [post]
+12 -12
View File
@@ -13,10 +13,10 @@ import (
type File struct {
}
// OssToken 文件
// @Tags 文件
// @Summary 获取ossToken
// @Description 获取ossToken
// OssToken file
// @Tags file
// @Summary getossToken
// @Description getossToken
// @Accept json
// @Produce json
// @Success 200 {object} response.Response
@@ -33,7 +33,7 @@ type FileBack struct {
Url string `json:"url"`
}
// Notify 上传成功后回调
// Notify callback after successful upload
func (f *File) Notify(c *gin.Context) {
res := global.Oss.Verify(c.Request)
@@ -50,13 +50,13 @@ func (f *File) Notify(c *gin.Context) {
}
// Upload 上传文件到本地
// @Tags 文件
// @Summary 上传文件到本地
// @Description 上传文件到本地
// Upload upload file to local
// @Tags file
// @Summary upload file to local
// @Description upload file to local
// @Accept multipart/form-data
// @Produce json
// @Param file formData file true "上传文件示例"
// @Param file formData file true "file upload example"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/file/upload [post]
@@ -71,12 +71,12 @@ func (f *File) Upload(c *gin.Context) {
if err != nil {
return
}
// 上传文件至指定目录
// upload the file to the specified directory
err = c.SaveUploadedFile(file, dst)
if err != nil {
return
}
// 返回文件web地址
// return filewebaddress
response.Success(c, gin.H{
"url": webPath + file.Filename,
})
+25 -25
View File
@@ -12,10 +12,10 @@ import (
type Group struct {
}
// Detail 群组
// @Tags 群组
// @Summary 群组详情
// @Description 群组详情
// Detail group
// @Tags group
// @Summary group details
// @Description group details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -35,13 +35,13 @@ func (ct *Group) Detail(c *gin.Context) {
return
}
// Create 创建群组
// @Tags 群组
// @Summary 创建群组
// @Description 创建群组
// Create create group
// @Tags group
// @Summary create group
// @Description create group
// @Accept json
// @Produce json
// @Param body body admin.GroupForm true "群组信息"
// @Param body body admin.GroupForm true "group info"
// @Success 200 {object} response.Response{data=model.Group}
// @Failure 500 {object} response.Response
// @Router /admin/group/create [post]
@@ -66,14 +66,14 @@ func (ct *Group) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 群组
// @Summary 群组列表
// @Description 群组列表
// List list
// @Tags group
// @Summary group list
// @Description group list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Success 200 {object} response.Response{data=model.GroupList}
// @Failure 500 {object} response.Response
// @Router /admin/group/list [get]
@@ -88,13 +88,13 @@ func (ct *Group) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 群组
// @Summary 群组编辑
// @Description 群组编辑
// Update edit
// @Tags group
// @Summary edit group
// @Description edit group
// @Accept json
// @Produce json
// @Param body body admin.GroupForm true "群组信息"
// @Param body body admin.GroupForm true "group info"
// @Success 200 {object} response.Response{data=model.Group}
// @Failure 500 {object} response.Response
// @Router /admin/group/update [post]
@@ -123,13 +123,13 @@ func (ct *Group) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 群组
// @Summary 群组删除
// @Description 群组删除
// Delete delete
// @Tags group
// @Summary delete group
// @Description delete group
// @Accept json
// @Produce json
// @Param body body admin.GroupForm true "群组信息"
// @Param body body admin.GroupForm true "group info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/group/delete [post]
+15 -15
View File
@@ -17,13 +17,13 @@ import (
type Login struct {
}
// Login 登录
// @Tags 登录
// @Summary 登录
// @Description 登录
// Login login
// @Tags login
// @Summary login
// @Description login
// @Accept json
// @Produce json
// @Param body body admin.Login true "登录信息"
// @Param body body admin.Login true "login info"
// @Success 200 {object} response.Response{data=adResp.LoginPayload}
// @Failure 500 {object} response.Response
// @Router /admin/login [post]
@@ -34,7 +34,7 @@ func (ct *Login) Login(c *gin.Context) {
return
}
// 检查登录限制
// check login limit
loginLimiter := global.LoginLimiter
clientIp := c.ClientIP()
_, needCaptcha := loginLimiter.CheckSecurityStatus(clientIp)
@@ -56,7 +56,7 @@ func (ct *Login) Login(c *gin.Context) {
return
}
// 检查是否需要验证码
// check whether a captcha is required
if needCaptcha {
if f.CaptchaId == "" || f.Captcha == "" || !loginLimiter.VerifyCaptcha(f.CaptchaId, f.Captcha) {
response.Fail(c, 101, response.TranslateMsg(c, "CaptchaError"))
@@ -95,7 +95,7 @@ func (ct *Login) Login(c *gin.Context) {
Platform: f.Platform,
})
// 登录成功,清除登录限制
// login successful, clear the login limit
loginLimiter.RemoveAttempts(clientIp)
responseLoginSuccess(c, u, ut.Token)
}
@@ -129,10 +129,10 @@ func (ct *Login) Captcha(c *gin.Context) {
})
}
// Logout 登出
// @Tags 登录
// @Summary 登出
// @Description 登出
// Logout logout
// @Tags login
// @Summary logout
// @Description logout
// @Accept json
// @Produce json
// @Success 200 {object} response.Response
@@ -148,9 +148,9 @@ func (ct *Login) Logout(c *gin.Context) {
}
// LoginOptions
// @Tags 登录
// @Summary 登录选项
// @Description 登录选项
// @Tags login
// @Summary login options
// @Description login options
// @Accept json
// @Produce json
// @Success 200 {object} []string
+21 -21
View File
@@ -14,10 +14,10 @@ import (
type LoginLog struct {
}
// Detail 登录日志
// @Tags 登录日志
// @Summary 登录日志详情
// @Description 登录日志详情
// Detail login log
// @Tags login log
// @Summary login log details
// @Description login log details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -37,15 +37,15 @@ func (ct *LoginLog) Detail(c *gin.Context) {
return
}
// List 列表
// @Tags 登录日志
// @Summary 登录日志列表
// @Description 登录日志列表
// List list
// @Tags login log
// @Summary login log list
// @Description login log list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param user_id query int false "用户ID"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param user_id query int false "userID"
// @Success 200 {object} response.Response{data=model.LoginLogList}
// @Failure 500 {object} response.Response
// @Router /admin/login_log/list [get]
@@ -65,13 +65,13 @@ func (ct *LoginLog) List(c *gin.Context) {
response.Success(c, res)
}
// Delete 删除
// @Tags 登录日志
// @Summary 登录日志删除
// @Description 登录日志删除
// Delete delete
// @Tags login log
// @Summary delete login log
// @Description delete login log
// @Accept json
// @Produce json
// @Param body body model.LoginLog true "登录日志信息"
// @Param body body model.LoginLog true "login log info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/login_log/delete [post]
@@ -101,13 +101,13 @@ func (ct *LoginLog) Delete(c *gin.Context) {
response.Fail(c, 101, err.Error())
}
// BatchDelete 删除
// @Tags 登录日志
// @Summary 登录日志批量删除
// @Description 登录日志批量删除
// BatchDelete delete
// @Tags login log
// @Summary batch delete login logs
// @Description batch delete login logs
// @Accept json
// @Produce json
// @Param body body admin.LoginLogIds true "登录日志"
// @Param body body admin.LoginLogIds true "login log"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/login_log/batchDelete [post]
+23 -23
View File
@@ -12,15 +12,15 @@ import (
type AddressBook struct{}
// List 列表
// @Tags 我的地址簿
// @Summary 地址簿列表
// @Description 地址簿列表
// List list
// @Tags my address book
// @Summary address book list
// @Description address book list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param user_id query int false "用户id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param user_id query int false "userid"
// @Success 200 {object} response.Response{data=model.AddressBookList}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book/list [get]
@@ -34,7 +34,7 @@ func (ct *AddressBook) List(c *gin.Context) {
u := service.AllService.UserService.CurUser(c)
query.UserId = int(u.Id)
res := service.AllService.AddressBookService.List(query.Page, query.PageSize, func(tx *gorm.DB) {
//预加载地址簿名称
//preload address book name
tx.Preload("Collection", func(txc *gorm.DB) *gorm.DB {
return txc.Select("id,name")
})
@@ -60,13 +60,13 @@ func (ct *AddressBook) List(c *gin.Context) {
response.Success(c, res)
}
// Create 创建地址簿
// @Tags 我的地址簿
// @Summary 创建地址簿
// @Description 创建地址簿
// Create create address book
// @Tags my address book
// @Summary create address book
// @Description create address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response{data=model.AddressBook}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book/create [post]
@@ -104,13 +104,13 @@ func (ct *AddressBook) Create(c *gin.Context) {
response.Success(c, nil)
}
// Update 编辑
// @Tags 我的地址簿
// @Summary 地址簿编辑
// @Description 地址簿编辑
// Update edit
// @Tags my address book
// @Summary edit address book
// @Description edit address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response{data=model.AddressBook}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book/update [post]
@@ -158,13 +158,13 @@ func (ct *AddressBook) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 我的地址簿
// @Summary 地址簿删除
// @Description 地址簿删除
// Delete delete
// @Tags my address book
// @Summary delete address book
// @Description delete address book
// @Accept json
// @Produce json
// @Param body body admin.AddressBookForm true "地址簿信息"
// @Param body body admin.AddressBookForm true "address book info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book/delete [post]
@@ -13,13 +13,13 @@ import (
type AddressBookCollection struct {
}
// Create 创建地址簿名称
// @Tags 我的地址簿名称
// @Summary 创建地址簿名称
// @Description 创建地址簿名称
// Create create address book name
// @Tags my address book name
// @Summary create address book name
// @Description create address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection/create [post]
@@ -45,14 +45,14 @@ func (abc *AddressBookCollection) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 我的地址簿名称
// @Summary 地址簿名称列表
// @Description 地址簿名称列表
// List list
// @Tags my address book name
// @Summary address book name list
// @Description address book name list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Success 200 {object} response.Response{data=model.AddressBookCollectionList}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection/list [get]
@@ -71,13 +71,13 @@ func (abc *AddressBookCollection) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 我的地址簿名称
// @Summary 地址簿名称编辑
// @Description 地址簿名称编辑
// Update edit
// @Tags my address book name
// @Summary edit address book name
// @Description edit address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection/update [post]
@@ -120,13 +120,13 @@ func (abc *AddressBookCollection) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 我的地址簿名称
// @Summary 地址簿名称删除
// @Description 地址簿名称删除
// Delete delete
// @Tags my address book name
// @Summary delete address book name
// @Description delete address book name
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollection true "地址簿名称信息"
// @Param body body model.AddressBookCollection true "address book name info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection/delete [post]
@@ -13,17 +13,17 @@ import (
type AddressBookCollectionRule struct {
}
// List 列表
// @Tags 我的地址簿规则
// @Summary 地址簿规则列表
// @Description 地址簿规则列表
// List list
// @Tags my address book rules
// @Summary address book rule list
// @Description address book rule list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param is_my query int false "是否是我的"
// @Param user_id query int false "用户id"
// @Param collection_id query int false "地址簿集合id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param is_my query int false "whether it is mine"
// @Param user_id query int false "userid"
// @Param collection_id query int false "address book collectionid"
// @Success 200 {object} response.Response{data=model.AddressBookCollectionList}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection_rule/list [get]
@@ -46,13 +46,13 @@ func (abcr *AddressBookCollectionRule) List(c *gin.Context) {
response.Success(c, res)
}
// Create 创建地址簿规则
// @Tags 我的地址簿规则
// @Summary 创建地址簿规则
// @Description 创建地址簿规则
// Create create address book rule
// @Tags my address book rules
// @Summary create address book rule
// @Description create address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection_rule/create [post]
@@ -106,12 +106,12 @@ func (abcr *AddressBookCollectionRule) CheckForm(u *model.User, t *model.Address
if tou.Id == 0 {
return "ItemNotFound", false
}
//非管理员不能分享给非本组织用户
//non-admins cannot share with users outside their own organization
//if tou.GroupId != u.GroupId {
// return "NoAccess", false
//}
} else if t.Type == model.ShareAddressBookRuleTypeGroup {
//非管理员不能分享给其他组
//non-admins cannot share with other groups
//if t.ToId != u.GroupId {
// return "NoAccess", false
//}
@@ -123,7 +123,7 @@ func (abcr *AddressBookCollectionRule) CheckForm(u *model.User, t *model.Address
} else {
return "ParamsError", false
}
// 重复检查
// duplicate check
ex := service.AllService.AddressBookService.RuleInfoByToIdAndCid(t.Type, t.ToId, t.CollectionId)
if t.Id == 0 && ex.Id > 0 {
return "ItemExists", false
@@ -134,13 +134,13 @@ func (abcr *AddressBookCollectionRule) CheckForm(u *model.User, t *model.Address
return "", true
}
// Update 编辑
// @Tags 我的地址簿规则
// @Summary 地址簿规则编辑
// @Description 地址簿规则编辑
// Update edit
// @Tags my address book rules
// @Summary edit address book rule
// @Description edit address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response{data=model.AddressBookCollection}
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection_rule/update [post]
@@ -185,13 +185,13 @@ func (abcr *AddressBookCollectionRule) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 我的地址簿规则
// @Summary 地址簿规则删除
// @Description 地址簿规则删除
// Delete delete
// @Tags my address book rules
// @Summary delete address book rule
// @Description delete address book rule
// @Accept json
// @Produce json
// @Param body body model.AddressBookCollectionRule true "地址簿规则信息"
// @Param body body model.AddressBookCollectionRule true "address book rule info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/address_book_collection_rule/delete [post]
+17 -17
View File
@@ -13,15 +13,15 @@ import (
type LoginLog struct {
}
// List 列表
// @Tags 我的登录日志
// @Summary 登录日志列表
// @Description 登录日志列表
// List list
// @Tags my login logs
// @Summary login log list
// @Description login log list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param user_id query int false "用户ID"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param user_id query int false "userID"
// @Success 200 {object} response.Response{data=model.LoginLogList}
// @Failure 500 {object} response.Response
// @Router /admin/my/login_log/list [get]
@@ -40,13 +40,13 @@ func (ct *LoginLog) List(c *gin.Context) {
response.Success(c, res)
}
// Delete 删除
// @Tags 我的登录日志
// @Summary 登录日志删除
// @Description 登录日志删除
// Delete delete
// @Tags my login logs
// @Summary delete login log
// @Description delete login log
// @Accept json
// @Produce json
// @Param body body model.LoginLog true "登录日志信息"
// @Param body body model.LoginLog true "login log info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/login_log/delete [post]
@@ -81,13 +81,13 @@ func (ct *LoginLog) Delete(c *gin.Context) {
response.Fail(c, 101, err.Error())
}
// BatchDelete 删除
// @Tags 我的登录日志
// @Summary 登录日志批量删除
// @Description 登录日志批量删除
// BatchDelete delete
// @Tags my login logs
// @Summary batch delete login logs
// @Description batch delete login logs
// @Accept json
// @Produce json
// @Param body body admin.LoginLogIds true "登录日志"
// @Param body body admin.LoginLogIds true "login log"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/login_log/batchDelete [post]
+9 -9
View File
@@ -12,18 +12,18 @@ import (
type Peer struct {
}
// List 列表
// @Tags 我的设备
// @Summary 设备列表
// @Description 设备列表
// List list
// @Tags my devices
// @Summary device list
// @Description device list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param time_ago query int false "时间"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param time_ago query int false "time"
// @Param id query string false "ID"
// @Param hostname query string false "主机名"
// @Param uuids query string false "uuids 用逗号分隔"
// @Param hostname query string false "hostname"
// @Param uuids query string false "uuids separated by commas"
// @Success 200 {object} response.Response{data=model.PeerList}
// @Failure 500 {object} response.Response
// @Router /admin/my/peer/list [get]
+15 -15
View File
@@ -12,14 +12,14 @@ import (
type ShareRecord struct {
}
// List 分享记录列表
// @Tags 我的分享记录
// @Summary 分享记录列表
// @Description 分享记录列表
// List share record list
// @Tags my share records
// @Summary share record list
// @Description share record list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/share_record/list [get]
@@ -37,13 +37,13 @@ func (sr *ShareRecord) List(c *gin.Context) {
response.Success(c, res)
}
// Delete 分享记录删除
// @Tags 我的分享记录
// @Summary 分享记录删除
// @Description 分享记录删除
// Delete delete share record
// @Tags my share records
// @Summary delete share record
// @Description delete share record
// @Accept json
// @Produce json
// @Param body body admin.ShareRecordForm true "分享记录信息"
// @Param body body admin.ShareRecordForm true "share record info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/share_record/delete [post]
@@ -78,10 +78,10 @@ func (sr *ShareRecord) Delete(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "OperationFailed")+err.Error())
}
// BatchDelete 批量删除我的分享记录
// @Tags 我的
// @Summary 批量删除我的分享记录
// @Description 批量删除我的分享记录
// BatchDelete batch delete my share records
// @Tags my
// @Summary batch delete my share records
// @Description batch delete my share records
// @Accept json
// @Produce json
// @Param body body admin.PeerShareRecordBatchDeleteForm true "id"
+23 -23
View File
@@ -11,16 +11,16 @@ import (
type Tag struct{}
// List 列表
// @Tags 我的标签
// @Summary 标签列表
// @Description 标签列表
// List list
// @Tags my tags
// @Summary tag list
// @Description tag list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param is_my query int false "是否是我的"
// @Param user_id query int false "用户id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param is_my query int false "whether it is mine"
// @Param user_id query int false "userid"
// @Success 200 {object} response.Response{data=model.TagList}
// @Failure 500 {object} response.Response
// @Router /admin/my/tag/list [get]
@@ -45,13 +45,13 @@ func (ct *Tag) List(c *gin.Context) {
response.Success(c, res)
}
// Create 创建标签
// @Tags 我的标签
// @Summary 创建标签
// @Description 创建标签
// Create create tag
// @Tags my tags
// @Summary create tag
// @Description create tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response{data=model.Tag}
// @Failure 500 {object} response.Response
// @Router /admin/my/tag/create [post]
@@ -78,13 +78,13 @@ func (ct *Tag) Create(c *gin.Context) {
response.Success(c, nil)
}
// Update 编辑
// @Tags 我的标签
// @Summary 标签编辑
// @Description 标签编辑
// Update edit
// @Tags my tags
// @Summary edit tag
// @Description edit tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response{data=model.Tag}
// @Failure 500 {object} response.Response
// @Router /admin/my/tag/update [post]
@@ -133,13 +133,13 @@ func (ct *Tag) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 标签
// @Summary 标签删除
// @Description 标签删除
// Delete delete
// @Tags tag
// @Summary delete tag
// @Description delete tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/my/tag/delete [post]
+20 -20
View File
@@ -64,7 +64,7 @@ func (o *Oauth) ToBind(c *gin.Context) {
})
}
// Confirm 确认授权登录
// Confirm confirm authorized login
func (o *Oauth) Confirm(c *gin.Context) {
j := &adminReq.OauthConfirmForm{}
err := c.ShouldBindJSON(j)
@@ -140,8 +140,8 @@ func (o *Oauth) Unbind(c *gin.Context) {
// Detail Oauth
// @Tags Oauth
// @Summary Oauth详情
// @Description Oauth详情
// @Summary Oauthdetails
// @Description Oauthdetails
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -161,13 +161,13 @@ func (o *Oauth) Detail(c *gin.Context) {
return
}
// Create 创建Oauth
// Create createOauth
// @Tags Oauth
// @Summary 创建Oauth
// @Description 创建Oauth
// @Summary createOauth
// @Description createOauth
// @Accept json
// @Produce json
// @Param body body admin.OauthForm true "Oauth信息"
// @Param body body admin.OauthForm true "Oauthinfo"
// @Success 200 {object} response.Response{data=model.Oauth}
// @Failure 500 {object} response.Response
// @Router /admin/oauth/create [post]
@@ -202,14 +202,14 @@ func (o *Oauth) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// List list
// @Tags Oauth
// @Summary Oauth列表
// @Description Oauth列表
// @Summary Oauthlist
// @Description Oauthlist
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Success 200 {object} response.Response{data=model.OauthList}
// @Failure 500 {object} response.Response
// @Router /admin/oauth/list [get]
@@ -224,13 +224,13 @@ func (o *Oauth) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// Update edit
// @Tags Oauth
// @Summary Oauth编辑
// @Description Oauth编辑
// @Summary Oauthedit
// @Description Oauthedit
// @Accept json
// @Produce json
// @Param body body admin.OauthForm true "Oauth信息"
// @Param body body admin.OauthForm true "Oauthinfo"
// @Success 200 {object} response.Response{data=model.OauthList}
// @Failure 500 {object} response.Response
// @Router /admin/oauth/update [post]
@@ -259,13 +259,13 @@ func (o *Oauth) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// Delete delete
// @Tags Oauth
// @Summary Oauth删除
// @Description Oauth删除
// @Summary Oauthdelete
// @Description Oauthdelete
// @Accept json
// @Produce json
// @Param body body admin.OauthForm true "Oauth信息"
// @Param body body admin.OauthForm true "Oauthinfo"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/oauth/delete [post]
+34 -34
View File
@@ -14,10 +14,10 @@ import (
type Peer struct {
}
// Detail 设备
// @Tags 设备
// @Summary 设备详情
// @Description 设备详情
// Detail device
// @Tags device
// @Summary device details
// @Description device details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -37,13 +37,13 @@ func (ct *Peer) Detail(c *gin.Context) {
return
}
// Create 创建设备
// @Tags 设备
// @Summary 创建设备
// @Description 创建设备
// Create create device
// @Tags device
// @Summary create device
// @Description create device
// @Accept json
// @Produce json
// @Param body body admin.PeerForm true "设备信息"
// @Param body body admin.PeerForm true "device info"
// @Success 200 {object} response.Response{data=model.Peer}
// @Failure 500 {object} response.Response
// @Router /admin/peer/create [post]
@@ -68,18 +68,18 @@ func (ct *Peer) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 设备
// @Summary 设备列表
// @Description 设备列表
// List list
// @Tags device
// @Summary device list
// @Description device list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param time_ago query int false "时间"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param time_ago query int false "time"
// @Param id query string false "ID"
// @Param hostname query string false "主机名"
// @Param uuids query string false "uuids 用逗号分隔"
// @Param hostname query string false "hostname"
// @Param uuids query string false "uuids separated by commas"
// @Success 200 {object} response.Response{data=model.PeerList}
// @Failure 500 {object} response.Response
// @Router /admin/peer/list [get]
@@ -121,13 +121,13 @@ func (ct *Peer) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 设备
// @Summary 设备编辑
// @Description 设备编辑
// Update edit
// @Tags device
// @Summary edit device
// @Description edit device
// @Accept json
// @Produce json
// @Param body body admin.PeerForm true "设备信息"
// @Param body body admin.PeerForm true "device info"
// @Success 200 {object} response.Response{data=model.Peer}
// @Failure 500 {object} response.Response
// @Router /admin/peer/update [post]
@@ -156,13 +156,13 @@ func (ct *Peer) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 设备
// @Summary 设备删除
// @Description 设备删除
// Delete delete
// @Tags device
// @Summary delete device
// @Description delete device
// @Accept json
// @Produce json
// @Param body body admin.PeerForm true "设备信息"
// @Param body body admin.PeerForm true "device info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/peer/delete [post]
@@ -192,13 +192,13 @@ func (ct *Peer) Delete(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
}
// BatchDelete 批量删除
// @Tags 设备
// @Summary 批量设备删除
// @Description 批量设备删除
// BatchDelete batch delete
// @Tags device
// @Summary batch delete devices
// @Description batch delete devices
// @Accept json
// @Produce json
// @Param body body admin.PeerBatchDeleteForm true "设备id"
// @Param body body admin.PeerBatchDeleteForm true "deviceid"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/peer/batchDelete [post]
@@ -232,7 +232,7 @@ func (ct *Peer) SimpleData(c *gin.Context) {
return
}
res := service.AllService.PeerService.List(1, 99999, func(tx *gorm.DB) {
//可以公开的情报
//information that can be made public
tx.Select("id,version")
tx.Where("id in (?)", f.Ids)
})
+1 -1
View File
@@ -25,7 +25,7 @@ func (r *Rustdesk) CmdList(c *gin.Context) {
return
}
res := service.AllService.ServerCmdService.List(q.Page, 9999)
//在列表前添加系统命令
//add system commands before the list
list := make([]*model.ServerCmd, 0)
list = append(list, model.SysIdServerCmds...)
list = append(list, model.SysRelayServerCmds...)
+16 -16
View File
@@ -12,15 +12,15 @@ import (
type ShareRecord struct {
}
// List 列表
// @Tags 分享记录
// @Summary 分享记录列表
// @Description 分享记录列表
// List list
// @Tags share record
// @Summary share record list
// @Description share record list
// @Accept json
// @Produce json
// @Param user_id query int false "用户ID"
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param user_id query int false "userID"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/share_record/list [get]
@@ -39,13 +39,13 @@ func (sr *ShareRecord) List(c *gin.Context) {
response.Success(c, res)
}
// Delete 删除
// @Tags 分享记录
// @Summary 分享记录删除
// @Description 分享记录删除
// Delete delete
// @Tags share record
// @Summary delete share record
// @Description delete share record
// @Accept json
// @Produce json
// @Param body body admin.ShareRecordForm true "分享记录信息"
// @Param body body admin.ShareRecordForm true "share record info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/share_record/delete [post]
@@ -75,10 +75,10 @@ func (sr *ShareRecord) Delete(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
}
// BatchDelete 批量删除
// @Tags 分享记录
// @Summary 批量分享记录
// @Description 批量分享记录
// BatchDelete batch delete
// @Tags share record
// @Summary batch share records
// @Description batch share records
// @Accept json
// @Produce json
// @Param body body admin.PeerShareRecordBatchDeleteForm true "id"
+27 -27
View File
@@ -13,10 +13,10 @@ import (
type Tag struct {
}
// Detail 标签
// @Tags 标签
// @Summary 标签详情
// @Description 标签详情
// Detail tag
// @Tags tag
// @Summary tag details
// @Description tag details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -41,13 +41,13 @@ func (ct *Tag) Detail(c *gin.Context) {
return
}
// Create 创建标签
// @Tags 标签
// @Summary 创建标签
// @Description 创建标签
// Create create tag
// @Tags tag
// @Summary create tag
// @Description create tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response{data=model.Tag}
// @Failure 500 {object} response.Response
// @Router /admin/tag/create [post]
@@ -76,16 +76,16 @@ func (ct *Tag) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 标签
// @Summary 标签列表
// @Description 标签列表
// List list
// @Tags tag
// @Summary tag list
// @Description tag list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param is_my query int false "是否是我的"
// @Param user_id query int false "用户id"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param is_my query int false "whether it is mine"
// @Param user_id query int false "userid"
// @Success 200 {object} response.Response{data=model.TagList}
// @Failure 500 {object} response.Response
// @Router /admin/tag/list [get]
@@ -110,13 +110,13 @@ func (ct *Tag) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 标签
// @Summary 标签编辑
// @Description 标签编辑
// Update edit
// @Tags tag
// @Summary edit tag
// @Description edit tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response{data=model.Tag}
// @Failure 500 {object} response.Response
// @Router /admin/tag/update [post]
@@ -150,13 +150,13 @@ func (ct *Tag) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 标签
// @Summary 标签删除
// @Description 标签删除
// Delete delete
// @Tags tag
// @Summary delete tag
// @Description delete tag
// @Accept json
// @Produce json
// @Param body body admin.TagForm true "标签信息"
// @Param body body admin.TagForm true "tag info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/tag/delete [post]
+46 -46
View File
@@ -16,10 +16,10 @@ import (
type User struct {
}
// Detail 管理员
// @Tags 用户
// @Summary 管理员详情
// @Description 管理员详情
// Detail administrator
// @Tags user
// @Summary administrator details
// @Description administrator details
// @Accept json
// @Produce json
// @Param id path int true "ID"
@@ -39,13 +39,13 @@ func (ct *User) Detail(c *gin.Context) {
return
}
// Create 管理员
// @Tags 用户
// @Summary 创建管理员
// @Description 创建管理员
// Create administrator
// @Tags user
// @Summary create administrator
// @Description create administrator
// @Accept json
// @Produce json
// @Param body body admin.UserForm true "管理员信息"
// @Param body body admin.UserForm true "administrator info"
// @Success 200 {object} response.Response{data=model.User}
// @Failure 500 {object} response.Response
// @Router /admin/user/create [post]
@@ -70,15 +70,15 @@ func (ct *User) Create(c *gin.Context) {
response.Success(c, nil)
}
// List 列表
// @Tags 用户
// @Summary 管理员列表
// @Description 管理员列表
// List list
// @Tags user
// @Summary administrator list
// @Description administrator list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param username query int false "账户"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param username query int false "account"
// @Success 200 {object} response.Response{data=model.UserList}
// @Failure 500 {object} response.Response
// @Router /admin/user/list [get]
@@ -97,13 +97,13 @@ func (ct *User) List(c *gin.Context) {
response.Success(c, res)
}
// Update 编辑
// @Tags 用户
// @Summary 管理员编辑
// @Description 管理员编辑
// Update edit
// @Tags user
// @Summary edit administrator
// @Description edit administrator
// @Accept json
// @Produce json
// @Param body body admin.UserForm true "用户信息"
// @Param body body admin.UserForm true "user info"
// @Success 200 {object} response.Response{data=model.User}
// @Failure 500 {object} response.Response
// @Router /admin/user/update [post]
@@ -132,13 +132,13 @@ func (ct *User) Update(c *gin.Context) {
response.Success(c, nil)
}
// Delete 删除
// @Tags 用户
// @Summary 管理员删除
// @Description 管理员编删除
// Delete delete
// @Tags user
// @Summary delete administrator
// @Description delete administrator
// @Accept json
// @Produce json
// @Param body body admin.UserForm true "用户信息"
// @Param body body admin.UserForm true "user info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/user/delete [post]
@@ -168,13 +168,13 @@ func (ct *User) Delete(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
}
// UpdatePassword 修改密码
// @Tags 用户
// @Summary 修改密码
// @Description 修改密码
// UpdatePassword change password
// @Tags user
// @Summary change password
// @Description change password
// @Accept json
// @Produce json
// @Param body body admin.UserPasswordForm true "用户信息"
// @Param body body admin.UserPasswordForm true "user info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/user/updatePassword [post]
@@ -203,10 +203,10 @@ func (ct *User) UpdatePassword(c *gin.Context) {
response.Success(c, nil)
}
// Current 当前用户
// @Tags 用户
// @Summary 当前用户
// @Description 当前用户
// Current current user
// @Tags user
// @Summary current user
// @Description current user
// @Accept json
// @Produce json
// @Success 200 {object} response.Response{data=adResp.LoginPayload}
@@ -220,13 +220,13 @@ func (ct *User) Current(c *gin.Context) {
responseLoginSuccess(c, u, t)
}
// ChangeCurPwd 修改当前用户密码
// @Tags 用户
// @Summary 修改当前用户密码
// @Description 修改当前用户密码
// ChangeCurPwd change the current user's password
// @Tags user
// @Summary change the current user's password
// @Description change the current user's password
// @Accept json
// @Produce json
// @Param body body admin.ChangeCurPasswordForm true "用户信息"
// @Param body body admin.ChangeCurPasswordForm true "user info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/user/changeCurPwd [post]
@@ -261,9 +261,9 @@ func (ct *User) ChangeCurPwd(c *gin.Context) {
}
// MyOauth
// @Tags 用户
// @Summary 我的授权
// @Description 我的授权
// @Tags user
// @Summary my authorizations
// @Description my authorizations
// @Accept json
// @Produce json
// @Success 200 {object} response.Response{data=[]adResp.UserOauthItem}
@@ -321,7 +321,7 @@ func (ct *User) Register(c *gin.Context) {
return
}
regStatus := model.StatusCode(global.Config.App.RegisterStatus)
// 注册状态可能未配置,默认启用
// the registration status may not be configured; enabled by default
if regStatus != model.COMMON_STATUS_DISABLED && regStatus != model.COMMON_STATUS_ENABLE {
regStatus = model.COMMON_STATUS_ENABLE
}
@@ -332,11 +332,11 @@ func (ct *User) Register(c *gin.Context) {
return
}
if regStatus == model.COMMON_STATUS_DISABLED {
// 需要管理员审核
// requires administrator approval
response.Fail(c, 101, response.TranslateMsg(c, "RegisterSuccessWaitAdminConfirm"))
return
}
// 注册成功后自动登录
// automatically log in after successful registration
ut := service.AllService.UserService.Login(u, &model.LoginLog{
UserId: u.Id,
Client: model.LoginLogClientWebAdmin,
+17 -17
View File
@@ -13,15 +13,15 @@ import (
type UserToken struct {
}
// List 列表
// @Tags 登录凭证
// @Summary 登录凭证列表
// @Description 登录凭证列表
// List list
// @Tags login credential
// @Summary login credential list
// @Description login credential list
// @Accept json
// @Produce json
// @Param page query int false "页码"
// @Param page_size query int false "页大小"
// @Param user_id query int false "用户ID"
// @Param page query int false "page number"
// @Param page_size query int false "page size"
// @Param user_id query int false "userID"
// @Success 200 {object} response.Response{data=model.UserTokenList}
// @Failure 500 {object} response.Response
// @Router /admin/user_token/list [get]
@@ -41,13 +41,13 @@ func (ct *UserToken) List(c *gin.Context) {
response.Success(c, res)
}
// Delete 删除
// @Tags 登录凭证
// @Summary 登录凭证删除
// @Description 登录凭证删除
// Delete delete
// @Tags login credential
// @Summary delete login credential
// @Description delete login credential
// @Accept json
// @Produce json
// @Param body body model.UserToken true "登录凭证信息"
// @Param body body model.UserToken true "login credential info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/user_token/delete [post]
@@ -82,13 +82,13 @@ func (ct *UserToken) Delete(c *gin.Context) {
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
}
// BatchDelete 批量删除
// @Tags 登录凭证
// @Summary 登录凭证批量删除
// @Description 登录凭证批量删除
// BatchDelete batch delete
// @Tags login credential
// @Summary batch delete login credentials
// @Description batch delete login credentials
// @Accept json
// @Produce json
// @Param body body admin.UserTokenBatchDeleteForm true "登录凭证信息"
// @Param body body admin.UserTokenBatchDeleteForm true "login credential info"
// @Success 200 {object} response.Response
// @Failure 500 {object} response.Response
// @Router /admin/user_token/batchDelete [post]