package worker import ( "enterprise/common/config" "enterprise/common/global" "enterprise/common/model" "fmt" 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, 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())) if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil { log.Errorf("send message error :%s", err.Error()) } }