35 lines
867 B
Go
35 lines
867 B
Go
|
package service
|
||
|
|
||
|
import (
|
||
|
"enterprise/common/config"
|
||
|
"enterprise/common/dao"
|
||
|
"enterprise/common/session"
|
||
|
"enterprise/server/api"
|
||
|
CS "enterprise/service"
|
||
|
)
|
||
|
|
||
|
type Checkin struct {
|
||
|
}
|
||
|
|
||
|
func (c *Checkin) List(sess *session.AdminSession, req *api.ListCheckin) (int64, interface{}) {
|
||
|
|
||
|
checkts, total, err := dao.NewCheckinDao().QueryAdmin(req.Page, req.Size, sess.GetCorpId(), req.Username, req.StartDay, req.EndDay)
|
||
|
if err != nil {
|
||
|
panic(config.ErrDb.New().Append(err))
|
||
|
}
|
||
|
items := make([]*api.Checkin, 0)
|
||
|
for _, checkin := range checkts {
|
||
|
ch := new(api.Checkin)
|
||
|
ch.From(checkin)
|
||
|
items = append(items, ch)
|
||
|
}
|
||
|
return total, items
|
||
|
}
|
||
|
|
||
|
func (c *Checkin) Sync(sess *session.AdminSession, req *api.SyncCheckin) {
|
||
|
err := new(CS.Checkin).SyncCheckin(sess.GetCorpId(), req.StartDay, req.EndDay)
|
||
|
if err != nil {
|
||
|
panic(config.ErrInternal.New().Append(err))
|
||
|
}
|
||
|
}
|