更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

-38
View File
@@ -15,12 +15,10 @@ import (
beego "github.com/beego/beego/v2/server/web"
)
// PlatformDomainPoolController 主域名池管理
type PlatformDomainPoolController struct {
beego.Controller
}
// PlatformTenantDomainController 租户域名管理
type PlatformTenantDomainController struct {
beego.Controller
}
@@ -29,9 +27,6 @@ func requirePlatform(c *beego.Controller) (*jwtutil.Claims, error) {
return identity.Claims(c.Ctx.Request.Header.Get("Authorization"), identity.EndPlatform)
}
// ===== 主域名池 =====
// Index GET /platform/domain/pool/index?page=&pageSize=&main_domain=&status=
func (c *PlatformDomainPoolController) Index() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -101,7 +96,6 @@ func (c *PlatformDomainPoolController) Index() {
_ = c.ServeJSON()
}
// GetEnabledDomains GET /platform/domain/pool/getEnabledDomains
func (c *PlatformDomainPoolController) GetEnabledDomains() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -130,7 +124,6 @@ func (c *PlatformDomainPoolController) GetEnabledDomains() {
_ = c.ServeJSON()
}
// Create POST /platform/domain/pool/create
func (c *PlatformDomainPoolController) Create() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -155,7 +148,6 @@ func (c *PlatformDomainPoolController) Create() {
if p.Status != 0 && p.Status != 1 {
p.Status = 1
}
// 简单去重
cnt, _ := models.Orm.QueryTable(new(models.SystemDomainPool)).
Filter("main_domain", md).
Filter("delete_time__isnull", true).
@@ -173,7 +165,6 @@ func (c *PlatformDomainPoolController) Create() {
_ = c.ServeJSON()
}
// Update POST /platform/domain/pool/update
func (c *PlatformDomainPoolController) Update() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -219,7 +210,6 @@ func (c *PlatformDomainPoolController) Update() {
_ = c.ServeJSON()
}
// Delete DELETE /platform/domain/pool/delete/:id
func (c *PlatformDomainPoolController) Delete() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -249,7 +239,6 @@ func (c *PlatformDomainPoolController) Delete() {
_ = c.ServeJSON()
}
// ToggleStatus POST /platform/domain/pool/toggleStatus body:{id}
func (c *PlatformDomainPoolController) ToggleStatus() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -292,9 +281,6 @@ func (c *PlatformDomainPoolController) ToggleStatus() {
_ = c.ServeJSON()
}
// ===== 租户域名 =====
// Index GET /platform/domain/tenant/index?page=&pageSize=&tid=&status=&sub_domain=
func (c *PlatformTenantDomainController) Index() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -318,7 +304,6 @@ func (c *PlatformTenantDomainController) Index() {
keyword := strings.TrimSpace(c.GetString("sub_domain"))
domainTypeStr := strings.TrimSpace(c.GetString("domain_type"))
// 条件一次性拼好:SetCond 会覆盖 Filter 累积的条件,不能混用
cond := orm.NewCondition().And("delete_time__isnull", true)
if tid > 0 {
cond = cond.And("tid", tid)
@@ -333,7 +318,6 @@ func (c *PlatformTenantDomainController) Index() {
cond = cond.And("domain_type", dt)
}
}
// 关键字同时匹配二级前缀与完整域名:自有域名没有 sub_domain,只能靠 full_domain 命中
if keyword != "" {
cond = cond.AndCond(orm.NewCondition().
Or("sub_domain__icontains", keyword).
@@ -361,8 +345,6 @@ func (c *PlatformTenantDomainController) Index() {
_ = c.ServeJSON()
}
// MyDomains GET /platform/domain/tenant/myDomains?tid=1
// 平台端账号不归属租户,tid 必须显式传入(运营代租户查看)。
func (c *PlatformTenantDomainController) MyDomains() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -388,8 +370,6 @@ func (c *PlatformTenantDomainController) MyDomains() {
_ = c.ServeJSON()
}
// BindCustom POST /platform/domain/tenant/bindCustom body:{tid,domain}
// 平台端代租户绑定自有域名,tid 必传。
func (c *PlatformTenantDomainController) BindCustom() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -419,8 +399,6 @@ func (c *PlatformTenantDomainController) BindCustom() {
_ = c.ServeJSON()
}
// CheckCustomDns POST /platform/domain/tenant/checkCustomDns body:{id}
// 平台端不限制域名归属,可为任意租户触发检测与签发。
func (c *PlatformTenantDomainController) CheckCustomDns() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -446,7 +424,6 @@ func (c *PlatformTenantDomainController) CheckCustomDns() {
_ = c.ServeJSON()
}
// CustomDomainGuide GET /platform/domain/tenant/customDomainGuide
func (c *PlatformTenantDomainController) CustomDomainGuide() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -457,7 +434,6 @@ func (c *PlatformTenantDomainController) CustomDomainGuide() {
_ = c.ServeJSON()
}
// Apply POST /platform/domain/tenant/apply body:{tid,sub_domain,main_domain}
func (c *PlatformTenantDomainController) Apply() {
claims, err := requirePlatform(&c.Controller)
if err != nil {
@@ -498,7 +474,6 @@ func (c *PlatformTenantDomainController) Apply() {
return
}
// 该租户是否已申请过平台二级域名(自有域名单独计数,两者可以共存)
cnt, _ := models.Orm.QueryTable(new(models.SystemTenantDomain)).
Filter("tid", p.Tid).
Filter("domain_type", models.DomainTypePlatformSub).
@@ -509,7 +484,6 @@ func (c *PlatformTenantDomainController) Apply() {
return
}
// 主域名存在且启用
var pool models.SystemDomainPool
if err := models.Orm.QueryTable(new(models.SystemDomainPool)).
Filter("main_domain", main).
@@ -520,7 +494,6 @@ func (c *PlatformTenantDomainController) Apply() {
return
}
// 二级域名是否已被使用(同主域名下)
used, _ := models.Orm.QueryTable(new(models.SystemTenantDomain)).
Filter("sub_domain", sub).
Filter("main_domain", main).
@@ -549,7 +522,6 @@ func (c *PlatformTenantDomainController) Apply() {
jsonErr(&c.Controller, 500, 500, "申请失败: "+err.Error())
return
}
// 进入平台侧审批流(严格:未配置流程/无有效审批人则提交失败并回滚)
if errMsg := submitDomainApprovalChecked(uint64(id), p.Tid, uint64(claims.UserID), claims.Username, full); errMsg != "" {
jsonErr(&c.Controller, 400, 400, errMsg)
return
@@ -558,9 +530,6 @@ func (c *PlatformTenantDomainController) Apply() {
_ = c.ServeJSON()
}
// Audit POST /platform/domain/tenant/audit body:{id,action,comment} action=approve/reject
// 引擎驱动:已配置审批流则走多级流转,仅当前待办人可操作;
// 未配置流程(无在途实例)则回退到单级直改状态,保证兼容。
func (c *PlatformTenantDomainController) Audit() {
claims, err := requirePlatform(&c.Controller)
if err != nil {
@@ -601,7 +570,6 @@ func (c *PlatformTenantDomainController) Audit() {
bizTid = *row.Tid
}
// 严格引擎驱动:必须命中在途实例与当前待办,否则拒绝(已移除单级兼容回退)
msg, code := engineDomainAudit(p.ID, uint64(claims.UserID), pass, p.Comment, bizTid)
if code != 200 {
jsonErr(&c.Controller, code, code, msg)
@@ -611,8 +579,6 @@ func (c *PlatformTenantDomainController) Audit() {
_ = c.ServeJSON()
}
// AuditProgress GET /platform/domain/tenant/audit/progress/:id
// 返回该域名的审批进度(节点 + 各审批人状态),供平台端展示流转。
func (c *PlatformTenantDomainController) AuditProgress() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -624,7 +590,6 @@ func (c *PlatformTenantDomainController) AuditProgress() {
_ = c.ServeJSON()
}
// ToggleStatus POST /platform/domain/tenant/toggleStatus body:{id}
func (c *PlatformTenantDomainController) ToggleStatus() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -658,7 +623,6 @@ func (c *PlatformTenantDomainController) ToggleStatus() {
}
newStatus := 2
if row.Status == 2 {
// 自有域名重新启用要求证书还在,否则启用后访问会报证书错误
if row.DomainType == models.DomainTypeCustom && row.SSLStatus != models.SSLStatusIssued {
jsonErr(&c.Controller, 400, 400, "该域名的 HTTPS 证书未就绪,请先检测解析并等待证书签发")
return
@@ -678,7 +642,6 @@ func (c *PlatformTenantDomainController) ToggleStatus() {
_ = c.ServeJSON()
}
// Delete DELETE /platform/domain/tenant/delete/:id
func (c *PlatformTenantDomainController) Delete() {
if _, err := requirePlatform(&c.Controller); err != nil {
code := identity.Status(err)
@@ -708,5 +671,4 @@ func (c *PlatformTenantDomainController) Delete() {
_ = c.ServeJSON()
}
// 用于复杂筛选时可扩展:当前保留 orm.Condition import,避免被 gofmt 删除
var _ = orm.NewCondition