58 lines
1.0 KiB
Go
58 lines
1.0 KiB
Go
|
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 {
|
||
|
StartDay string `form:"start_day"`
|
||
|
EndDay string `form:"end_day"`
|
||
|
}
|
||
|
|
||
|
type Checkin struct {
|
||
|
Id string
|
||
|
Username string
|
||
|
Day string
|
||
|
Month string
|
||
|
Exception string
|
||
|
Rawdata string
|
||
|
StartTime string
|
||
|
EndTime string
|
||
|
CreateTime string
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|