更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -13,12 +13,6 @@ import (
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// =============================================================
|
||||
// 平台官网管理(/platform/website/*)公共工具
|
||||
// 数据表前缀 yz_platform_website_,建表见 docs/sql/create_platform_website.sql
|
||||
// =============================================================
|
||||
|
||||
// websiteAuth 平台管理员鉴权,失败时已写出错误响应,返回 ok=false
|
||||
func websiteAuth(c *beego.Controller) (*jwtutil.Claims, bool) {
|
||||
claims, err := requirePlatform(c)
|
||||
if err != nil {
|
||||
@@ -29,13 +23,11 @@ func websiteAuth(c *beego.Controller) (*jwtutil.Claims, bool) {
|
||||
return claims, true
|
||||
}
|
||||
|
||||
// websiteOK 统一成功响应:{ code:200, msg:"success", data:... }
|
||||
func websiteOK(c *beego.Controller, data interface{}) {
|
||||
c.Data["json"] = map[string]interface{}{"code": 200, "msg": "success", "data": data}
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
// websitePaging 解析分页参数:page 默认 1,pageSize 默认 10(兼容 limit),上限 200
|
||||
func websitePaging(c *beego.Controller) (int, int) {
|
||||
page, _ := c.GetInt("page", 1)
|
||||
pageSize, _ := c.GetInt("pageSize", 0)
|
||||
@@ -54,7 +46,6 @@ func websitePaging(c *beego.Controller) (int, int) {
|
||||
return page, pageSize
|
||||
}
|
||||
|
||||
// websiteID 解析路径参数 :id
|
||||
func websiteID(c *beego.Controller) (uint64, bool) {
|
||||
id, err := strconv.ParseUint(c.Ctx.Input.Param(":id"), 10, 64)
|
||||
if err != nil || id == 0 {
|
||||
@@ -64,7 +55,6 @@ func websiteID(c *beego.Controller) (uint64, bool) {
|
||||
return id, true
|
||||
}
|
||||
|
||||
// websiteIntParam 解析整型查询参数,未传或非法时返回 -1(表示不过滤)
|
||||
func websiteIntParam(c *beego.Controller, key string) int {
|
||||
raw := strings.TrimSpace(c.GetString(key))
|
||||
if raw == "" {
|
||||
@@ -77,12 +67,10 @@ func websiteIntParam(c *beego.Controller, key string) int {
|
||||
return v
|
||||
}
|
||||
|
||||
// websiteStatusParam 解析 status 查询参数,未传时返回 -1(表示不过滤)
|
||||
func websiteStatusParam(c *beego.Controller) int {
|
||||
return websiteIntParam(c, "status")
|
||||
}
|
||||
|
||||
// websiteBind 解析 JSON 请求体到 target,失败时已写出 400
|
||||
func websiteBind(c *beego.Controller, target interface{}) bool {
|
||||
body, err := io.ReadAll(c.Ctx.Request.Body)
|
||||
if err != nil {
|
||||
@@ -96,7 +84,6 @@ func websiteBind(c *beego.Controller, target interface{}) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// websiteBindOptional 宽松解析请求体:body 为空或非法时不作响应,调用方按零值处理
|
||||
func websiteBindOptional(c *beego.Controller, target interface{}) {
|
||||
body, err := io.ReadAll(c.Ctx.Request.Body)
|
||||
if err != nil || len(bytes.TrimSpace(body)) == 0 {
|
||||
|
||||
Reference in new issue
Block a user