更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

+4 -12
View File
@@ -7,7 +7,6 @@ import (
"server/models"
)
// TestOaAttendPeriodRange 月 / 季 / 年区间换算(含闰年 2 月)。
func TestOaAttendPeriodRange(t *testing.T) {
cases := []struct {
period, anchor, start, end string
@@ -37,7 +36,6 @@ func TestOaAttendPeriodRange(t *testing.T) {
}
}
// TestOaAttendAggregateCards 季度卡与年度卡由月度卡累加得出。
func TestOaAttendAggregateCards(t *testing.T) {
months := make([]oaAttendCard, 0, 12)
for month := 1; month <= 12; month++ {
@@ -61,7 +59,6 @@ func TestOaAttendAggregateCards(t *testing.T) {
}
}
// TestOaShiftWindow 班次时间窗:普通班次与跨天班次都应换算成分钟区间。
func TestOaShiftWindow(t *testing.T) {
start, end, ok := oaShiftWindow("09:00", "18:00")
if !ok || start != 540 || end != 1080 {
@@ -78,7 +75,6 @@ func TestOaShiftWindow(t *testing.T) {
}
}
// TestOaAttendClockInStatus 签到判定:正常 / 迟到 / 过早(不在时段)/ 无排班。
func TestOaAttendClockInStatus(t *testing.T) {
matched := &models.OaAttendance{
WorkStart: "09:00",
@@ -90,10 +86,10 @@ func TestOaAttendClockInStatus(t *testing.T) {
now string
status int8
}{
{"08:55", models.OaAttendClockNormal}, // 容差内早到
{"09:05", models.OaAttendClockNormal}, // 容差内晚到
{"09:30", models.OaAttendClockLate}, // 迟到
{"07:30", models.OaAttendClockOffTime}, // 提前超过 60 分钟
{"08:55", models.OaAttendClockNormal},
{"09:05", models.OaAttendClockNormal},
{"09:30", models.OaAttendClockLate},
{"07:30", models.OaAttendClockOffTime},
}
for _, item := range cases {
now, err := time.ParseInLocation("2006-01-02 15:04", "2026-11-14 "+item.now, time.Local)
@@ -106,7 +102,6 @@ func TestOaAttendClockInStatus(t *testing.T) {
}
}
// 未匹配排班:不阻断打卡,状态记为「无排班」
missing := &models.OaAttendance{MatchStatus: models.OaAttendMatchMissing}
now := time.Date(2026, 11, 14, 9, 0, 0, 0, time.Local)
if status, msg := oaAttendClockInStatus(missing, now); status != models.OaAttendClockNoShift || msg == "" {
@@ -114,7 +109,6 @@ func TestOaAttendClockInStatus(t *testing.T) {
}
}
// TestOaAttendClockOutStatus 签退判定:早退与跨天班次凌晨签退。
func TestOaAttendClockOutStatus(t *testing.T) {
row := &models.OaAttendance{
WorkStart: "09:00",
@@ -131,14 +125,12 @@ func TestOaAttendClockOutStatus(t *testing.T) {
WorkEnd: "06:00",
MatchStatus: models.OaAttendMatchOK,
}
// 跨天班次:次日 06:10 签退应视为正常
nextMorning := time.Date(2026, 11, 15, 6, 10, 0, 0, time.Local)
if status, msg := oaAttendClockOutStatus(night, nextMorning); status != models.OaAttendClockNormal || msg != "" {
t.Errorf("06:10 跨天签退期望正常,得到 %d %q", status, msg)
}
}
// TestOaAttendDayResult 当日考勤结果口径:缺卡 > 无排班 > 迟到 > 早退 > 时段异常 > 未签退 > 正常。
func TestOaAttendDayResult(t *testing.T) {
if _, text := oaAttendDayResult("", 0, "", 0, models.OaAttendMatchMissing); text != "缺卡" {
t.Errorf("未签到应为缺卡,得到 %q", text)