enterprise/server/api/checkin.go

58 lines
1.2 KiB
Go
Raw Normal View History

2025-03-06 17:45:28 +08:00
package api
import (
"enterprise/common/model"
"github.com/smbrave/goutil"
"github.com/spf13/cast"
)
type BaseRequest struct {
Page int `form:"page"`
Size int `form:"size"`
}
func (b *BaseRequest) Default() {
if b.Page <= 0 {
b.Page = 1
}
if b.Size <= 0 {
b.Size = 10
}
}
type ListCheckin struct {
BaseRequest
Username string `form:"username"`
StartDay string `form:"start_day"`
EndDay string `form:"end_day"`
}
type SyncCheckin struct {
2025-03-07 12:22:54 +08:00
StartDay string `json:"start_day"`
EndDay string `json:"end_day"`
2025-03-06 17:45:28 +08:00
}
type Checkin struct {
2025-03-07 20:45:47 +08:00
Id string `json:"id"`
Username string `json:"username"`
Day string `json:"day"`
Month string `json:"month"`
Exception string `json:"exception"`
Rawdata string `json:"rawdata"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
CreateTime string `json:"create_time"`
2025-03-06 17:45:28 +08:00
}
func (c *Checkin) From(m *model.Checkin) {
c.Id = cast.ToString(m.Id)
c.Username = m.Username
c.Day = m.Day
c.Month = m.Month
c.StartTime = goutil.TimeToDateTime(m.StartTime)
c.StartTime = goutil.TimeToDateTime(m.EndTime)
c.CreateTime = goutil.TimeToDateTime(m.CreateTime)
c.Exception = m.Exception
c.Rawdata = m.Rawdata
}