|
|
@ -10,6 +10,7 @@ import (
|
|
|
|
"miniapp/model/common/request"
|
|
|
|
"miniapp/model/common/request"
|
|
|
|
r "miniapp/model/common/response"
|
|
|
|
r "miniapp/model/common/response"
|
|
|
|
"strconv"
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type TodosApi struct{}
|
|
|
|
type TodosApi struct{}
|
|
|
@ -79,5 +80,27 @@ func (t TodosApi) GetTodayTodos(ctx *gin.Context) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
r.OkWithData(list, ctx)
|
|
|
|
todos := make([]common.UserTodo, 0)
|
|
|
|
|
|
|
|
hour := time.Now().Hour()
|
|
|
|
|
|
|
|
for i := range list {
|
|
|
|
|
|
|
|
//将remind_time截取前两位 转为int
|
|
|
|
|
|
|
|
rt, _ := strconv.Atoi(list[i].RemindTime[:2])
|
|
|
|
|
|
|
|
rt2 := 24
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if i+1 == len(list) {
|
|
|
|
|
|
|
|
rt2, _ = strconv.Atoi(list[len(list)-1].RemindTime[:2])
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
rt2, _ = strconv.Atoi(list[i+1].RemindTime[:2])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if hour >= rt && hour <= rt2 {
|
|
|
|
|
|
|
|
todos = append(todos, list[i])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//删除todos第一个元素
|
|
|
|
|
|
|
|
if len(todos) > 0 {
|
|
|
|
|
|
|
|
todos = todos[1:]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r.OkWithData(todos, ctx)
|
|
|
|
}
|
|
|
|
}
|
|
|
|