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

-20
View File
@@ -16,8 +16,6 @@ import (
beego "github.com/beego/beego/v2/server/web"
)
// BackendOaNoticeController OA通知公告管理。
// 数据按租户 tid 隔离;发布后对租户内所有后台用户可见。
type BackendOaNoticeController struct {
beego.Controller
}
@@ -43,11 +41,9 @@ type oaNoticePayload struct {
NoticeType int8 `json:"notice_type"`
Level int8 `json:"level"`
IsTop int8 `json:"is_top"`
// Publish 为 true 时保存即发布
Publish bool `json:"publish"`
}
// parseOaNoticePayload 读取并校验公告请求体;失败时直接输出错误响应。
func (c *BackendOaNoticeController) parseOaNoticePayload() (oaNoticePayload, bool) {
var payload oaNoticePayload
raw, err := io.ReadAll(c.Ctx.Request.Body)
@@ -78,15 +74,12 @@ func (c *BackendOaNoticeController) parseOaNoticePayload() (oaNoticePayload, boo
return payload, true
}
// noticeBase 租户内未删除公告的基础查询集
func noticeBase(tid int) orm.QuerySeter {
return models.Orm.QueryTable(new(models.OaNotice)).
Filter("is_deleted", 0).
Filter("tid", tid)
}
// List GET /backend/oa/notice/list
// 管理端分页列表,支持 keyword/status/notice_type 筛选;置顶优先,再按发布时间倒序。
func (c *BackendOaNoticeController) List() {
claims, err := c.oaNoticeClaims()
if err != nil {
@@ -138,8 +131,6 @@ func (c *BackendOaNoticeController) List() {
c.ontOk(map[string]interface{}{"list": list, "total": total})
}
// Portal GET /backend/oa/notice/portal
// 工作台/仪表盘用:只返回已发布的公告,置顶优先,取最近 limit 条(默认 5,最多 20)。
func (c *BackendOaNoticeController) Portal() {
claims, err := c.oaNoticeClaims()
if err != nil {
@@ -170,8 +161,6 @@ func (c *BackendOaNoticeController) Portal() {
c.ontOk(map[string]interface{}{"list": list})
}
// Detail GET /backend/oa/notice/detail/:id
// 公告详情,同时累加阅读次数。
func (c *BackendOaNoticeController) Detail() {
claims, err := c.oaNoticeClaims()
if err != nil {
@@ -193,7 +182,6 @@ func (c *BackendOaNoticeController) Detail() {
return
}
// 阅读数自增(并发下允许略有偏差,仅为展示用)
_, _ = models.Orm.Raw(
"UPDATE yz_backend_oa_notice SET read_count = read_count + 1 WHERE id = ?", id).Exec()
item.ReadCount++
@@ -201,7 +189,6 @@ func (c *BackendOaNoticeController) Detail() {
c.ontOk(item)
}
// Create POST /backend/oa/notice/create
func (c *BackendOaNoticeController) Create() {
claims, err := c.oaNoticeClaims()
if err != nil {
@@ -243,8 +230,6 @@ func (c *BackendOaNoticeController) Create() {
c.ontOk(item)
}
// Update POST /backend/oa/notice/update/:id
// 编辑公告内容;已发布的公告编辑后保持发布状态(不改变发布时间)。
func (c *BackendOaNoticeController) Update() {
claims, err := c.oaNoticeClaims()
if err != nil {
@@ -280,7 +265,6 @@ func (c *BackendOaNoticeController) Update() {
item.UpdateTime = &now
fields := []string{"Title", "Content", "NoticeType", "Level", "IsTop", "UpdateTime"}
// 草稿保存时选择"发布"则直接发布
if payload.Publish && item.Status != 1 {
item.Status = 1
item.PublishTime = &now
@@ -295,7 +279,6 @@ func (c *BackendOaNoticeController) Update() {
c.ontOk(item)
}
// Delete DELETE /backend/oa/notice/delete/:id 软删除。
func (c *BackendOaNoticeController) Delete() {
claims, err := c.oaNoticeClaims()
if err != nil {
@@ -325,8 +308,6 @@ func (c *BackendOaNoticeController) Delete() {
c.ontOk(nil)
}
// Publish POST /backend/oa/notice/publish/:id
// 发布 / 下架切换:草稿、已下架 -> 已发布(写入发布时间);已发布 -> 已下架。
func (c *BackendOaNoticeController) Publish() {
claims, err := c.oaNoticeClaims()
if err != nil {
@@ -366,7 +347,6 @@ func (c *BackendOaNoticeController) Publish() {
c.ontOk(map[string]interface{}{"status": item.Status})
}
// Top POST /backend/oa/notice/top/:id 置顶 / 取消置顶切换。
func (c *BackendOaNoticeController) Top() {
claims, err := c.oaNoticeClaims()
if err != nil {