2023-11-02 04:34:46 +08:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
|
|
|
"miniapp/global"
|
|
|
|
"miniapp/model/common"
|
2024-01-11 16:03:51 +08:00
|
|
|
"miniapp/model/common/request"
|
2024-04-26 13:23:20 +08:00
|
|
|
"time"
|
2023-11-02 04:34:46 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type TodesService struct{}
|
|
|
|
|
2024-01-11 16:03:51 +08:00
|
|
|
func (t TodesService) GetUserTodos(notes *request.GetUserNotes) (list []common.UserTodo, err error) {
|
|
|
|
err = global.GVA_DB.Where("user_id = ? and is_finish = ?", notes.UserId, notes.IsFinish).Find(&list).Error
|
2023-11-02 04:34:46 +08:00
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t TodesService) UpdateTodoById(c *common.UserTodo) error {
|
|
|
|
|
|
|
|
return global.GVA_DB.Table("t_user_todo").Where("id = ?", c.ID).Update("is_finish", c.IsFinish).Error
|
|
|
|
}
|
2024-04-26 13:23:20 +08:00
|
|
|
|
|
|
|
// GetTodayTodos 获取今日待办
|
|
|
|
func (t TodesService) GetTodayTodos(notes *request.GetUserNotes) (list []common.UserTodo, err error) {
|
|
|
|
// 获取当前时间
|
|
|
|
nowTime := time.Now().Format("2006-01-02")
|
|
|
|
|
|
|
|
err = global.GVA_DB.Where("user_id = ? and is_finish = 0 and remind_day = ?", notes.UserId, nowTime).Find(&list).Error
|
|
|
|
return
|
|
|
|
}
|