diff --git a/backend/src/api/passwordStore.js b/backend/src/api/passwordStore.js new file mode 100644 index 0000000..4933d03 --- /dev/null +++ b/backend/src/api/passwordStore.js @@ -0,0 +1,8 @@ +import request from '@/utils/request' + +const resource = '/backend/passwordStore' +export const getPasswordStoreList = (params) => request({ url: `${resource}/list`, method: 'get', params }) +export const getPasswordStoreDetail = (id) => request({ url: `${resource}/detail/${id}`, method: 'get' }) +export const createPasswordStore = (data) => request({ url: `${resource}/create`, method: 'post', data }) +export const updatePasswordStore = (id, data) => request({ url: `${resource}/update/${id}`, method: 'post', data }) +export const deletePasswordStore = (id) => request({ url: `${resource}/delete/${id}`, method: 'delete' }) diff --git a/backend/src/router/index.js b/backend/src/router/index.js index e0de6e3..794ab77 100644 --- a/backend/src/router/index.js +++ b/backend/src/router/index.js @@ -76,6 +76,12 @@ const staticMainChildren = [ component: () => import("@/views/apps/oa/organization/index.vue"), meta: { requiresAuth: true, title: "组织架构", modulePath: "/apps/oa" } }, + { + path: "/tools/passwordStore", + name: "BackendPasswordStore", + component: () => import("@/views/tools/passwordStore/index.vue"), + meta: { requiresAuth: true, title: "密码存储" } + }, // 兼容拼写错误的路径重定向 { path: "/apps/erp/dashborad", diff --git a/backend/src/views/apps/oa/organization/index.vue b/backend/src/views/apps/oa/organization/index.vue index 91e5542..4eceed1 100644 --- a/backend/src/views/apps/oa/organization/index.vue +++ b/backend/src/views/apps/oa/organization/index.vue @@ -39,7 +39,7 @@
- + @@ -203,7 +203,7 @@ import { Plus, Refresh, Setting, - Office, + OfficeBuilding, Folder, Expand, Fold @@ -220,7 +220,7 @@ import { getEmployeeList, createEmployee, updateEmployee, - deleteEmployee, + deleteEmployee as apiDeleteEmployee, getOrgSettings } from "@/api/organization"; @@ -437,7 +437,7 @@ const deleteEmployee = async (data) => { await ElMessageBox.confirm('确认删除这个员工吗?删除后将无法恢复。', '删除确认', { type: 'warning', }); - await deleteEmployee(data.id); + await apiDeleteEmployee(data.id); ElMessage.success('删除成功'); await loadEmployeeList(selectedOrg.value.id); } catch (error) { diff --git a/backend/src/views/tools/passwordStore/index.vue b/backend/src/views/tools/passwordStore/index.vue new file mode 100644 index 0000000..8b0bcc5 --- /dev/null +++ b/backend/src/views/tools/passwordStore/index.vue @@ -0,0 +1,1170 @@ + + + + + diff --git a/go/controllers/password_store.go b/go/controllers/password_store.go new file mode 100644 index 0000000..7937a4d --- /dev/null +++ b/go/controllers/password_store.go @@ -0,0 +1,459 @@ +package controllers + +import ( + "encoding/json" + "io" + "strconv" + "strings" + "time" + + "server/models" + "server/pkg/jwtutil" + + "github.com/beego/beego/v2/client/orm" + "github.com/beego/beego/v2/core/logs" + beego "github.com/beego/beego/v2/server/web" +) + +type passwordPayload struct { + Platform string `json:"platform"` + URL string `json:"url"` + Accounts []models.PasswordAccountItem `json:"accounts"` + Remark string `json:"remark"` +} + +// PasswordStoreItemDTO 统一返回给前端的结构体,包含解析后的账号列表 +type PasswordStoreItemDTO struct { + ID uint64 `json:"id"` + Tid int `json:"tid,omitempty"` + Platform string `json:"platform"` + URL string `json:"url"` + Accounts []models.PasswordAccountItem `json:"accounts"` + Remark string `json:"remark"` + UserID uint64 `json:"user_id"` + CreateTime time.Time `json:"create_time"` + UpdateTime *time.Time `json:"update_time"` +} + +func accountsToJSON(list []models.PasswordAccountItem) string { + cleaned := make([]models.PasswordAccountItem, 0, len(list)) + for _, item := range list { + u := strings.TrimSpace(item.Username) + p := strings.TrimSpace(item.Password) + reg := strings.TrimSpace(item.RegistrationInfo) + rem := strings.TrimSpace(item.Remark) + if u == "" && p == "" && reg == "" && rem == "" { + continue + } + cleaned = append(cleaned, models.PasswordAccountItem{ + Username: u, + Password: p, + RegistrationInfo: reg, + Remark: rem, + }) + } + b, err := json.Marshal(cleaned) + if err != nil { + return "[]" + } + return string(b) +} + +func accountsFromJSON(raw string) []models.PasswordAccountItem { + raw = strings.TrimSpace(raw) + if raw == "" { + return []models.PasswordAccountItem{} + } + var list []models.PasswordAccountItem + if err := json.Unmarshal([]byte(raw), &list); err == nil && list != nil { + return list + } + return []models.PasswordAccountItem{} +} + +func passwordClaims(c *beego.Controller, kind string) (*jwtutil.Claims, error) { + p := strings.SplitN(c.Ctx.Request.Header.Get("Authorization"), " ", 2) + if len(p) != 2 || p[0] != "Bearer" { + return nil, orm.ErrNoRows + } + cl, e := jwtutil.ParseToken(p[1]) + if e != nil || cl.UserType != kind || cl.UserID <= 0 { + return nil, orm.ErrNoRows + } + return cl, nil +} + +func parsePassword(c *beego.Controller) (passwordPayload, error) { + var p passwordPayload + b, e := io.ReadAll(c.Ctx.Request.Body) + if e == nil { + e = json.Unmarshal(b, &p) + } + p.Platform = strings.TrimSpace(p.Platform) + p.URL = strings.TrimSpace(p.URL) + p.Remark = strings.TrimSpace(p.Remark) + return p, e +} + +func passwordReply(c *beego.Controller, status int, msg string, data interface{}) { + c.Ctx.Output.SetStatus(status) + c.Data["json"] = map[string]interface{}{"code": status, "msg": msg, "data": data} + _ = c.ServeJSON() +} + +func validPassword(p passwordPayload) bool { + return p.Platform != "" +} + +// ==================== 平台端 Password Store ==================== + +type PlatformPasswordStoreController struct{ beego.Controller } + +func (c *PlatformPasswordStoreController) List() { + cl, e := passwordClaims(&c.Controller, "platform") + if e != nil { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + qs := models.Orm.QueryTable(new(models.PlatformPasswordStore)).Filter("is_deleted", 0).Filter("user_id", cl.UserID) + k := strings.TrimSpace(c.GetString("keyword")) + if k != "" { + cond := orm.NewCondition(). + Or("platform__icontains", k). + Or("url__icontains", k). + Or("accounts__icontains", k). + Or("remark__icontains", k) + qs = qs.SetCond(orm.NewCondition().And("is_deleted", 0).And("user_id", cl.UserID).AndCond(cond)) + } + total, _ := qs.Count() + var list []models.PlatformPasswordStore + _, e = qs.OrderBy("-id").Limit(200).All(&list) + if e != nil && e != orm.ErrNoRows { + logs.Error("[passwordStore] platform list failed: %v", e) + passwordReply(&c.Controller, 500, "查询失败: "+e.Error(), nil) + return + } + res := make([]PasswordStoreItemDTO, 0, len(list)) + for _, row := range list { + res = append(res, PasswordStoreItemDTO{ + ID: row.ID, + Platform: row.Platform, + URL: row.URL, + Accounts: accountsFromJSON(row.Accounts), + Remark: row.Remark, + UserID: row.UserID, + CreateTime: row.CreateTime, + UpdateTime: row.UpdateTime, + }) + } + passwordReply(&c.Controller, 200, "success", map[string]interface{}{"list": res, "total": total}) +} + +func (c *PlatformPasswordStoreController) Detail() { + cl, e := passwordClaims(&c.Controller, "platform") + if e != nil { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64) + var v models.PlatformPasswordStore + e = models.Orm.QueryTable(new(models.PlatformPasswordStore)).Filter("id", id).Filter("is_deleted", 0).Filter("user_id", cl.UserID).One(&v) + if e != nil { + passwordReply(&c.Controller, 404, "记录不存在", nil) + return + } + dto := PasswordStoreItemDTO{ + ID: v.ID, + Platform: v.Platform, + URL: v.URL, + Accounts: accountsFromJSON(v.Accounts), + Remark: v.Remark, + UserID: v.UserID, + CreateTime: v.CreateTime, + UpdateTime: v.UpdateTime, + } + passwordReply(&c.Controller, 200, "success", dto) +} + +func (c *PlatformPasswordStoreController) Create() { + cl, e := passwordClaims(&c.Controller, "platform") + if e != nil { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + p, e := parsePassword(&c.Controller) + if e != nil || !validPassword(p) { + passwordReply(&c.Controller, 400, "平台名称不能为空", nil) + return + } + accJSON := accountsToJSON(p.Accounts) + v := &models.PlatformPasswordStore{ + Platform: p.Platform, + URL: p.URL, + Accounts: accJSON, + Remark: p.Remark, + UserID: uint64(cl.UserID), + } + id, e := models.Orm.Insert(v) + if e != nil { + logs.Error("[passwordStore] platform create failed: %v", e) + passwordReply(&c.Controller, 500, "创建失败: "+e.Error(), nil) + return + } + v.ID = uint64(id) + dto := PasswordStoreItemDTO{ + ID: v.ID, + Platform: v.Platform, + URL: v.URL, + Accounts: accountsFromJSON(v.Accounts), + Remark: v.Remark, + UserID: v.UserID, + CreateTime: v.CreateTime, + UpdateTime: v.UpdateTime, + } + passwordReply(&c.Controller, 200, "创建成功", dto) +} + +func (c *PlatformPasswordStoreController) Update() { + cl, e := passwordClaims(&c.Controller, "platform") + if e != nil { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64) + p, e := parsePassword(&c.Controller) + if e != nil || !validPassword(p) { + passwordReply(&c.Controller, 400, "平台名称不能为空", nil) + return + } + var v models.PlatformPasswordStore + e = models.Orm.QueryTable(new(models.PlatformPasswordStore)).Filter("id", id).Filter("is_deleted", 0).Filter("user_id", cl.UserID).One(&v) + if e != nil { + passwordReply(&c.Controller, 404, "记录不存在", nil) + return + } + now := time.Now() + accJSON := accountsToJSON(p.Accounts) + _, e = models.Orm.QueryTable(new(models.PlatformPasswordStore)).Filter("id", id).Update(map[string]interface{}{ + "platform": p.Platform, + "url": p.URL, + "accounts": accJSON, + "remark": p.Remark, + "update_time": now, + }) + if e != nil { + logs.Error("[passwordStore] platform update failed: %v", e) + passwordReply(&c.Controller, 500, "更新失败: "+e.Error(), nil) + return + } + v.Platform = p.Platform + v.URL = p.URL + v.Accounts = accJSON + v.Remark = p.Remark + v.UpdateTime = &now + dto := PasswordStoreItemDTO{ + ID: v.ID, + Platform: v.Platform, + URL: v.URL, + Accounts: accountsFromJSON(v.Accounts), + Remark: v.Remark, + UserID: v.UserID, + CreateTime: v.CreateTime, + UpdateTime: v.UpdateTime, + } + passwordReply(&c.Controller, 200, "更新成功", dto) +} + +func (c *PlatformPasswordStoreController) Delete() { + cl, e := passwordClaims(&c.Controller, "platform") + if e != nil { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64) + n, e := models.Orm.QueryTable(new(models.PlatformPasswordStore)).Filter("id", id).Filter("user_id", cl.UserID).Update(map[string]interface{}{"is_deleted": 1, "delete_time": time.Now()}) + if e != nil || n == 0 { + passwordReply(&c.Controller, 404, "记录不存在", nil) + return + } + passwordReply(&c.Controller, 200, "删除成功", nil) +} + +// ==================== 租户端 Password Store ==================== + +type BackendPasswordStoreController struct{ beego.Controller } + +func (c *BackendPasswordStoreController) List() { + cl, e := passwordClaims(&c.Controller, "backend") + if e != nil || cl.TenantId <= 0 { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + qs := models.Orm.QueryTable(new(models.BackendPasswordStore)).Filter("is_deleted", 0).Filter("tid", cl.TenantId).Filter("user_id", cl.UserID) + k := strings.TrimSpace(c.GetString("keyword")) + if k != "" { + cond := orm.NewCondition(). + Or("platform__icontains", k). + Or("url__icontains", k). + Or("accounts__icontains", k). + Or("remark__icontains", k) + qs = qs.SetCond(orm.NewCondition().And("is_deleted", 0).And("tid", cl.TenantId).And("user_id", cl.UserID).AndCond(cond)) + } + total, _ := qs.Count() + var list []models.BackendPasswordStore + _, e = qs.OrderBy("-id").Limit(200).All(&list) + if e != nil && e != orm.ErrNoRows { + logs.Error("[passwordStore] backend list failed: %v", e) + passwordReply(&c.Controller, 500, "查询失败: "+e.Error(), nil) + return + } + res := make([]PasswordStoreItemDTO, 0, len(list)) + for _, row := range list { + res = append(res, PasswordStoreItemDTO{ + ID: row.ID, + Tid: row.Tid, + Platform: row.Platform, + URL: row.URL, + Accounts: accountsFromJSON(row.Accounts), + Remark: row.Remark, + UserID: row.UserID, + CreateTime: row.CreateTime, + UpdateTime: row.UpdateTime, + }) + } + passwordReply(&c.Controller, 200, "success", map[string]interface{}{"list": res, "total": total}) +} + +func (c *BackendPasswordStoreController) Detail() { + cl, e := passwordClaims(&c.Controller, "backend") + if e != nil || cl.TenantId <= 0 { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64) + var v models.BackendPasswordStore + e = models.Orm.QueryTable(new(models.BackendPasswordStore)).Filter("id", id).Filter("tid", cl.TenantId).Filter("is_deleted", 0).Filter("user_id", cl.UserID).One(&v) + if e != nil { + passwordReply(&c.Controller, 404, "记录不存在", nil) + return + } + dto := PasswordStoreItemDTO{ + ID: v.ID, + Tid: v.Tid, + Platform: v.Platform, + URL: v.URL, + Accounts: accountsFromJSON(v.Accounts), + Remark: v.Remark, + UserID: v.UserID, + CreateTime: v.CreateTime, + UpdateTime: v.UpdateTime, + } + passwordReply(&c.Controller, 200, "success", dto) +} + +func (c *BackendPasswordStoreController) Create() { + cl, e := passwordClaims(&c.Controller, "backend") + if e != nil || cl.TenantId <= 0 { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + p, e := parsePassword(&c.Controller) + if e != nil || !validPassword(p) { + passwordReply(&c.Controller, 400, "平台名称不能为空", nil) + return + } + accJSON := accountsToJSON(p.Accounts) + v := &models.BackendPasswordStore{ + Tid: cl.TenantId, + Platform: p.Platform, + URL: p.URL, + Accounts: accJSON, + Remark: p.Remark, + UserID: uint64(cl.UserID), + } + id, e := models.Orm.Insert(v) + if e != nil { + logs.Error("[passwordStore] backend create failed: %v", e) + passwordReply(&c.Controller, 500, "创建失败: "+e.Error(), nil) + return + } + v.ID = uint64(id) + dto := PasswordStoreItemDTO{ + ID: v.ID, + Tid: v.Tid, + Platform: v.Platform, + URL: v.URL, + Accounts: accountsFromJSON(v.Accounts), + Remark: v.Remark, + UserID: v.UserID, + CreateTime: v.CreateTime, + UpdateTime: v.UpdateTime, + } + passwordReply(&c.Controller, 200, "创建成功", dto) +} + +func (c *BackendPasswordStoreController) Update() { + cl, e := passwordClaims(&c.Controller, "backend") + if e != nil || cl.TenantId <= 0 { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64) + p, e := parsePassword(&c.Controller) + if e != nil || !validPassword(p) { + passwordReply(&c.Controller, 400, "平台名称不能为空", nil) + return + } + var v models.BackendPasswordStore + e = models.Orm.QueryTable(new(models.BackendPasswordStore)).Filter("id", id).Filter("tid", cl.TenantId).Filter("is_deleted", 0).Filter("user_id", cl.UserID).One(&v) + if e != nil { + passwordReply(&c.Controller, 404, "记录不存在", nil) + return + } + now := time.Now() + accJSON := accountsToJSON(p.Accounts) + _, e = models.Orm.QueryTable(new(models.BackendPasswordStore)).Filter("id", id).Update(map[string]interface{}{ + "platform": p.Platform, + "url": p.URL, + "accounts": accJSON, + "remark": p.Remark, + "update_time": now, + }) + if e != nil { + logs.Error("[passwordStore] backend update failed: %v", e) + passwordReply(&c.Controller, 500, "更新失败: "+e.Error(), nil) + return + } + v.Platform = p.Platform + v.URL = p.URL + v.Accounts = accJSON + v.Remark = p.Remark + v.UpdateTime = &now + dto := PasswordStoreItemDTO{ + ID: v.ID, + Tid: v.Tid, + Platform: v.Platform, + URL: v.URL, + Accounts: accountsFromJSON(v.Accounts), + Remark: v.Remark, + UserID: v.UserID, + CreateTime: v.CreateTime, + UpdateTime: v.UpdateTime, + } + passwordReply(&c.Controller, 200, "更新成功", dto) +} + +func (c *BackendPasswordStoreController) Delete() { + cl, e := passwordClaims(&c.Controller, "backend") + if e != nil || cl.TenantId <= 0 { + passwordReply(&c.Controller, 401, "未登录或无权限", nil) + return + } + id, _ := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64) + n, e := models.Orm.QueryTable(new(models.BackendPasswordStore)).Filter("id", id).Filter("tid", cl.TenantId).Filter("user_id", cl.UserID).Update(map[string]interface{}{"is_deleted": 1, "delete_time": time.Now()}) + if e != nil || n == 0 { + passwordReply(&c.Controller, 404, "记录不存在", nil) + return + } + passwordReply(&c.Controller, 200, "删除成功", nil) +} diff --git a/go/models/backend_password_store.go b/go/models/backend_password_store.go new file mode 100644 index 0000000..9fc8638 --- /dev/null +++ b/go/models/backend_password_store.go @@ -0,0 +1,20 @@ +package models + +import "time" + +// BackendPasswordStore 租户端密码存储,支持一个平台下挂载多个账号,按租户隔离 +type BackendPasswordStore struct { + ID uint64 `orm:"column(id);pk;auto" json:"id"` + Tid int `orm:"column(tid)" json:"tid"` + Platform string `orm:"column(platform);size(100)" json:"platform"` + URL string `orm:"column(url);size(500)" json:"url"` + Accounts string `orm:"column(accounts);type(text);null" json:"accounts"` + Remark string `orm:"column(remark);type(text);null" json:"remark"` + UserID uint64 `orm:"column(user_id)" json:"user_id"` + IsDeleted int8 `orm:"column(is_deleted);default(0)" json:"is_deleted"` + CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"create_time"` + UpdateTime *time.Time `orm:"column(update_time);type(datetime);null" json:"update_time"` + DeleteTime *time.Time `orm:"column(delete_time);type(datetime);null" json:"delete_time"` +} + +func (m *BackendPasswordStore) TableName() string { return "yz_backend_password_store" } diff --git a/go/models/init.go b/go/models/init.go index d36509d..424e053 100644 --- a/go/models/init.go +++ b/go/models/init.go @@ -68,6 +68,8 @@ func Init(_ string) { new(PlatformAccountPoolCodex), new(PlatformNotebook), new(PlatformAgentApi), + new(PlatformPasswordStore), + new(BackendPasswordStore), new(CmsArticleCategory), new(CmsArticle), diff --git a/go/models/platform_password_store.go b/go/models/platform_password_store.go new file mode 100644 index 0000000..49e67ac --- /dev/null +++ b/go/models/platform_password_store.go @@ -0,0 +1,27 @@ +package models + +import "time" + +// PasswordAccountItem 平台下挂载的单个账号信息 +type PasswordAccountItem struct { + Username string `json:"username"` // 账号 / 用户名 / 邮箱 / 手机号 + Password string `json:"password"` // 密码 (明文存储和返回) + RegistrationInfo string `json:"registration_info"` // 注册信息 (绑定手机、邮箱、注册时间、实名信息等) + Remark string `json:"remark"` // 账号备注 (如主账号、备用账号、VIP等) +} + +// PlatformPasswordStore 平台端密码存储,支持一个平台下挂载多个账号 +type PlatformPasswordStore struct { + ID uint64 `orm:"column(id);pk;auto" json:"id"` + Platform string `orm:"column(platform);size(100)" json:"platform"` + URL string `orm:"column(url);size(500)" json:"url"` + Accounts string `orm:"column(accounts);type(text);null" json:"accounts"` + Remark string `orm:"column(remark);type(text);null" json:"remark"` + UserID uint64 `orm:"column(user_id)" json:"user_id"` + IsDeleted int8 `orm:"column(is_deleted);default(0)" json:"is_deleted"` + CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"create_time"` + UpdateTime *time.Time `orm:"column(update_time);type(datetime);null" json:"update_time"` + DeleteTime *time.Time `orm:"column(delete_time);type(datetime);null" json:"delete_time"` +} + +func (m *PlatformPasswordStore) TableName() string { return "yz_platform_password_store" } diff --git a/go/routers/backend/backend.go b/go/routers/backend/backend.go index 24192ef..b70a68a 100644 --- a/go/routers/backend/backend.go +++ b/go/routers/backend/backend.go @@ -114,7 +114,7 @@ func RegisterAuthRoutes() { beego.Router("/backend/erp/createPosition", &controllers.BackendErpController{}, "post:CreatePosition") beego.Router("/backend/erp/editPosition/:id", &controllers.BackendErpController{}, "post:EditPosition") beego.Router("/backend/erp/deletePosition/:id", &controllers.BackendErpController{}, "delete:DeletePosition") - + // 新增组织架构接口 beego.Router("/backend/erp/getOrgSettings", &controllers.BackendErpController{}, "get:GetOrgSettings") beego.Router("/backend/erp/saveOrgSettings", &controllers.BackendErpController{}, "post:SaveOrgSettings") @@ -206,6 +206,13 @@ func RegisterAuthRoutes() { beego.Router("/backend/domain/tenant/toggleStatus", &controllers.BackendTenantDomainController{}, "post:ToggleStatus") beego.Router("/backend/domain/tenant/delete/:id", &controllers.BackendTenantDomainController{}, "delete:Delete") + // 密码存储管理 + beego.Router("/backend/passwordStore/list", &controllers.BackendPasswordStoreController{}, "get:List") + beego.Router("/backend/passwordStore/detail/:id", &controllers.BackendPasswordStoreController{}, "get:Detail") + beego.Router("/backend/passwordStore/create", &controllers.BackendPasswordStoreController{}, "post:Create") + beego.Router("/backend/passwordStore/update/:id", &controllers.BackendPasswordStoreController{}, "post:Update") + beego.Router("/backend/passwordStore/delete/:id", &controllers.BackendPasswordStoreController{}, "delete:Delete") + // 记事本管理 beego.Router("/backend/notebook/list", &controllers.BackendNotebookController{}, "get:List") beego.Router("/backend/notebook/detail/:id", &controllers.BackendNotebookController{}, "get:Detail") diff --git a/go/routers/platform/platform.go b/go/routers/platform/platform.go index 1bd16bc..6ebadf1 100644 --- a/go/routers/platform/platform.go +++ b/go/routers/platform/platform.go @@ -1,297 +1,304 @@ -package platform - -import ( - "server/controllers" - - beego "github.com/beego/beego/v2/server/web" -) - -// Register 注册平台端路由 -func Register() { - // 平台登录相关 - beego.Router("/platform/login", &controllers.PlatformAuthController{}, "post:LoginPlatform") - beego.Router("/platform/currentUser", &controllers.PlatformAuthController{}, "get:GetCurrentUser") - beego.Router("/platform/sendLoginCode", &controllers.PlatformAuthController{}, "post:SendLoginCode") - beego.Router("/platform/loginBySms", &controllers.PlatformAuthController{}, "post:LoginBySms") - beego.Router("/platform/logout", &controllers.PlatformAuthController{}, "post:Logout") - - // 极验与登录验证配置 - beego.Router("/platform/login/getGeetest3Infos", &controllers.PlatformAuthController{}, "get:GetGeetest3Infos") - beego.Router("/platform/login/getGeetest4Infos", &controllers.PlatformAuthController{}, "get:GetGeetest4Infos") - beego.Router("/platform/login/getOpenVerify", &controllers.PlatformAuthController{}, "get:GetOpenVerify") - beego.Router("/platform/loginVerifyInfos", &controllers.PlatformLoginVerifyController{}, "get:GetLoginVerifyInfos") - beego.Router("/platform/saveloginVerifyInfos", &controllers.PlatformLoginVerifyController{}, "post:SaveLoginVerifyInfos") - - // 存储配置 - beego.Router("/platform/storageConfig", &controllers.StorageConfigController{}, "get:GetStorageConfig") - beego.Router("/platform/saveStorageConfig", &controllers.StorageConfigController{}, "post:SaveStorageConfig") - - // 存储迁移 - beego.Router("/platform/storage/migrateToQiniu", &controllers.StorageMigrationController{}, "post:MigrateToQiniu") - beego.Router("/platform/storage/migrationProgress", &controllers.StorageMigrationController{}, "get:GetMigrationProgress") - - // 找回密码相关 - beego.Router("/platform/resetPassword", &controllers.PlatformAuthController{}, "post:ResetPassword") - beego.Router("/platform/sendResetCode", &controllers.PlatformAuthController{}, "post:SendResetCode") - - // 平台菜单配置相关 - beego.Router("/platform/menu/:id", &controllers.AdminMenuController{}, "get:GetMenu") - beego.Router("/platform/allmenu", &controllers.AdminMenuController{}, "get:GetAllMenus") - beego.Router("/platform/menu/status/:id", &controllers.AdminMenuController{}, "patch:UpdateMenuStatus") - beego.Router("/platform/createmenu", &controllers.AdminMenuController{}, "post:CreateMenu") - beego.Router("/platform/updatemenu/:id", &controllers.AdminMenuController{}, "put:UpdateMenu") - beego.Router("/platform/deletemenu/:id", &controllers.AdminMenuController{}, "delete:DeleteMenu") - - // 平台租户管理相关 - beego.Router("/platform/tenant/getTenant", &controllers.PlatformTenantController{}, "get:GetTenant") - beego.Router("/platform/tenant/getTenantDetail/:id", &controllers.PlatformTenantController{}, "get:GetTenantDetail") - beego.Router("/platform/tenant/createTenant", &controllers.PlatformTenantController{}, "post:CreateTenant") - beego.Router("/platform/tenant/editTenant/:id", &controllers.PlatformTenantController{}, "post:EditTenant") - beego.Router("/platform/tenant/deleteTenant/:id", &controllers.PlatformTenantController{}, "delete:DeleteTenant") - beego.Router("/platform/tenant/findTenantCode", &controllers.PlatformTenantController{}, "get:FindTenantCode") - - // 平台租户用户绑定相关 - beego.Router("/platform/getTenantUsers/:tid", &controllers.PlatformTenantUserController{}, "get:GetTenantUsersByTid") - beego.Router("/platform/tenantUser/list", &controllers.PlatformTenantUserController{}, "get:GetTenantUserList") - beego.Router("/platform/tenantUser/detail/:id", &controllers.PlatformTenantUserController{}, "get:GetTenantUserDetail") - beego.Router("/platform/tenantUser/create", &controllers.PlatformTenantUserController{}, "post:CreateTenantUser") - beego.Router("/platform/tenantUser/edit/:id", &controllers.PlatformTenantUserController{}, "post:EditTenantUser") - beego.Router("/platform/tenantUser/delete/:id", &controllers.PlatformTenantUserController{}, "delete:DeleteTenantUser") - - // 平台管理员用户管理(yz_system_admin_user) - beego.Router("/platform/getAllUsers", &controllers.PlatformAdminUserController{}, "get:GetAllUsers") - beego.Router("/platform/getUserInfo/:id", &controllers.PlatformAdminUserController{}, "get:GetUserInfo") - beego.Router("/platform/addUser", &controllers.PlatformAdminUserController{}, "post:AddUser") - beego.Router("/platform/editUser/:id", &controllers.PlatformAdminUserController{}, "post:EditUser") - beego.Router("/platform/deleteUser/:id", &controllers.PlatformAdminUserController{}, "delete:DeleteUser") - beego.Router("/platform/changePassword", &controllers.PlatformAdminUserController{}, "post:ChangePassword") - - // 平台角色管理(yz_system_admin_role) - beego.Router("/platform/allRoles", &controllers.PlatformRoleController{}, "get:GetAllRoles") - beego.Router("/platform/roles/:id", &controllers.PlatformRoleController{}, "get:GetRoleByID") - beego.Router("/platform/roles", &controllers.PlatformRoleController{}, "post:CreateRole") - beego.Router("/platform/roles/:id", &controllers.PlatformRoleController{}, "put:UpdateRole") - beego.Router("/platform/roles/:id", &controllers.PlatformRoleController{}, "delete:DeleteRole") - - // 操作日志(yz_system_operation_log) - beego.Router("/platform/operationLogs", &controllers.PlatformOperationLogController{}, "get:List") - beego.Router("/platform/operationLogs/statistics", &controllers.PlatformOperationLogController{}, "get:Statistics") - beego.Router("/platform/operationLogs/:id", &controllers.PlatformOperationLogController{}, "get:Detail;delete:Delete") - beego.Router("/platform/operationLogs/batchDelete", &controllers.PlatformOperationLogController{}, "post:BatchDelete") - - // 登录日志(yz_system_login_log) - beego.Router("/platform/loginLogs", &controllers.PlatformLoginLogController{}, "get:List") - beego.Router("/platform/loginLogs/batchDelete", &controllers.PlatformLoginLogController{}, "post:BatchDelete") - beego.Router("/platform/loginLogs/:id", &controllers.PlatformLoginLogController{}, "get:Detail;delete:Delete") - - // 域名管理(主域名池 / 租户域名) - beego.Router("/platform/domain/pool/index", &controllers.PlatformDomainPoolController{}, "get:Index") - beego.Router("/platform/domain/pool/getEnabledDomains", &controllers.PlatformDomainPoolController{}, "get:GetEnabledDomains") - beego.Router("/platform/domain/pool/create", &controllers.PlatformDomainPoolController{}, "post:Create") - beego.Router("/platform/domain/pool/update", &controllers.PlatformDomainPoolController{}, "post:Update") - beego.Router("/platform/domain/pool/delete/:id", &controllers.PlatformDomainPoolController{}, "delete:Delete") - beego.Router("/platform/domain/pool/toggleStatus", &controllers.PlatformDomainPoolController{}, "post:ToggleStatus") - - beego.Router("/platform/domain/tenant/index", &controllers.PlatformTenantDomainController{}, "get:Index") - beego.Router("/platform/domain/tenant/myDomains", &controllers.PlatformTenantDomainController{}, "get:MyDomains") - beego.Router("/platform/domain/tenant/apply", &controllers.PlatformTenantDomainController{}, "post:Apply") - beego.Router("/platform/domain/tenant/audit", &controllers.PlatformTenantDomainController{}, "post:Audit") - beego.Router("/platform/domain/tenant/toggleStatus", &controllers.PlatformTenantDomainController{}, "post:ToggleStatus") - beego.Router("/platform/domain/tenant/delete/:id", &controllers.PlatformTenantDomainController{}, "delete:Delete") - - // 模块管理(yz_system_modules) - beego.Router("/platform/modules/list", &controllers.PlatformModulesController{}, "get:GetList") - beego.Router("/platform/modules/getTenantList", &controllers.PlatformModulesController{}, "get:GetTenantList") - beego.Router("/platform/modules/select/list", &controllers.PlatformModulesController{}, "get:GetSelectList") - beego.Router("/platform/modules/status", &controllers.PlatformModulesController{}, "post:ChangeStatus") - beego.Router("/platform/modules/batchDelete", &controllers.PlatformModulesController{}, "post:BatchDelete") - beego.Router("/platform/modules", &controllers.PlatformModulesController{}, "post:Add") - beego.Router("/platform/modules/:id", &controllers.PlatformModulesController{}, "get:GetDetail;put:Edit;delete:Delete") - - // 投诉建议(yz_system_complaint_category / yz_system_platform_complaint) - beego.Router("/platform/complaintCategory/list", &controllers.PlatformComplaintCategoryController{}, "get:List") - beego.Router("/platform/complaintCategory/select", &controllers.PlatformComplaintCategoryController{}, "get:SelectList") - beego.Router("/platform/complaintCategory", &controllers.PlatformComplaintCategoryController{}, "post:Create") - beego.Router("/platform/complaintCategory/:id", &controllers.PlatformComplaintCategoryController{}, "post:Update;delete:Delete") - - // 报销全局通用费项(tid=0,仅平台可维护) - beego.Router("/platform/reimburseExpenseTypes", &controllers.PlatformReimburseExpenseTypeController{}, "get:List;post:Create") - beego.Router("/platform/reimburseExpenseTypes/:id", &controllers.PlatformReimburseExpenseTypeController{}, "post:Update;delete:Delete") - - beego.Router("/platform/complaint/list", &controllers.PlatformComplaintController{}, "get:List") - beego.Router("/platform/complaint", &controllers.PlatformComplaintController{}, "post:Create") - beego.Router("/platform/complaint/:id", &controllers.PlatformComplaintController{}, "get:Detail;post:Update;delete:Delete") - - // 软件升级产品(yz_system_software_upgrade) - beego.Router("/platform/softwareupgrade/list", &controllers.PlatformSoftwareUpgradeController{}, "get:List") - beego.Router("/platform/softwareupgrade", &controllers.PlatformSoftwareUpgradeController{}, "post:Create") - beego.Router("/platform/softwareupgrade/:id", &controllers.PlatformSoftwareUpgradeController{}, "get:Detail;post:Update;delete:Delete") - - // 租户站点设置(yz_tenant_site_setting) - beego.Router("/platform/normalInfos", &controllers.PlatformSiteSettingsController{}, "get:GetNormalInfos") - beego.Router("/platform/saveNormalInfos", &controllers.PlatformSiteSettingsController{}, "post:SaveNormalInfos") - - // 系统邮箱配置(yz_system_email) - beego.Router("/platform/email/info", &controllers.PlatformEmailController{}, "get:GetInfo") - beego.Router("/platform/email/editinfo", &controllers.PlatformEmailController{}, "post:EditInfo") - beego.Router("/platform/email/sendtestemail", &controllers.PlatformEmailController{}, "post:SendTestEmail") - - // 站内信配置与发送(yz_system_sitereminder / yz_system_reminderlist) - beego.Router("/platform/sitereminder/config", &controllers.PlatformSiteReminderController{}, "get:GetConfig;post:SaveConfig") - beego.Router("/platform/sitereminder/send", &controllers.PlatformSiteReminderController{}, "post:Send") - beego.Router("/platform/sitereminder/myList", &controllers.PlatformSiteReminderController{}, "get:GetMyList") - beego.Router("/platform/sitereminder/read", &controllers.PlatformSiteReminderController{}, "post:MarkRead") - beego.Router("/platform/sitereminder/readall", &controllers.PlatformSiteReminderController{}, "post:MarkAllRead") - beego.Router("/platform/sitereminder/delete", &controllers.PlatformSiteReminderController{}, "post:Delete") - beego.Router("/platform/sitereminder/sentList", &controllers.PlatformSiteReminderController{}, "get:GetSentList") - beego.Router("/platform/sitereminder/updateSent", &controllers.PlatformSiteReminderController{}, "post:UpdateSent") - beego.Router("/platform/sitereminder/deleteSent", &controllers.PlatformSiteReminderController{}, "post:DeleteSentBatch") - - // 短信配置(yz_system_sms) - beego.Router("/platform/sms/info", &controllers.PlatformSMSController{}, "get:GetSmsInfo") - beego.Router("/platform/sms/editinfo", &controllers.PlatformSMSController{}, "post:EditSmsInfo") - beego.Router("/platform/sms/sendtest", &controllers.PlatformSMSController{}, "post:SendTestSms") - beego.Router("/platform/sms/taskList", &controllers.PlatformSMSController{}, "get:GetSmsTaskList") - beego.Router("/platform/sms/taskEdit/:id", &controllers.PlatformSMSController{}, "post:EditSmsTask") - - // Bark 推送配置 - beego.Router("/platform/bark/info", &controllers.PlatformBarkController{}, "get:GetBarkInfo") - beego.Router("/platform/bark/editinfo", &controllers.PlatformBarkController{}, "post:EditBarkInfo") - beego.Router("/platform/bark/sendtest", &controllers.PlatformBarkController{}, "post:SendTestBark") - - // 文件管理(yz_system_files / yz_system_files_category) - beego.Router("/platform/usercate", &controllers.PlatformFileController{}, "get:GetUserCate") - beego.Router("/platform/allfiles", &controllers.PlatformFileController{}, "get:GetAllFiles") - beego.Router("/platform/catefiles/:id", &controllers.PlatformFileController{}, "get:GetCateFiles") - beego.Router("/platform/file/:id", &controllers.PlatformFileController{}, "get:GetFileByID") - beego.Router("/platform/deletefilepermanently/:id", &controllers.PlatformFileController{}, "delete:DeleteFilePermanently") - beego.Router("/platform/uploadfile", &controllers.PlatformFileController{}, "post:UploadFile") - beego.Router("/platform/uploadfiles", &controllers.PlatformFileController{}, "post:UploadFile") - beego.Router("/platform/updatefile/:id", &controllers.PlatformFileController{}, "post:UpdateFile") - beego.Router("/platform/deletefile/:id", &controllers.PlatformFileController{}, "delete:DeleteFile") - beego.Router("/platform/movefile/:id", &controllers.PlatformFileController{}, "get:MoveFile") - beego.Router("/platform/createfilecate", &controllers.PlatformFileController{}, "post:CreateFileCate") - beego.Router("/platform/renamefilecate/:id", &controllers.PlatformFileController{}, "post:RenameFileCate") - beego.Router("/platform/deletefilecate/:id", &controllers.PlatformFileController{}, "delete:DeleteFileCate") - beego.Router("/platform/uploadavatar", &controllers.PlatformFileController{}, "post:UploadAvatar") - beego.Router("/platform/uploadavatar/:id", &controllers.PlatformFileController{}, "post:UpdateAvatar") - beego.Router("/platform/batchdeletefiles", &controllers.PlatformFileController{}, "post:BatchDeleteFiles") - beego.Router("/platform/batchDeleteFilesPermanently", &controllers.PlatformFileController{}, "post:BatchDeleteFilesPermanently") - beego.Router("/platform/batchMoveFiles", &controllers.PlatformFileController{}, "post:BatchMoveFiles") - - // 七牛云直传相关 - beego.Router("/platform/storage/config", &controllers.QiniuUploadController{}, "get:GetStorageConfig") - beego.Router("/platform/qiniu/token", &controllers.QiniuUploadController{}, "get:GetUploadToken") - beego.Router("/platform/qiniu/save", &controllers.QiniuUploadController{}, "post:SaveFileRecord") - - // 首页统计 - beego.Router("/platform/home/accountPoolDailyExtract", &controllers.PlatformHomeController{}, "get:AccountPoolDailyExtract") - beego.Router("/platform/home/accountPoolInventoryTotals", &controllers.PlatformHomeController{}, "get:AccountPoolInventoryTotals") - - // Cursor 设备管理(yz_platform_cursor_equipment) - beego.Router("/platform/cursor/equipment/list", &controllers.PlatformCursorEquipmentController{}, "get:List") - beego.Router("/platform/cursor/equipment/stats", &controllers.PlatformCursorEquipmentController{}, "get:Stats") - beego.Router("/platform/cursor/equipment/detail/:id", &controllers.PlatformCursorEquipmentController{}, "get:Detail") - beego.Router("/platform/cursor/equipment/add", &controllers.PlatformCursorEquipmentController{}, "post:Add") - beego.Router("/platform/cursor/equipment/update", &controllers.PlatformCursorEquipmentController{}, "post:Update") - beego.Router("/platform/cursor/equipment/delete/:id", &controllers.PlatformCursorEquipmentController{}, "post:Delete") - beego.Router("/platform/cursor/equipment/activate", &controllers.PlatformCursorEquipmentController{}, "post:Activate") - beego.Router("/platform/cursor/equipment/activationRecords", &controllers.PlatformCursorEquipmentController{}, "get:ActivationRecords") - beego.Router("/platform/cursor/equipment/extractRecords", &controllers.PlatformCursorEquipmentController{}, "get:ExtractRecords") - beego.Router("/platform/cursor/equipment/ipLogs", &controllers.PlatformCursorEquipmentController{}, "get:IpLogs") - - // Cursor 激活码管理(yz_platform_cursor_activation_code) - beego.Router("/platform/cursor/activationcode/list", &controllers.PlatformCursorActivationCodeController{}, "get:List") - beego.Router("/platform/cursor/activationcode/detail/:id", &controllers.PlatformCursorActivationCodeController{}, "get:Detail") - beego.Router("/platform/cursor/activationcode/add", &controllers.PlatformCursorActivationCodeController{}, "post:Add") - beego.Router("/platform/cursor/activationcode/update", &controllers.PlatformCursorActivationCodeController{}, "post:Update") - beego.Router("/platform/cursor/activationcode/delete/:id", &controllers.PlatformCursorActivationCodeController{}, "post:Delete") - beego.Router("/platform/cursor/activationcode/generate", &controllers.PlatformCursorActivationCodeController{}, "post:Generate") - beego.Router("/platform/cursor/activationcode/enable/:id", &controllers.PlatformCursorActivationCodeController{}, "post:Enable") - beego.Router("/platform/cursor/activationcode/disable/:id", &controllers.PlatformCursorActivationCodeController{}, "post:Disable") - beego.Router("/platform/cursor/activationcode/export", &controllers.PlatformCursorActivationCodeController{}, "get:Export") - - // 账号池管理(cursor/windsurf/krio/codex) - beego.Router("/platform/accountPool/cursor/list", &controllers.PlatformAccountPoolCursorController{}, "get:List") - beego.Router("/platform/accountPool/cursor/add", &controllers.PlatformAccountPoolCursorController{}, "post:Add") - beego.Router("/platform/accountPool/cursor/batchAdd", &controllers.PlatformAccountPoolCursorController{}, "post:BatchAdd") - beego.Router("/platform/accountPool/cursor/detail/:id", &controllers.PlatformAccountPoolCursorController{}, "get:Detail") - beego.Router("/platform/accountPool/cursor/extract", &controllers.PlatformAccountPoolCursorController{}, "post:Extract") - beego.Router("/platform/accountPool/cursor/updateRemark", &controllers.PlatformAccountPoolCursorController{}, "post:UpdateRemark") - beego.Router("/platform/accountPool/cursor/setUnavailable", &controllers.PlatformAccountPoolCursorController{}, "post:SetUnavailable") - beego.Router("/platform/accountPool/cursor/updateUsable", &controllers.PlatformAccountPoolCursorController{}, "post:UpdateUsable") - beego.Router("/platform/accountPool/cursor/updatePlatform", &controllers.PlatformAccountPoolCursorController{}, "post:UpdatePlatform") - beego.Router("/platform/accountPool/cursor/unextract", &controllers.PlatformAccountPoolCursorController{}, "post:Unextract") - beego.Router("/platform/accountPool/cursor/replenish", &controllers.PlatformAccountPoolCursorController{}, "post:Replenish") - beego.Router("/platform/accountPool/cursor/probeToken", &controllers.PlatformAccountPoolCursorController{}, "post:ProbeToken") - - beego.Router("/platform/accountPool/windsurf/list", &controllers.PlatformAccountPoolWindsurfController{}, "get:List") - beego.Router("/platform/accountPool/windsurf/add", &controllers.PlatformAccountPoolWindsurfController{}, "post:Add") - beego.Router("/platform/accountPool/windsurf/batchAdd", &controllers.PlatformAccountPoolWindsurfController{}, "post:BatchAdd") - beego.Router("/platform/accountPool/windsurf/detail/:id", &controllers.PlatformAccountPoolWindsurfController{}, "get:Detail") - beego.Router("/platform/accountPool/windsurf/extract", &controllers.PlatformAccountPoolWindsurfController{}, "post:Extract") - beego.Router("/platform/accountPool/windsurf/updateRemark", &controllers.PlatformAccountPoolWindsurfController{}, "post:UpdateRemark") - beego.Router("/platform/accountPool/windsurf/setUnavailable", &controllers.PlatformAccountPoolWindsurfController{}, "post:SetUnavailable") - beego.Router("/platform/accountPool/windsurf/updatePlatform", &controllers.PlatformAccountPoolWindsurfController{}, "post:UpdatePlatform") - beego.Router("/platform/accountPool/windsurf/unextract", &controllers.PlatformAccountPoolWindsurfController{}, "post:Unextract") - beego.Router("/platform/accountPool/windsurf/replenish", &controllers.PlatformAccountPoolWindsurfController{}, "post:Replenish") - beego.Router("/platform/accountPool/windsurf/probeToken", &controllers.PlatformAccountPoolWindsurfController{}, "post:ProbeToken") - - beego.Router("/platform/accountPool/krio/list", &controllers.PlatformAccountPoolKrioController{}, "get:List") - beego.Router("/platform/accountPool/krio/add", &controllers.PlatformAccountPoolKrioController{}, "post:Add") - beego.Router("/platform/accountPool/krio/batchAdd", &controllers.PlatformAccountPoolKrioController{}, "post:BatchAdd") - beego.Router("/platform/accountPool/krio/detail/:id", &controllers.PlatformAccountPoolKrioController{}, "get:Detail") - beego.Router("/platform/accountPool/krio/extract", &controllers.PlatformAccountPoolKrioController{}, "post:Extract") - beego.Router("/platform/accountPool/krio/updateRemark", &controllers.PlatformAccountPoolKrioController{}, "post:UpdateRemark") - beego.Router("/platform/accountPool/krio/setUnavailable", &controllers.PlatformAccountPoolKrioController{}, "post:SetUnavailable") - beego.Router("/platform/accountPool/krio/updatePlatform", &controllers.PlatformAccountPoolKrioController{}, "post:UpdatePlatform") - beego.Router("/platform/accountPool/krio/unextract", &controllers.PlatformAccountPoolKrioController{}, "post:Unextract") - beego.Router("/platform/accountPool/krio/replenish", &controllers.PlatformAccountPoolKrioController{}, "post:Replenish") - beego.Router("/platform/accountPool/krio/probeToken", &controllers.PlatformAccountPoolKrioController{}, "post:ProbeToken") - - beego.Router("/platform/accountPool/codex/list", &controllers.PlatformAccountPoolCodexController{}, "get:List") - beego.Router("/platform/accountPool/codex/add", &controllers.PlatformAccountPoolCodexController{}, "post:Add") - beego.Router("/platform/accountPool/codex/batchAdd", &controllers.PlatformAccountPoolCodexController{}, "post:BatchAdd") - beego.Router("/platform/accountPool/codex/detail/:id", &controllers.PlatformAccountPoolCodexController{}, "get:Detail") - beego.Router("/platform/accountPool/codex/extract", &controllers.PlatformAccountPoolCodexController{}, "post:Extract") - beego.Router("/platform/accountPool/codex/updateRemark", &controllers.PlatformAccountPoolCodexController{}, "post:UpdateRemark") - beego.Router("/platform/accountPool/codex/setUnavailable", &controllers.PlatformAccountPoolCodexController{}, "post:SetUnavailable") - beego.Router("/platform/accountPool/codex/updatePlatform", &controllers.PlatformAccountPoolCodexController{}, "post:UpdatePlatform") - beego.Router("/platform/accountPool/codex/unextract", &controllers.PlatformAccountPoolCodexController{}, "post:Unextract") - beego.Router("/platform/accountPool/codex/replenish", &controllers.PlatformAccountPoolCodexController{}, "post:Replenish") - beego.Router("/platform/accountPool/codex/probeToken", &controllers.PlatformAccountPoolCodexController{}, "post:ProbeToken") - - // 记事本管理 - beego.Router("/platform/notebook/list", &controllers.PlatformNotebookController{}, "get:List") - beego.Router("/platform/notebook/detail/:id", &controllers.PlatformNotebookController{}, "get:Detail") - beego.Router("/platform/notebook/create", &controllers.PlatformNotebookController{}, "post:Create") - beego.Router("/platform/notebook/update/:id", &controllers.PlatformNotebookController{}, "post:Update") - beego.Router("/platform/notebook/delete/:id", &controllers.PlatformNotebookController{}, "delete:Delete") - - // 智能体API管理(yz_platform_agent_api) - // 注意:固定路径需先于 /:id 通配路径注册,避免 list/test/batchDelete 被当作 ID 解析 - beego.Router("/platform/agentApi/list", &controllers.PlatformAgentApiController{}, "get:List") - beego.Router("/platform/agentApi/test", &controllers.PlatformAgentApiController{}, "post:Test") - beego.Router("/platform/agentApi/batchDelete", &controllers.PlatformAgentApiController{}, "post:BatchDelete") - beego.Router("/platform/agentApi", &controllers.PlatformAgentApiController{}, "post:Create") - beego.Router("/platform/agentApi/:id/status", &controllers.PlatformAgentApiController{}, "post:ToggleStatus") - beego.Router("/platform/agentApi/:id", &controllers.PlatformAgentApiController{}, "get:Detail;put:Update;delete:Delete") - - // 日程提醒管理 - beego.Router("/platform/reminder/list", &controllers.PlatformReminderController{}, "get:GetReminderList") - beego.Router("/platform/reminder/test", &controllers.PlatformReminderController{}, "post:TestReminder") - beego.Router("/platform/reminder/:id", &controllers.PlatformReminderController{}, "get:GetReminderDetail;put:UpdateReminder;delete:DeleteReminder") - beego.Router("/platform/reminder", &controllers.PlatformReminderController{}, "post:CreateReminder") - beego.Router("/platform/reminder/batchDelete", &controllers.PlatformReminderController{}, "post:BatchDeleteReminder") - - // 官网模板管理(上传/扫描登记/在线编辑/启停删除 + 标签调用说明) - beego.Router("/platform/template/index", &controllers.PlatformTemplateController{}, "get:Index") - beego.Router("/platform/template/scan", &controllers.PlatformTemplateController{}, "post:Scan") - beego.Router("/platform/template/upload", &controllers.PlatformTemplateController{}, "post:Upload") - beego.Router("/platform/template/files/:code", &controllers.PlatformTemplateController{}, "get:Files") - beego.Router("/platform/template/file", &controllers.PlatformTemplateController{}, "get:ReadFile") - beego.Router("/platform/template/file/save", &controllers.PlatformTemplateController{}, "post:SaveFile") - beego.Router("/platform/template/status", &controllers.PlatformTemplateController{}, "post:Status") - beego.Router("/platform/template/delete/:id", &controllers.PlatformTemplateController{}, "post:Delete") - beego.Router("/platform/template/tags", &controllers.PlatformTemplateController{}, "get:Tags") -} +package platform + +import ( + "server/controllers" + + beego "github.com/beego/beego/v2/server/web" +) + +// Register 注册平台端路由 +func Register() { + // 平台登录相关 + beego.Router("/platform/login", &controllers.PlatformAuthController{}, "post:LoginPlatform") + beego.Router("/platform/currentUser", &controllers.PlatformAuthController{}, "get:GetCurrentUser") + beego.Router("/platform/sendLoginCode", &controllers.PlatformAuthController{}, "post:SendLoginCode") + beego.Router("/platform/loginBySms", &controllers.PlatformAuthController{}, "post:LoginBySms") + beego.Router("/platform/logout", &controllers.PlatformAuthController{}, "post:Logout") + + // 极验与登录验证配置 + beego.Router("/platform/login/getGeetest3Infos", &controllers.PlatformAuthController{}, "get:GetGeetest3Infos") + beego.Router("/platform/login/getGeetest4Infos", &controllers.PlatformAuthController{}, "get:GetGeetest4Infos") + beego.Router("/platform/login/getOpenVerify", &controllers.PlatformAuthController{}, "get:GetOpenVerify") + beego.Router("/platform/loginVerifyInfos", &controllers.PlatformLoginVerifyController{}, "get:GetLoginVerifyInfos") + beego.Router("/platform/saveloginVerifyInfos", &controllers.PlatformLoginVerifyController{}, "post:SaveLoginVerifyInfos") + + // 存储配置 + beego.Router("/platform/storageConfig", &controllers.StorageConfigController{}, "get:GetStorageConfig") + beego.Router("/platform/saveStorageConfig", &controllers.StorageConfigController{}, "post:SaveStorageConfig") + + // 存储迁移 + beego.Router("/platform/storage/migrateToQiniu", &controllers.StorageMigrationController{}, "post:MigrateToQiniu") + beego.Router("/platform/storage/migrationProgress", &controllers.StorageMigrationController{}, "get:GetMigrationProgress") + + // 找回密码相关 + beego.Router("/platform/resetPassword", &controllers.PlatformAuthController{}, "post:ResetPassword") + beego.Router("/platform/sendResetCode", &controllers.PlatformAuthController{}, "post:SendResetCode") + + // 平台菜单配置相关 + beego.Router("/platform/menu/:id", &controllers.AdminMenuController{}, "get:GetMenu") + beego.Router("/platform/allmenu", &controllers.AdminMenuController{}, "get:GetAllMenus") + beego.Router("/platform/menu/status/:id", &controllers.AdminMenuController{}, "patch:UpdateMenuStatus") + beego.Router("/platform/createmenu", &controllers.AdminMenuController{}, "post:CreateMenu") + beego.Router("/platform/updatemenu/:id", &controllers.AdminMenuController{}, "put:UpdateMenu") + beego.Router("/platform/deletemenu/:id", &controllers.AdminMenuController{}, "delete:DeleteMenu") + + // 平台租户管理相关 + beego.Router("/platform/tenant/getTenant", &controllers.PlatformTenantController{}, "get:GetTenant") + beego.Router("/platform/tenant/getTenantDetail/:id", &controllers.PlatformTenantController{}, "get:GetTenantDetail") + beego.Router("/platform/tenant/createTenant", &controllers.PlatformTenantController{}, "post:CreateTenant") + beego.Router("/platform/tenant/editTenant/:id", &controllers.PlatformTenantController{}, "post:EditTenant") + beego.Router("/platform/tenant/deleteTenant/:id", &controllers.PlatformTenantController{}, "delete:DeleteTenant") + beego.Router("/platform/tenant/findTenantCode", &controllers.PlatformTenantController{}, "get:FindTenantCode") + + // 平台租户用户绑定相关 + beego.Router("/platform/getTenantUsers/:tid", &controllers.PlatformTenantUserController{}, "get:GetTenantUsersByTid") + beego.Router("/platform/tenantUser/list", &controllers.PlatformTenantUserController{}, "get:GetTenantUserList") + beego.Router("/platform/tenantUser/detail/:id", &controllers.PlatformTenantUserController{}, "get:GetTenantUserDetail") + beego.Router("/platform/tenantUser/create", &controllers.PlatformTenantUserController{}, "post:CreateTenantUser") + beego.Router("/platform/tenantUser/edit/:id", &controllers.PlatformTenantUserController{}, "post:EditTenantUser") + beego.Router("/platform/tenantUser/delete/:id", &controllers.PlatformTenantUserController{}, "delete:DeleteTenantUser") + + // 平台管理员用户管理(yz_system_admin_user) + beego.Router("/platform/getAllUsers", &controllers.PlatformAdminUserController{}, "get:GetAllUsers") + beego.Router("/platform/getUserInfo/:id", &controllers.PlatformAdminUserController{}, "get:GetUserInfo") + beego.Router("/platform/addUser", &controllers.PlatformAdminUserController{}, "post:AddUser") + beego.Router("/platform/editUser/:id", &controllers.PlatformAdminUserController{}, "post:EditUser") + beego.Router("/platform/deleteUser/:id", &controllers.PlatformAdminUserController{}, "delete:DeleteUser") + beego.Router("/platform/changePassword", &controllers.PlatformAdminUserController{}, "post:ChangePassword") + + // 平台角色管理(yz_system_admin_role) + beego.Router("/platform/allRoles", &controllers.PlatformRoleController{}, "get:GetAllRoles") + beego.Router("/platform/roles/:id", &controllers.PlatformRoleController{}, "get:GetRoleByID") + beego.Router("/platform/roles", &controllers.PlatformRoleController{}, "post:CreateRole") + beego.Router("/platform/roles/:id", &controllers.PlatformRoleController{}, "put:UpdateRole") + beego.Router("/platform/roles/:id", &controllers.PlatformRoleController{}, "delete:DeleteRole") + + // 操作日志(yz_system_operation_log) + beego.Router("/platform/operationLogs", &controllers.PlatformOperationLogController{}, "get:List") + beego.Router("/platform/operationLogs/statistics", &controllers.PlatformOperationLogController{}, "get:Statistics") + beego.Router("/platform/operationLogs/:id", &controllers.PlatformOperationLogController{}, "get:Detail;delete:Delete") + beego.Router("/platform/operationLogs/batchDelete", &controllers.PlatformOperationLogController{}, "post:BatchDelete") + + // 登录日志(yz_system_login_log) + beego.Router("/platform/loginLogs", &controllers.PlatformLoginLogController{}, "get:List") + beego.Router("/platform/loginLogs/batchDelete", &controllers.PlatformLoginLogController{}, "post:BatchDelete") + beego.Router("/platform/loginLogs/:id", &controllers.PlatformLoginLogController{}, "get:Detail;delete:Delete") + + // 域名管理(主域名池 / 租户域名) + beego.Router("/platform/domain/pool/index", &controllers.PlatformDomainPoolController{}, "get:Index") + beego.Router("/platform/domain/pool/getEnabledDomains", &controllers.PlatformDomainPoolController{}, "get:GetEnabledDomains") + beego.Router("/platform/domain/pool/create", &controllers.PlatformDomainPoolController{}, "post:Create") + beego.Router("/platform/domain/pool/update", &controllers.PlatformDomainPoolController{}, "post:Update") + beego.Router("/platform/domain/pool/delete/:id", &controllers.PlatformDomainPoolController{}, "delete:Delete") + beego.Router("/platform/domain/pool/toggleStatus", &controllers.PlatformDomainPoolController{}, "post:ToggleStatus") + + beego.Router("/platform/domain/tenant/index", &controllers.PlatformTenantDomainController{}, "get:Index") + beego.Router("/platform/domain/tenant/myDomains", &controllers.PlatformTenantDomainController{}, "get:MyDomains") + beego.Router("/platform/domain/tenant/apply", &controllers.PlatformTenantDomainController{}, "post:Apply") + beego.Router("/platform/domain/tenant/audit", &controllers.PlatformTenantDomainController{}, "post:Audit") + beego.Router("/platform/domain/tenant/toggleStatus", &controllers.PlatformTenantDomainController{}, "post:ToggleStatus") + beego.Router("/platform/domain/tenant/delete/:id", &controllers.PlatformTenantDomainController{}, "delete:Delete") + + // 模块管理(yz_system_modules) + beego.Router("/platform/modules/list", &controllers.PlatformModulesController{}, "get:GetList") + beego.Router("/platform/modules/getTenantList", &controllers.PlatformModulesController{}, "get:GetTenantList") + beego.Router("/platform/modules/select/list", &controllers.PlatformModulesController{}, "get:GetSelectList") + beego.Router("/platform/modules/status", &controllers.PlatformModulesController{}, "post:ChangeStatus") + beego.Router("/platform/modules/batchDelete", &controllers.PlatformModulesController{}, "post:BatchDelete") + beego.Router("/platform/modules", &controllers.PlatformModulesController{}, "post:Add") + beego.Router("/platform/modules/:id", &controllers.PlatformModulesController{}, "get:GetDetail;put:Edit;delete:Delete") + + // 投诉建议(yz_system_complaint_category / yz_system_platform_complaint) + beego.Router("/platform/complaintCategory/list", &controllers.PlatformComplaintCategoryController{}, "get:List") + beego.Router("/platform/complaintCategory/select", &controllers.PlatformComplaintCategoryController{}, "get:SelectList") + beego.Router("/platform/complaintCategory", &controllers.PlatformComplaintCategoryController{}, "post:Create") + beego.Router("/platform/complaintCategory/:id", &controllers.PlatformComplaintCategoryController{}, "post:Update;delete:Delete") + + // 报销全局通用费项(tid=0,仅平台可维护) + beego.Router("/platform/reimburseExpenseTypes", &controllers.PlatformReimburseExpenseTypeController{}, "get:List;post:Create") + beego.Router("/platform/reimburseExpenseTypes/:id", &controllers.PlatformReimburseExpenseTypeController{}, "post:Update;delete:Delete") + + beego.Router("/platform/complaint/list", &controllers.PlatformComplaintController{}, "get:List") + beego.Router("/platform/complaint", &controllers.PlatformComplaintController{}, "post:Create") + beego.Router("/platform/complaint/:id", &controllers.PlatformComplaintController{}, "get:Detail;post:Update;delete:Delete") + + // 软件升级产品(yz_system_software_upgrade) + beego.Router("/platform/softwareupgrade/list", &controllers.PlatformSoftwareUpgradeController{}, "get:List") + beego.Router("/platform/softwareupgrade", &controllers.PlatformSoftwareUpgradeController{}, "post:Create") + beego.Router("/platform/softwareupgrade/:id", &controllers.PlatformSoftwareUpgradeController{}, "get:Detail;post:Update;delete:Delete") + + // 租户站点设置(yz_tenant_site_setting) + beego.Router("/platform/normalInfos", &controllers.PlatformSiteSettingsController{}, "get:GetNormalInfos") + beego.Router("/platform/saveNormalInfos", &controllers.PlatformSiteSettingsController{}, "post:SaveNormalInfos") + + // 系统邮箱配置(yz_system_email) + beego.Router("/platform/email/info", &controllers.PlatformEmailController{}, "get:GetInfo") + beego.Router("/platform/email/editinfo", &controllers.PlatformEmailController{}, "post:EditInfo") + beego.Router("/platform/email/sendtestemail", &controllers.PlatformEmailController{}, "post:SendTestEmail") + + // 站内信配置与发送(yz_system_sitereminder / yz_system_reminderlist) + beego.Router("/platform/sitereminder/config", &controllers.PlatformSiteReminderController{}, "get:GetConfig;post:SaveConfig") + beego.Router("/platform/sitereminder/send", &controllers.PlatformSiteReminderController{}, "post:Send") + beego.Router("/platform/sitereminder/myList", &controllers.PlatformSiteReminderController{}, "get:GetMyList") + beego.Router("/platform/sitereminder/read", &controllers.PlatformSiteReminderController{}, "post:MarkRead") + beego.Router("/platform/sitereminder/readall", &controllers.PlatformSiteReminderController{}, "post:MarkAllRead") + beego.Router("/platform/sitereminder/delete", &controllers.PlatformSiteReminderController{}, "post:Delete") + beego.Router("/platform/sitereminder/sentList", &controllers.PlatformSiteReminderController{}, "get:GetSentList") + beego.Router("/platform/sitereminder/updateSent", &controllers.PlatformSiteReminderController{}, "post:UpdateSent") + beego.Router("/platform/sitereminder/deleteSent", &controllers.PlatformSiteReminderController{}, "post:DeleteSentBatch") + + // 短信配置(yz_system_sms) + beego.Router("/platform/sms/info", &controllers.PlatformSMSController{}, "get:GetSmsInfo") + beego.Router("/platform/sms/editinfo", &controllers.PlatformSMSController{}, "post:EditSmsInfo") + beego.Router("/platform/sms/sendtest", &controllers.PlatformSMSController{}, "post:SendTestSms") + beego.Router("/platform/sms/taskList", &controllers.PlatformSMSController{}, "get:GetSmsTaskList") + beego.Router("/platform/sms/taskEdit/:id", &controllers.PlatformSMSController{}, "post:EditSmsTask") + + // Bark 推送配置 + beego.Router("/platform/bark/info", &controllers.PlatformBarkController{}, "get:GetBarkInfo") + beego.Router("/platform/bark/editinfo", &controllers.PlatformBarkController{}, "post:EditBarkInfo") + beego.Router("/platform/bark/sendtest", &controllers.PlatformBarkController{}, "post:SendTestBark") + + // 文件管理(yz_system_files / yz_system_files_category) + beego.Router("/platform/usercate", &controllers.PlatformFileController{}, "get:GetUserCate") + beego.Router("/platform/allfiles", &controllers.PlatformFileController{}, "get:GetAllFiles") + beego.Router("/platform/catefiles/:id", &controllers.PlatformFileController{}, "get:GetCateFiles") + beego.Router("/platform/file/:id", &controllers.PlatformFileController{}, "get:GetFileByID") + beego.Router("/platform/deletefilepermanently/:id", &controllers.PlatformFileController{}, "delete:DeleteFilePermanently") + beego.Router("/platform/uploadfile", &controllers.PlatformFileController{}, "post:UploadFile") + beego.Router("/platform/uploadfiles", &controllers.PlatformFileController{}, "post:UploadFile") + beego.Router("/platform/updatefile/:id", &controllers.PlatformFileController{}, "post:UpdateFile") + beego.Router("/platform/deletefile/:id", &controllers.PlatformFileController{}, "delete:DeleteFile") + beego.Router("/platform/movefile/:id", &controllers.PlatformFileController{}, "get:MoveFile") + beego.Router("/platform/createfilecate", &controllers.PlatformFileController{}, "post:CreateFileCate") + beego.Router("/platform/renamefilecate/:id", &controllers.PlatformFileController{}, "post:RenameFileCate") + beego.Router("/platform/deletefilecate/:id", &controllers.PlatformFileController{}, "delete:DeleteFileCate") + beego.Router("/platform/uploadavatar", &controllers.PlatformFileController{}, "post:UploadAvatar") + beego.Router("/platform/uploadavatar/:id", &controllers.PlatformFileController{}, "post:UpdateAvatar") + beego.Router("/platform/batchdeletefiles", &controllers.PlatformFileController{}, "post:BatchDeleteFiles") + beego.Router("/platform/batchDeleteFilesPermanently", &controllers.PlatformFileController{}, "post:BatchDeleteFilesPermanently") + beego.Router("/platform/batchMoveFiles", &controllers.PlatformFileController{}, "post:BatchMoveFiles") + + // 七牛云直传相关 + beego.Router("/platform/storage/config", &controllers.QiniuUploadController{}, "get:GetStorageConfig") + beego.Router("/platform/qiniu/token", &controllers.QiniuUploadController{}, "get:GetUploadToken") + beego.Router("/platform/qiniu/save", &controllers.QiniuUploadController{}, "post:SaveFileRecord") + + // 首页统计 + beego.Router("/platform/home/accountPoolDailyExtract", &controllers.PlatformHomeController{}, "get:AccountPoolDailyExtract") + beego.Router("/platform/home/accountPoolInventoryTotals", &controllers.PlatformHomeController{}, "get:AccountPoolInventoryTotals") + + // Cursor 设备管理(yz_platform_cursor_equipment) + beego.Router("/platform/cursor/equipment/list", &controllers.PlatformCursorEquipmentController{}, "get:List") + beego.Router("/platform/cursor/equipment/stats", &controllers.PlatformCursorEquipmentController{}, "get:Stats") + beego.Router("/platform/cursor/equipment/detail/:id", &controllers.PlatformCursorEquipmentController{}, "get:Detail") + beego.Router("/platform/cursor/equipment/add", &controllers.PlatformCursorEquipmentController{}, "post:Add") + beego.Router("/platform/cursor/equipment/update", &controllers.PlatformCursorEquipmentController{}, "post:Update") + beego.Router("/platform/cursor/equipment/delete/:id", &controllers.PlatformCursorEquipmentController{}, "post:Delete") + beego.Router("/platform/cursor/equipment/activate", &controllers.PlatformCursorEquipmentController{}, "post:Activate") + beego.Router("/platform/cursor/equipment/activationRecords", &controllers.PlatformCursorEquipmentController{}, "get:ActivationRecords") + beego.Router("/platform/cursor/equipment/extractRecords", &controllers.PlatformCursorEquipmentController{}, "get:ExtractRecords") + beego.Router("/platform/cursor/equipment/ipLogs", &controllers.PlatformCursorEquipmentController{}, "get:IpLogs") + + // Cursor 激活码管理(yz_platform_cursor_activation_code) + beego.Router("/platform/cursor/activationcode/list", &controllers.PlatformCursorActivationCodeController{}, "get:List") + beego.Router("/platform/cursor/activationcode/detail/:id", &controllers.PlatformCursorActivationCodeController{}, "get:Detail") + beego.Router("/platform/cursor/activationcode/add", &controllers.PlatformCursorActivationCodeController{}, "post:Add") + beego.Router("/platform/cursor/activationcode/update", &controllers.PlatformCursorActivationCodeController{}, "post:Update") + beego.Router("/platform/cursor/activationcode/delete/:id", &controllers.PlatformCursorActivationCodeController{}, "post:Delete") + beego.Router("/platform/cursor/activationcode/generate", &controllers.PlatformCursorActivationCodeController{}, "post:Generate") + beego.Router("/platform/cursor/activationcode/enable/:id", &controllers.PlatformCursorActivationCodeController{}, "post:Enable") + beego.Router("/platform/cursor/activationcode/disable/:id", &controllers.PlatformCursorActivationCodeController{}, "post:Disable") + beego.Router("/platform/cursor/activationcode/export", &controllers.PlatformCursorActivationCodeController{}, "get:Export") + + // 账号池管理(cursor/windsurf/krio/codex) + beego.Router("/platform/accountPool/cursor/list", &controllers.PlatformAccountPoolCursorController{}, "get:List") + beego.Router("/platform/accountPool/cursor/add", &controllers.PlatformAccountPoolCursorController{}, "post:Add") + beego.Router("/platform/accountPool/cursor/batchAdd", &controllers.PlatformAccountPoolCursorController{}, "post:BatchAdd") + beego.Router("/platform/accountPool/cursor/detail/:id", &controllers.PlatformAccountPoolCursorController{}, "get:Detail") + beego.Router("/platform/accountPool/cursor/extract", &controllers.PlatformAccountPoolCursorController{}, "post:Extract") + beego.Router("/platform/accountPool/cursor/updateRemark", &controllers.PlatformAccountPoolCursorController{}, "post:UpdateRemark") + beego.Router("/platform/accountPool/cursor/setUnavailable", &controllers.PlatformAccountPoolCursorController{}, "post:SetUnavailable") + beego.Router("/platform/accountPool/cursor/updateUsable", &controllers.PlatformAccountPoolCursorController{}, "post:UpdateUsable") + beego.Router("/platform/accountPool/cursor/updatePlatform", &controllers.PlatformAccountPoolCursorController{}, "post:UpdatePlatform") + beego.Router("/platform/accountPool/cursor/unextract", &controllers.PlatformAccountPoolCursorController{}, "post:Unextract") + beego.Router("/platform/accountPool/cursor/replenish", &controllers.PlatformAccountPoolCursorController{}, "post:Replenish") + beego.Router("/platform/accountPool/cursor/probeToken", &controllers.PlatformAccountPoolCursorController{}, "post:ProbeToken") + + beego.Router("/platform/accountPool/windsurf/list", &controllers.PlatformAccountPoolWindsurfController{}, "get:List") + beego.Router("/platform/accountPool/windsurf/add", &controllers.PlatformAccountPoolWindsurfController{}, "post:Add") + beego.Router("/platform/accountPool/windsurf/batchAdd", &controllers.PlatformAccountPoolWindsurfController{}, "post:BatchAdd") + beego.Router("/platform/accountPool/windsurf/detail/:id", &controllers.PlatformAccountPoolWindsurfController{}, "get:Detail") + beego.Router("/platform/accountPool/windsurf/extract", &controllers.PlatformAccountPoolWindsurfController{}, "post:Extract") + beego.Router("/platform/accountPool/windsurf/updateRemark", &controllers.PlatformAccountPoolWindsurfController{}, "post:UpdateRemark") + beego.Router("/platform/accountPool/windsurf/setUnavailable", &controllers.PlatformAccountPoolWindsurfController{}, "post:SetUnavailable") + beego.Router("/platform/accountPool/windsurf/updatePlatform", &controllers.PlatformAccountPoolWindsurfController{}, "post:UpdatePlatform") + beego.Router("/platform/accountPool/windsurf/unextract", &controllers.PlatformAccountPoolWindsurfController{}, "post:Unextract") + beego.Router("/platform/accountPool/windsurf/replenish", &controllers.PlatformAccountPoolWindsurfController{}, "post:Replenish") + beego.Router("/platform/accountPool/windsurf/probeToken", &controllers.PlatformAccountPoolWindsurfController{}, "post:ProbeToken") + + beego.Router("/platform/accountPool/krio/list", &controllers.PlatformAccountPoolKrioController{}, "get:List") + beego.Router("/platform/accountPool/krio/add", &controllers.PlatformAccountPoolKrioController{}, "post:Add") + beego.Router("/platform/accountPool/krio/batchAdd", &controllers.PlatformAccountPoolKrioController{}, "post:BatchAdd") + beego.Router("/platform/accountPool/krio/detail/:id", &controllers.PlatformAccountPoolKrioController{}, "get:Detail") + beego.Router("/platform/accountPool/krio/extract", &controllers.PlatformAccountPoolKrioController{}, "post:Extract") + beego.Router("/platform/accountPool/krio/updateRemark", &controllers.PlatformAccountPoolKrioController{}, "post:UpdateRemark") + beego.Router("/platform/accountPool/krio/setUnavailable", &controllers.PlatformAccountPoolKrioController{}, "post:SetUnavailable") + beego.Router("/platform/accountPool/krio/updatePlatform", &controllers.PlatformAccountPoolKrioController{}, "post:UpdatePlatform") + beego.Router("/platform/accountPool/krio/unextract", &controllers.PlatformAccountPoolKrioController{}, "post:Unextract") + beego.Router("/platform/accountPool/krio/replenish", &controllers.PlatformAccountPoolKrioController{}, "post:Replenish") + beego.Router("/platform/accountPool/krio/probeToken", &controllers.PlatformAccountPoolKrioController{}, "post:ProbeToken") + + beego.Router("/platform/accountPool/codex/list", &controllers.PlatformAccountPoolCodexController{}, "get:List") + beego.Router("/platform/accountPool/codex/add", &controllers.PlatformAccountPoolCodexController{}, "post:Add") + beego.Router("/platform/accountPool/codex/batchAdd", &controllers.PlatformAccountPoolCodexController{}, "post:BatchAdd") + beego.Router("/platform/accountPool/codex/detail/:id", &controllers.PlatformAccountPoolCodexController{}, "get:Detail") + beego.Router("/platform/accountPool/codex/extract", &controllers.PlatformAccountPoolCodexController{}, "post:Extract") + beego.Router("/platform/accountPool/codex/updateRemark", &controllers.PlatformAccountPoolCodexController{}, "post:UpdateRemark") + beego.Router("/platform/accountPool/codex/setUnavailable", &controllers.PlatformAccountPoolCodexController{}, "post:SetUnavailable") + beego.Router("/platform/accountPool/codex/updatePlatform", &controllers.PlatformAccountPoolCodexController{}, "post:UpdatePlatform") + beego.Router("/platform/accountPool/codex/unextract", &controllers.PlatformAccountPoolCodexController{}, "post:Unextract") + beego.Router("/platform/accountPool/codex/replenish", &controllers.PlatformAccountPoolCodexController{}, "post:Replenish") + beego.Router("/platform/accountPool/codex/probeToken", &controllers.PlatformAccountPoolCodexController{}, "post:ProbeToken") + + // 记事本管理 + beego.Router("/platform/notebook/list", &controllers.PlatformNotebookController{}, "get:List") + beego.Router("/platform/notebook/detail/:id", &controllers.PlatformNotebookController{}, "get:Detail") + beego.Router("/platform/notebook/create", &controllers.PlatformNotebookController{}, "post:Create") + beego.Router("/platform/notebook/update/:id", &controllers.PlatformNotebookController{}, "post:Update") + beego.Router("/platform/notebook/delete/:id", &controllers.PlatformNotebookController{}, "delete:Delete") + + // 密码存储管理 + beego.Router("/platform/passwordStore/list", &controllers.PlatformPasswordStoreController{}, "get:List") + beego.Router("/platform/passwordStore/detail/:id", &controllers.PlatformPasswordStoreController{}, "get:Detail") + beego.Router("/platform/passwordStore/create", &controllers.PlatformPasswordStoreController{}, "post:Create") + beego.Router("/platform/passwordStore/update/:id", &controllers.PlatformPasswordStoreController{}, "post:Update") + beego.Router("/platform/passwordStore/delete/:id", &controllers.PlatformPasswordStoreController{}, "delete:Delete") + + // 智能体API管理(yz_platform_agent_api) + // 注意:固定路径需先于 /:id 通配路径注册,避免 list/test/batchDelete 被当作 ID 解析 + beego.Router("/platform/agentApi/list", &controllers.PlatformAgentApiController{}, "get:List") + beego.Router("/platform/agentApi/test", &controllers.PlatformAgentApiController{}, "post:Test") + beego.Router("/platform/agentApi/batchDelete", &controllers.PlatformAgentApiController{}, "post:BatchDelete") + beego.Router("/platform/agentApi", &controllers.PlatformAgentApiController{}, "post:Create") + beego.Router("/platform/agentApi/:id/status", &controllers.PlatformAgentApiController{}, "post:ToggleStatus") + beego.Router("/platform/agentApi/:id", &controllers.PlatformAgentApiController{}, "get:Detail;put:Update;delete:Delete") + + // 日程提醒管理 + beego.Router("/platform/reminder/list", &controllers.PlatformReminderController{}, "get:GetReminderList") + beego.Router("/platform/reminder/test", &controllers.PlatformReminderController{}, "post:TestReminder") + beego.Router("/platform/reminder/:id", &controllers.PlatformReminderController{}, "get:GetReminderDetail;put:UpdateReminder;delete:DeleteReminder") + beego.Router("/platform/reminder", &controllers.PlatformReminderController{}, "post:CreateReminder") + beego.Router("/platform/reminder/batchDelete", &controllers.PlatformReminderController{}, "post:BatchDeleteReminder") + + // 官网模板管理(上传/扫描登记/在线编辑/启停删除 + 标签调用说明) + beego.Router("/platform/template/index", &controllers.PlatformTemplateController{}, "get:Index") + beego.Router("/platform/template/scan", &controllers.PlatformTemplateController{}, "post:Scan") + beego.Router("/platform/template/upload", &controllers.PlatformTemplateController{}, "post:Upload") + beego.Router("/platform/template/files/:code", &controllers.PlatformTemplateController{}, "get:Files") + beego.Router("/platform/template/file", &controllers.PlatformTemplateController{}, "get:ReadFile") + beego.Router("/platform/template/file/save", &controllers.PlatformTemplateController{}, "post:SaveFile") + beego.Router("/platform/template/status", &controllers.PlatformTemplateController{}, "post:Status") + beego.Router("/platform/template/delete/:id", &controllers.PlatformTemplateController{}, "post:Delete") + beego.Router("/platform/template/tags", &controllers.PlatformTemplateController{}, "get:Tags") +} diff --git a/platform/src/api/passwordStore.js b/platform/src/api/passwordStore.js new file mode 100644 index 0000000..753ed85 --- /dev/null +++ b/platform/src/api/passwordStore.js @@ -0,0 +1,8 @@ +import request from '@/utils/request' + +const resource = '/platform/passwordStore' +export const getPasswordStoreList = (params) => request({ url: `${resource}/list`, method: 'get', params }) +export const getPasswordStoreDetail = (id) => request({ url: `${resource}/detail/${id}`, method: 'get' }) +export const createPasswordStore = (data) => request({ url: `${resource}/create`, method: 'post', data }) +export const updatePasswordStore = (id, data) => request({ url: `${resource}/update/${id}`, method: 'post', data }) +export const deletePasswordStore = (id) => request({ url: `${resource}/delete/${id}`, method: 'delete' }) diff --git a/platform/src/router/index.js b/platform/src/router/index.js index 952a3c1..a0bfdf2 100644 --- a/platform/src/router/index.js +++ b/platform/src/router/index.js @@ -21,6 +21,12 @@ const staticMainChildren = [ component: () => import("@/views/system/email/index.vue"), meta: { requiresAuth: true, title: "邮箱管理" } }, + { + path: "/tools/passwordStore", + name: "PlatformPasswordStore", + component: () => import("@/views/tools/passwordStore/index.vue"), + meta: { requiresAuth: true, title: "密码存储" } + }, { path: "/template/index", name: "PlatformTemplateManage", diff --git a/platform/src/views/tools/passwordStore/index.vue b/platform/src/views/tools/passwordStore/index.vue new file mode 100644 index 0000000..7c4ebe8 --- /dev/null +++ b/platform/src/views/tools/passwordStore/index.vue @@ -0,0 +1,1170 @@ + + + + + diff --git a/sql/alter_password_store_to_multi_accounts.sql b/sql/alter_password_store_to_multi_accounts.sql new file mode 100644 index 0000000..a041376 --- /dev/null +++ b/sql/alter_password_store_to_multi_accounts.sql @@ -0,0 +1,78 @@ +-- ============================================================ +-- 密码存储:单账号结构 -> 一个平台挂载多个账号(accounts JSON) +-- +-- 使用说明: +-- 1. 先备份: +-- mysqldump -u用户 -p 库名 yz_platform_password_store yz_backend_password_store > pwd_backup.sql +-- 2. 按顺序执行下面的「第 1 步」「第 2 步」「第 3 步」。 +-- 3. 如果某条 ALTER 报 "Duplicate column name 'accounts'",说明该列已存在, +-- 忽略该条错误继续往下执行即可。 +-- 4. 「第 4 步」删除旧列不可逆,确认页面数据显示正常后再手动执行。 +-- ============================================================ + + +-- ---------- 第 1 步:新增 accounts 列 ---------- +-- 报 Duplicate column name 表示已加过,忽略即可。 + +ALTER TABLE `yz_platform_password_store` + ADD COLUMN `accounts` longtext NULL + COMMENT '账号列表JSON: [{"username":"","password":"","registration_info":"","remark":""}]' + AFTER `url`; + +ALTER TABLE `yz_backend_password_store` + ADD COLUMN `accounts` longtext NULL + COMMENT '账号列表JSON: [{"username":"","password":"","registration_info":"","remark":""}]' + AFTER `url`; + +-- 旧表可能没有 delete_time 列,模型里有该字段,一并补上。 +-- 报 Duplicate column name 同样忽略。 +ALTER TABLE `yz_platform_password_store` ADD COLUMN `delete_time` datetime NULL; +ALTER TABLE `yz_backend_password_store` ADD COLUMN `delete_time` datetime NULL; + + +-- ---------- 第 2 步:把旧的单账号数据搬进 accounts ---------- +-- 只处理 accounts 仍为空、且旧列确实有内容的行,包装成只含一条账号的 JSON 数组。 +-- 如果报 Unknown column 'username',说明旧列已经删掉了,无需迁移,跳过这两条。 + +UPDATE `yz_platform_password_store` + SET `accounts` = JSON_ARRAY(JSON_OBJECT( + 'username', IFNULL(`username`, ''), + 'password', IFNULL(`password`, ''), + 'registration_info', IFNULL(`registration_info`, ''), + 'remark', '' + )) + WHERE (`accounts` IS NULL OR `accounts` = '' OR `accounts` = '[]') + AND (IFNULL(`username`, '') <> '' + OR IFNULL(`password`, '') <> '' + OR IFNULL(`registration_info`, '') <> ''); + +UPDATE `yz_backend_password_store` + SET `accounts` = JSON_ARRAY(JSON_OBJECT( + 'username', IFNULL(`username`, ''), + 'password', IFNULL(`password`, ''), + 'registration_info', IFNULL(`registration_info`, ''), + 'remark', '' + )) + WHERE (`accounts` IS NULL OR `accounts` = '' OR `accounts` = '[]') + AND (IFNULL(`username`, '') <> '' + OR IFNULL(`password`, '') <> '' + OR IFNULL(`registration_info`, '') <> ''); + + +-- ---------- 第 3 步:accounts 为空的行统一补成空数组 ---------- + +UPDATE `yz_platform_password_store` SET `accounts` = '[]' + WHERE `accounts` IS NULL OR `accounts` = ''; + +UPDATE `yz_backend_password_store` SET `accounts` = '[]' + WHERE `accounts` IS NULL OR `accounts` = ''; + + +-- ---------- 第 4 步(可选,不可逆):删除旧的单账号列 ---------- +-- 先在页面上确认历史数据都能正常显示,再手动执行下面两条。 +-- 旧表这三列是 NOT NULL DEFAULT '',不删也不影响新代码运行。 + +-- ALTER TABLE `yz_platform_password_store` +-- DROP COLUMN `username`, DROP COLUMN `password`, DROP COLUMN `registration_info`; +-- ALTER TABLE `yz_backend_password_store` +-- DROP COLUMN `username`, DROP COLUMN `password`, DROP COLUMN `registration_info`; diff --git a/sql/yz_password_store.sql b/sql/yz_password_store.sql new file mode 100644 index 0000000..13d8477 --- /dev/null +++ b/sql/yz_password_store.sql @@ -0,0 +1,37 @@ +-- 平台端和租户后台密码存储表。支持一个平台下挂载多个账号(每个账号包含账号、密码、注册信息、备注)。 +CREATE TABLE IF NOT EXISTS `yz_platform_password_store` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `platform` varchar(100) NOT NULL DEFAULT '' COMMENT '平台名称', + `url` varchar(500) NOT NULL DEFAULT '' COMMENT '平台网址/登录地址', + `accounts` longtext COMMENT '账号列表JSON: [{"username":"","password":"","registration_info":"","remark":""}]', + `remark` text COMMENT '平台备注', + `user_id` bigint unsigned NOT NULL COMMENT '所属用户ID', + `is_deleted` tinyint NOT NULL DEFAULT 0, + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `update_time` datetime DEFAULT NULL, + `delete_time` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx_platform_user` (`platform`,`user_id`), + KEY `idx_user_deleted` (`user_id`,`is_deleted`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台密码存储'; + +CREATE TABLE IF NOT EXISTS `yz_backend_password_store` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `tid` bigint NOT NULL COMMENT '租户ID', + `platform` varchar(100) NOT NULL DEFAULT '' COMMENT '平台名称', + `url` varchar(500) NOT NULL DEFAULT '' COMMENT '平台网址/登录地址', + `accounts` longtext COMMENT '账号列表JSON: [{"username":"","password":"","registration_info":"","remark":""}]', + `remark` text COMMENT '平台备注', + `user_id` bigint unsigned NOT NULL COMMENT '所属用户ID', + `is_deleted` tinyint NOT NULL DEFAULT 0, + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `update_time` datetime DEFAULT NULL, + `delete_time` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `idx_tid_user` (`tid`,`user_id`), + KEY `idx_tid_platform` (`tid`,`platform`), + KEY `idx_tid_deleted` (`tid`,`is_deleted`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='租户密码存储'; + +-- 已经按旧的「单账号」结构建过表的库,请执行 +-- sql/alter_password_store_to_multi_accounts.sql 完成升级与数据迁移。