enterprise/worker/autopay.go

35 lines
1.1 KiB
Go
Raw Normal View History

2023-08-04 19:29:13 +08:00
package worker
import (
"enterprise/common/config"
"enterprise/common/global"
"enterprise/common/model"
2023-08-04 20:35:50 +08:00
"fmt"
2023-08-04 19:29:13 +08:00
log "github.com/sirupsen/logrus"
"github.com/smbrave/goutil"
"strings"
"time"
)
func ViewCheckin(checkin *model.Checkin) {
if checkin.Exception != "" {
log.Errorf("execption[%s] %s", checkin.Exception, goutil.EncodeJSON(checkin))
return
}
thresold := config.GetConfig().QyWeixin.CheckinPayThresold
duration := checkin.EndTime - checkin.StartTime
if duration < int64(3600*thresold) {
return
}
message := make([]string, 0)
2023-08-04 20:35:50 +08:00
message = append(message, fmt.Sprintf("员工名称:%s", checkin.UserId))
message = append(message, fmt.Sprintf("考勤日期:%s", checkin.Day))
message = append(message, fmt.Sprintf("开始时间:%s", goutil.TimeToDateTime(checkin.StartTime)))
message = append(message, fmt.Sprintf("结束时间:%s", goutil.TimeToDateTime(checkin.EndTime)))
message = append(message, fmt.Sprintf("工作时长:%s", (time.Duration(duration)*time.Second).String()))
2023-08-04 19:29:13 +08:00
if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
log.Errorf("send message error :%s", err.Error())
}
}