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

-37
View File
@@ -17,18 +17,12 @@ import (
beego "github.com/beego/beego/v2/server/web"
)
// PlatformDictController 平台端数据字典:字典列表 + 字典项
//
// 表:yz_platform_dict / yz_platform_dict_item(建表 SQL:docs/sql/create_dict.sql)。
// 平台端字典不按租户隔离;租户端字典见 BackendDictController(/backend/dict/*)。
type PlatformDictController struct {
beego.Controller
}
// dictCodeRe 字典编码:字母开头,仅字母/数字/下划线
var dictCodeRe = regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_]{0,99}$`)
// dictTagTypes 字典项标签色(与前端 el-tag 的 type 对齐),空串表示不渲染标签
var dictTagTypes = map[string]bool{
"": true,
"primary": true,
@@ -60,7 +54,6 @@ func (c *PlatformDictController) dictOk(data interface{}, msg string) {
_ = c.ServeJSON()
}
// dictPageSize 统一分页参数处理:page 从 1 开始,pageSize 限制在 1~100
func dictPageSize(c *beego.Controller) (page, pageSize, offset int) {
page, _ = c.GetInt("page", 1)
pageSize, _ = c.GetInt("pageSize", 20)
@@ -122,10 +115,6 @@ func dictPathID(c *beego.Controller) uint64 {
return id
}
/* ---------------- 字典列表 ---------------- */
// ListTypes GET /platform/dict/types
// 参数:page / pageSize / keyword(名称或编码模糊)/ status
func (c *PlatformDictController) ListTypes() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -167,7 +156,6 @@ func (c *PlatformDictController) ListTypes() {
}, "")
}
// CreateType POST /platform/dict/types
func (c *PlatformDictController) CreateType() {
claims, err := c.dictClaims()
if err != nil {
@@ -220,8 +208,6 @@ func (c *PlatformDictController) CreateType() {
c.dictOk(row, "新增成功")
}
// UpdateType PUT /platform/dict/types/:id
// 编码是业务取值依据,不允许修改。
func (c *PlatformDictController) UpdateType() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -266,8 +252,6 @@ func (c *PlatformDictController) UpdateType() {
c.dictOk(row, "保存成功")
}
// DeleteType DELETE /platform/dict/types/:id
// 字典下还有字典项时拒绝删除,避免留下孤儿数据。
func (c *PlatformDictController) DeleteType() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -306,10 +290,6 @@ func (c *PlatformDictController) DeleteType() {
c.dictOk(nil, "删除成功")
}
/* ---------------- 字典项 ---------------- */
// ListItems GET /platform/dict/items
// 参数:dict_id(必填)/ page / pageSize / keyword(名称或值模糊)/ status
func (c *PlatformDictController) ListItems() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -358,7 +338,6 @@ func (c *PlatformDictController) ListItems() {
}, "")
}
// CreateItem POST /platform/dict/items
func (c *PlatformDictController) CreateItem() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -434,8 +413,6 @@ func (c *PlatformDictController) CreateItem() {
c.dictOk(row, "新增成功")
}
// UpdateItem PUT /platform/dict/items/:id
// 字典项值是业务入库值,不允许修改,避免存量数据对不上。
func (c *PlatformDictController) UpdateItem() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -488,7 +465,6 @@ func (c *PlatformDictController) UpdateItem() {
c.dictOk(row, "保存成功")
}
// ToggleItemStatus POST /platform/dict/items/:id/status
func (c *PlatformDictController) ToggleItemStatus() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -531,7 +507,6 @@ func (c *PlatformDictController) ToggleItemStatus() {
c.dictOk(nil, "操作成功")
}
// DeleteItem DELETE /platform/dict/items/:id
func (c *PlatformDictController) DeleteItem() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -561,11 +536,6 @@ func (c *PlatformDictController) DeleteItem() {
c.dictOk(nil, "删除成功")
}
/* ---------------- 业务读取 ---------------- */
// OptionsAll GET /platform/dict/options
// 一次取回全部「启用」字典的字典项,供前端登录后预热缓存:
// 之后页面按任意 dict_code 都能同步读到,新增字典不用改前端。
func (c *PlatformDictController) OptionsAll() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -612,10 +582,6 @@ func (c *PlatformDictController) OptionsAll() {
c.dictOk(map[string]interface{}{"dicts": result}, "")
}
// OptionsBatch POST /platform/dict/options
// 一次取多个字典的启用项,供前端预加载(body: {"codes":["payment_channel",...]})。
// 编码不存在或已停用时返回空数组,前端不必再单独重试。
// 注意:这里刻意与 GET /options/:code 分开成「同段不同方法」,避免静态段与通配段同级。
func (c *PlatformDictController) OptionsBatch() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)
@@ -649,7 +615,6 @@ func (c *PlatformDictController) OptionsBatch() {
return
}
// 先按编码取字典,再按字典ID一次取回全部字典项,避免逐个字典查一轮(N+1)
var dicts []models.PlatformDict
if _, err := models.Orm.QueryTable(new(models.PlatformDict)).
Filter("dict_code__in", codes).
@@ -688,8 +653,6 @@ func (c *PlatformDictController) OptionsBatch() {
c.dictOk(map[string]interface{}{"dicts": result}, "")
}
// Options GET /platform/dict/options/:code
// 业务页面按编码取选项:只返回「字典与字典项都启用」的项,按 sort 升序。
func (c *PlatformDictController) Options() {
if _, err := c.dictClaims(); err != nil {
code := identity.Status(err)