更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -10,13 +10,6 @@ import (
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// =============================================================
|
||||
// 平台官网 - 导航菜单 /platform/website/nav/*
|
||||
// - 友情链接 /platform/website/link/*
|
||||
// - 单页管理 /platform/website/page/*
|
||||
// 表:yz_platform_website_nav / yz_platform_website_link / yz_platform_website_page
|
||||
// =============================================================
|
||||
|
||||
type PlatformWebsiteNavController struct {
|
||||
beego.Controller
|
||||
}
|
||||
@@ -34,7 +27,6 @@ type platformWebsiteNavPayload struct {
|
||||
Permission *string `json:"permission"`
|
||||
}
|
||||
|
||||
// normalize 按菜单类型规范化字段,并返回校验错误信息
|
||||
func (p *platformWebsiteNavPayload) normalize() (path, componentPath string, errMsg string) {
|
||||
navType := int8(1)
|
||||
if p.Type != nil {
|
||||
@@ -50,7 +42,7 @@ func (p *platformWebsiteNavPayload) normalize() (path, componentPath string, err
|
||||
componentPath = strings.TrimSpace(*p.ComponentPath)
|
||||
}
|
||||
switch navType {
|
||||
case 3: // 外链
|
||||
case 3:
|
||||
if path == "" {
|
||||
return "", "", "外链地址不能为空"
|
||||
}
|
||||
@@ -58,14 +50,14 @@ func (p *platformWebsiteNavPayload) normalize() (path, componentPath string, err
|
||||
return "", "", "外链地址需以 http:// 或 https:// 开头"
|
||||
}
|
||||
componentPath = ""
|
||||
case 2: // 页面
|
||||
case 2:
|
||||
if path == "" {
|
||||
return "", "", "路由地址不能为空"
|
||||
}
|
||||
if componentPath == "" {
|
||||
return "", "", "页面类型需填写组件路径"
|
||||
}
|
||||
default: // 目录 / 单页
|
||||
default:
|
||||
if path == "" {
|
||||
return "", "", "路由地址不能为空"
|
||||
}
|
||||
@@ -74,7 +66,6 @@ func (p *platformWebsiteNavPayload) normalize() (path, componentPath string, err
|
||||
return path, componentPath, ""
|
||||
}
|
||||
|
||||
// List GET /platform/website/nav/list — 全量平铺返回,前端自行组树
|
||||
func (c *PlatformWebsiteNavController) List() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -90,7 +81,6 @@ func (c *PlatformWebsiteNavController) List() {
|
||||
websiteOK(&c.Controller, rows)
|
||||
}
|
||||
|
||||
// Create POST /platform/website/nav
|
||||
func (c *PlatformWebsiteNavController) Create() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -147,7 +137,6 @@ func (c *PlatformWebsiteNavController) Create() {
|
||||
websiteOK(&c.Controller, map[string]interface{}{"id": id})
|
||||
}
|
||||
|
||||
// Update POST /platform/website/nav/:id
|
||||
func (c *PlatformWebsiteNavController) Update() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -161,7 +150,6 @@ func (c *PlatformWebsiteNavController) Update() {
|
||||
return
|
||||
}
|
||||
|
||||
// 类型/路由/组件路径需要联合校验,先取当前记录作为基线
|
||||
var current models.PlatformWebsiteNav
|
||||
if err := models.Orm.QueryTable(new(models.PlatformWebsiteNav)).
|
||||
Filter("id", id).
|
||||
@@ -245,7 +233,6 @@ func (c *PlatformWebsiteNavController) Update() {
|
||||
websiteOK(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// Delete DELETE /platform/website/nav/:id — 有子菜单时禁止删除
|
||||
func (c *PlatformWebsiteNavController) Delete() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -282,10 +269,6 @@ func (c *PlatformWebsiteNavController) Delete() {
|
||||
websiteOK(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// =============================================================
|
||||
// 友情链接
|
||||
// =============================================================
|
||||
|
||||
type PlatformWebsiteLinkController struct {
|
||||
beego.Controller
|
||||
}
|
||||
@@ -299,7 +282,6 @@ type platformWebsiteLinkPayload struct {
|
||||
Status *int8 `json:"status"`
|
||||
}
|
||||
|
||||
// List GET /platform/website/link/list?page&pageSize(limit)&keyword&status
|
||||
func (c *PlatformWebsiteLinkController) List() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -326,7 +308,6 @@ func (c *PlatformWebsiteLinkController) List() {
|
||||
websiteOK(&c.Controller, map[string]interface{}{"list": rows, "total": total})
|
||||
}
|
||||
|
||||
// All GET /platform/website/link/all — 全量(仅启用),供官网/下拉使用
|
||||
func (c *PlatformWebsiteLinkController) All() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -343,7 +324,6 @@ func (c *PlatformWebsiteLinkController) All() {
|
||||
websiteOK(&c.Controller, rows)
|
||||
}
|
||||
|
||||
// Create POST /platform/website/link
|
||||
func (c *PlatformWebsiteLinkController) Create() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -385,7 +365,6 @@ func (c *PlatformWebsiteLinkController) Create() {
|
||||
websiteOK(&c.Controller, map[string]interface{}{"id": id})
|
||||
}
|
||||
|
||||
// Update PUT /platform/website/link/:id — 也支持只传部分字段(如仅 status)
|
||||
func (c *PlatformWebsiteLinkController) Update() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -448,7 +427,6 @@ func (c *PlatformWebsiteLinkController) Update() {
|
||||
websiteOK(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// Delete DELETE /platform/website/link/:id
|
||||
func (c *PlatformWebsiteLinkController) Delete() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -473,7 +451,6 @@ func (c *PlatformWebsiteLinkController) Delete() {
|
||||
websiteOK(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// BatchDelete POST /platform/website/link/batchdelete — body { ids: [] }
|
||||
func (c *PlatformWebsiteLinkController) BatchDelete() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -496,10 +473,6 @@ func (c *PlatformWebsiteLinkController) BatchDelete() {
|
||||
websiteOK(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// =============================================================
|
||||
// 单页管理
|
||||
// =============================================================
|
||||
|
||||
type PlatformWebsitePageController struct {
|
||||
beego.Controller
|
||||
}
|
||||
@@ -512,12 +485,10 @@ type platformWebsitePagePayload struct {
|
||||
Status *int8 `json:"status"`
|
||||
}
|
||||
|
||||
// normalizePath 统一去掉前导斜杠,与前端提交约定保持一致
|
||||
func normalizePath(raw string) string {
|
||||
return strings.Trim(strings.TrimSpace(raw), "/")
|
||||
}
|
||||
|
||||
// All GET /platform/website/page/all — 全量返回
|
||||
func (c *PlatformWebsitePageController) All() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -533,7 +504,6 @@ func (c *PlatformWebsitePageController) All() {
|
||||
websiteOK(&c.Controller, rows)
|
||||
}
|
||||
|
||||
// Get GET /platform/website/page/:id
|
||||
func (c *PlatformWebsitePageController) Get() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -553,7 +523,6 @@ func (c *PlatformWebsitePageController) Get() {
|
||||
websiteOK(&c.Controller, row)
|
||||
}
|
||||
|
||||
// GetByPath GET /platform/website/page/path/:path — 按路径读取单页(平台端独立接口)
|
||||
func (c *PlatformWebsitePageController) GetByPath() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -579,7 +548,6 @@ func (c *PlatformWebsitePageController) GetByPath() {
|
||||
websiteOK(&c.Controller, row)
|
||||
}
|
||||
|
||||
// Create POST /platform/website/page
|
||||
func (c *PlatformWebsitePageController) Create() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -635,7 +603,6 @@ func (c *PlatformWebsitePageController) Create() {
|
||||
websiteOK(&c.Controller, map[string]interface{}{"id": id})
|
||||
}
|
||||
|
||||
// Update POST /platform/website/page/:id
|
||||
func (c *PlatformWebsitePageController) Update() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
@@ -708,7 +675,6 @@ func (c *PlatformWebsitePageController) Update() {
|
||||
websiteOK(&c.Controller, nil)
|
||||
}
|
||||
|
||||
// Delete DELETE /platform/website/page/:id
|
||||
func (c *PlatformWebsitePageController) Delete() {
|
||||
if _, ok := websiteAuth(&c.Controller); !ok {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user