优化日程和提醒互导功能
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"server/services"
|
||||
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
type BackendReminderController struct {
|
||||
@@ -90,12 +91,16 @@ func (c *BackendReminderController) GetReminderList() {
|
||||
pageSize = 20
|
||||
}
|
||||
|
||||
qs := models.Orm.QueryTable(new(models.BackendSchedule)).
|
||||
Filter("tid", claims.TenantId)
|
||||
|
||||
qs := models.Orm.QueryTable(new(models.BackendSchedule))
|
||||
cond := orm.NewCondition().And("tid", claims.TenantId)
|
||||
if keyword != "" {
|
||||
qs = qs.Filter("content__contains", keyword)
|
||||
// 关键字同时匹配备注(content)与标题(title),兼容关联 OA 工作日程的提醒
|
||||
kwCond := orm.NewCondition().
|
||||
Or("content__contains", keyword).
|
||||
Or("title__contains", keyword)
|
||||
cond = cond.AndCond(kwCond)
|
||||
}
|
||||
qs = qs.SetCond(cond)
|
||||
|
||||
total, _ := qs.Count()
|
||||
|
||||
@@ -127,10 +132,16 @@ func (c *BackendReminderController) GetReminderList() {
|
||||
}
|
||||
}
|
||||
|
||||
// 兼容关联 OA 工作日程的提醒:日程备注(content)可能为空,
|
||||
// 实际描述存在标题(title),此时回退用标题填充内容,避免列表显示空白。
|
||||
displayContent := strings.TrimSpace(s.Content)
|
||||
if displayContent == "" {
|
||||
displayContent = s.Title
|
||||
}
|
||||
item := map[string]interface{}{
|
||||
"id": s.ID,
|
||||
"title": s.Title,
|
||||
"content": s.Content,
|
||||
"content": displayContent,
|
||||
"schedule_time": s.ScheduleTime.Format("2006-01-02 15:04:05"),
|
||||
"remind_channels": channels,
|
||||
"user_id": s.UserID,
|
||||
@@ -209,10 +220,15 @@ func (c *BackendReminderController) GetReminderDetail() {
|
||||
}
|
||||
}
|
||||
|
||||
// 同列表:关联 OA 工作日程的提醒 content 可能为空,回退用 title 填充
|
||||
detailContent := strings.TrimSpace(schedule.Content)
|
||||
if detailContent == "" {
|
||||
detailContent = schedule.Title
|
||||
}
|
||||
data := map[string]interface{}{
|
||||
"id": schedule.ID,
|
||||
"title": schedule.Title,
|
||||
"content": schedule.Content,
|
||||
"content": detailContent,
|
||||
"schedule_time": schedule.ScheduleTime.Format("2006-01-02 15:04:05"),
|
||||
"remind_channels": channels,
|
||||
"receiver_targets": targets,
|
||||
|
||||
Reference in New Issue
Block a user