20 lines
432 B
Go
20 lines
432 B
Go
package app
|
|
|
|
import (
|
|
"miniapp/global"
|
|
"miniapp/model/common"
|
|
)
|
|
|
|
type TodesService struct{}
|
|
|
|
func (t TodesService) GetUserTodos(userId uint) (list []common.UserTodo, err error) {
|
|
err = global.GVA_DB.Where("user_id = ?", userId).Find(&list).Error
|
|
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
|
|
}
|