nockechin
This commit is contained in:
parent
55aa6f3214
commit
54dfc300c0
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/smbrave/goutil"
|
"github.com/smbrave/goutil"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"gorm.io/gorm/utils"
|
"gorm.io/gorm/utils"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -118,6 +119,7 @@ func (q *AppCheckin) GetCheckinData(startDay, endDay string, userIds []string) (
|
||||||
key := fmt.Sprintf("%s_%s", userid, checkDay)
|
key := fmt.Sprintf("%s_%s", userid, checkDay)
|
||||||
var userData *UserCheckIn = nil
|
var userData *UserCheckIn = nil
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
||||||
if userData, ok = checkData[key]; !ok {
|
if userData, ok = checkData[key]; !ok {
|
||||||
userData = new(UserCheckIn)
|
userData = new(UserCheckIn)
|
||||||
userData.UserId = userid
|
userData.UserId = userid
|
||||||
|
@ -129,11 +131,14 @@ func (q *AppCheckin) GetCheckinData(startDay, endDay string, userIds []string) (
|
||||||
userData.Exception += goutil.If(userData.Exception != "", ",", "")
|
userData.Exception += goutil.If(userData.Exception != "", ",", "")
|
||||||
userData.Exception += checkinType + ":" + exceptionType
|
userData.Exception += checkinType + ":" + exceptionType
|
||||||
}
|
}
|
||||||
userData.Rawdata = goutil.If(userData.Rawdata == "", "", "\n") + goutil.EncodeJSON(dat)
|
|
||||||
|
userData.Rawdata += goutil.If(userData.Rawdata == "", "", "\n") + goutil.EncodeJSON(dat)
|
||||||
if checkinType == "上班打卡" {
|
if checkinType == "上班打卡" {
|
||||||
userData.StartTime = goutil.If(userData.StartTime == 0 || checkinTime < userData.StartTime, checkinTime, userData.StartTime)
|
userData.StartTime = goutil.If(userData.StartTime == 0 || checkinTime < userData.StartTime, checkinTime, userData.StartTime)
|
||||||
|
userData.StartTime = goutil.If(strings.Contains(exceptionType, "未打卡"), 0, userData.StartTime)
|
||||||
} else if checkinType == "下班打卡" {
|
} else if checkinType == "下班打卡" {
|
||||||
userData.EndTime = goutil.If(checkinTime > userData.EndTime, checkinTime, userData.EndTime)
|
userData.EndTime = goutil.If(checkinTime > userData.EndTime, checkinTime, userData.EndTime)
|
||||||
|
userData.EndTime = goutil.If(strings.Contains(exceptionType, "未打卡"), 0, userData.EndTime)
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("不支持的打卡类型:%s %s", checkinType, goutil.EncodeJSON(dat))
|
log.Errorf("不支持的打卡类型:%s %s", checkinType, goutil.EncodeJSON(dat))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue