更新密码找回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

+7 -40
View File
@@ -14,12 +14,6 @@ import (
beego "github.com/beego/beego/v2/server/web"
)
// BackendSiteSettingsController 租户站点设置(站点基本信息)
// 对应前端 normalSettings.vue 的:
// - GET /backend/normalInfos
// - POST /backend/saveNormalInfos
// - GET /platform/normalInfos
// - POST /platform/saveNormalInfos
type BackendSiteSettingsController struct {
beego.Controller
}
@@ -74,7 +68,6 @@ type backendNormalInfosOutput struct {
Ico string `json:"ico"`
}
// GetNormalInfos GET /backend/normalInfos 或 /platform/normalInfos
func (c *BackendSiteSettingsController) GetNormalInfos() {
claims, err := c.claimsByPath()
if err != nil {
@@ -83,7 +76,6 @@ func (c *BackendSiteSettingsController) GetNormalInfos() {
return
}
// 归属租户由 resolveBackendTenantID 统一裁决(backend 端只认令牌)
tid := c.resolveBackendTenantID(claims, nil)
out := backendNormalInfosOutput{
@@ -98,7 +90,6 @@ func (c *BackendSiteSettingsController) GetNormalInfos() {
Ico: "",
}
// tid 缺失时不报错,直接返回空对象给前端渲染(避免 UI 直接崩)。
if tid == 0 {
c.Data["json"] = map[string]interface{}{"code": 200, "msg": "success", "data": out}
_ = c.ServeJSON()
@@ -128,7 +119,6 @@ func (c *BackendSiteSettingsController) GetNormalInfos() {
out.Icp = r.Icp
}
// 扩展字段(企业简称 / 企业英文名称 / 企业英文简称)存放在 yz_system_tenant_setting_items
if ext, eerr := c.getBackendSettingItems(tid, []string{
"company_short_name", "company_english_name", "company_english_short_name",
}); eerr == nil {
@@ -141,30 +131,20 @@ func (c *BackendSiteSettingsController) GetNormalInfos() {
_ = c.ServeJSON()
}
// backendBrandOutput 后台顶栏品牌(Logo 优先用平台配置)
type backendBrandOutput struct {
Sitename string `json:"sitename"` // 主标题
Subtitle string `json:"subtitle"` // 副标题
Sitename string `json:"sitename"`
Subtitle string `json:"subtitle"`
Intro string `json:"intro"`
Ico string `json:"ico"` // 浏览器标签页图标(favicon)
LogoSquare string `json:"logoSquare"` // 正方形 Logo(浅色主题 / 顶栏小图标)
LogoRect string `json:"logoRect"` // 长方形 Logo(浅色主题 / 横向品牌图)
Logo string `json:"logo"` // 官网深色 Logo(浅色背景)
Logow string `json:"logow"` // 官网浅色 Logo(深色背景)
Ico string `json:"ico"`
LogoSquare string `json:"logoSquare"`
LogoRect string `json:"logoRect"`
Logo string `json:"logo"`
Logow string `json:"logow"`
// 深色主题专用 Logo:留空时前端回退到上面的浅色主题版本
LogoSquareDark string `json:"logoSquareDark"`
LogoRectDark string `json:"logoRectDark"`
}
// GetBrand GET /backend/brand 后台顶栏品牌信息(顶栏左上角 Logo / 站点名 / 简介)
// 取值优先级:
// 1. 平台「系统设置 - 平台设置 - 平台信息」(logo_square / logo_rect / sitename / platform_intro)
// 2. 平台「官网管理 - 站点设置」(yz_platform_site_setting:logo 深色 / logow 浅色)
// 3. 平台「平台设置 - 登录页设置」的 login_logo(仅在以上都没配 logo 时兜底)
// 4. 当前租户自己的站点设置(yz_tenant_site_setting,租户在 backend「站点设置」上传的图片)
//
// 都没有配置时返回空串,前端保留内置的品牌占位标记。
func (c *BackendSiteSettingsController) GetBrand() {
claims, err := c.claimsByPath()
if err != nil {
@@ -193,7 +173,6 @@ func (c *BackendSiteSettingsController) GetBrand() {
out.Logo = out.LogoRect
}
// 平台未配置的项回落到租户站点设置,避免顶栏退化成占位标记
if out.Logo == "" || out.Logow == "" || out.Sitename == "" {
if tid := c.resolveBackendTenantID(claims, nil); tid > 0 {
var rows []models.TenantSiteSetting
@@ -221,7 +200,6 @@ func (c *BackendSiteSettingsController) GetBrand() {
}
type backendNormalInfosPayload struct {
// 前端会传 tid(但我们仍优先使用 token 的 tenant_id)
Tid interface{} `json:"tid"`
Sitename string `json:"sitename"`
@@ -238,7 +216,6 @@ type backendNormalInfosPayload struct {
Icp string `json:"icp"`
}
// SaveNormalInfos POST /backend/saveNormalInfos 或 /platform/saveNormalInfos
func (c *BackendSiteSettingsController) SaveNormalInfos() {
claims, err := c.claimsByPath()
if err != nil {
@@ -327,7 +304,6 @@ func (c *BackendSiteSettingsController) SaveNormalInfos() {
}
}
// 扩展字段(企业简称 / 企业英文名称 / 企业英文简称)
if err = c.saveBackendSettingItems(tid, map[string]string{
"company_short_name": strings.TrimSpace(p.CompanyShortName),
"company_english_name": strings.TrimSpace(p.CompanyEnglishName),
@@ -341,9 +317,6 @@ func (c *BackendSiteSettingsController) SaveNormalInfos() {
_ = c.ServeJSON()
}
// resolveBackendTenantID 取站点设置归属租户:
// - backend 路径只认登录态,忽略 ?tid= 与请求体里的 tid——否则改一个参数就能读写别的企业站点设置;
// - platform 路径下平台管理员令牌的 tenant_id 为 0,需要按参数指定要维护哪家企业。
func (c *BackendSiteSettingsController) resolveBackendTenantID(claims *jwtutil.Claims, payloadTid interface{}) uint64 {
if claims != nil && claims.TenantId > 0 {
return uint64(claims.TenantId)
@@ -396,7 +369,6 @@ ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value), update_time = NOW
return nil
}
// GetLegalInfos GET /backend/legalInfos
func (c *BackendSiteSettingsController) GetLegalInfos() {
claims, err := c.claimsByPath()
if err != nil {
@@ -434,7 +406,6 @@ type backendLegalInfosPayload struct {
PrivacyTerms string `json:"privacyTerms"`
}
// SaveLegalInfos POST /backend/saveLegalInfos
func (c *BackendSiteSettingsController) SaveLegalInfos() {
claims, err := c.claimsByPath()
if err != nil {
@@ -473,7 +444,6 @@ func (c *BackendSiteSettingsController) SaveLegalInfos() {
_ = c.ServeJSON()
}
// GetCompanyInfos GET /backend/companyInfos
func (c *BackendSiteSettingsController) GetCompanyInfos() {
claims, err := c.claimsByPath()
if err != nil {
@@ -531,7 +501,6 @@ type backendCompanyInfosPayload struct {
Worktime string `json:"worktime"`
}
// SaveCompanyInfos POST /backend/saveCompanyInfos
func (c *BackendSiteSettingsController) SaveCompanyInfos() {
claims, err := c.claimsByPath()
if err != nil {
@@ -576,7 +545,6 @@ func (c *BackendSiteSettingsController) SaveCompanyInfos() {
_ = c.ServeJSON()
}
// GetCompanySeo GET /backend/companySeo
func (c *BackendSiteSettingsController) GetCompanySeo() {
claims, err := c.claimsByPath()
if err != nil {
@@ -617,7 +585,6 @@ type backendCompanySeoPayload struct {
SeoDescription string `json:"seoDescription"`
}
// SaveCompanySeo POST /backend/saveCompanySeo
func (c *BackendSiteSettingsController) SaveCompanySeo() {
claims, err := c.claimsByPath()
if err != nil {