package worker import ( "enterprise/common/config" "enterprise/common/global" "enterprise/common/model" 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) message = append(message, "员工名称:%s", checkin.UserId) message = append(message, "考勤日期:%s", checkin.Day) message = append(message, "开始时间:%s", goutil.TimeToDateTime(checkin.StartTime)) message = append(message, "结束时间:%s", goutil.TimeToDateTime(checkin.EndTime)) message = append(message, "工作时长:%s", (time.Duration(duration) * time.Second).String()) if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil { log.Errorf("send message error :%s", err.Error()) } }