Compare commits

..

3 Commits

Author SHA1 Message Date
Administrator 409b5d193b 修复了time 判断不会变的错误 2024-07-23 13:33:54 +08:00
Administrator c1e13f3f00 20240722 yanghui alawysonline 2024-07-22 11:29:46 +08:00
root 345a907a42 更新 Dockerfile 2024-07-22 00:05:47 +08:00
3 changed files with 8 additions and 29 deletions

View File

@ -2,6 +2,7 @@ FROM alpine:latest
ENV TZ=Asia/Shanghai
USER root
RUN apk --no-cache add tzdata
# 合并复制指令
COPY udeskstate /usr/local/bin/
COPY ./email.json /conf/

View File

@ -50,11 +50,10 @@ func GetSheetName(file string) (remindList, closeList []string, err error) {
//遍历所有工作表的A2格
sheets := f.GetSheetMap()
var sheetName string
var bSheet string //上月sheet
var nowMouth = time.Now().Month().String()
var nowDay = time.Now().Day()
var M = dateToChinese(nowMouth)
for key, s := range sheets {
for _, s := range sheets {
//// 读取A2单元格的值
a2value, err := f.GetCellValue(s, "A2")
if err != nil {
@ -63,42 +62,21 @@ func GetSheetName(file string) (remindList, closeList []string, err error) {
}
//检查月份是否与当前月份相等
//如果与当前时间的月份相等则记录工作表名称
if a2value == M && key != 0 {
if a2value == M {
sheetName = s
bSheet = sheets[key-1]
} else if a2value == M && key == 0 {
sheetName = s
bSheet = ""
}
}
rows, _ := f.GetRows(sheetName)
for i, row := range rows {
log.Printf("按行读取excel中的值:索引:%v,行值:%v\n", i, row)
if i == nowDay && nowDay == 1 {
if i == nowDay {
nowRow := cleanSlice(row)
remindList = append(remindList, nowRow[3], nowRow[4])
log.Println("第一分支判断提醒列表:", remindList)
if len(bSheet) != 0 {
brows, _ := f.GetRows(bSheet)
bMRow := brows[len(brows)-1] //上月最后一天
closeList = append(closeList, cleanSlice(bMRow)[2], cleanSlice(bMRow)[3])
} else if len(bSheet) == 0 {
log.Println("没有上个月的excel或者上个月excel的未按顺序排列")
closeList = append(closeList, "", "")
}
remindList = append(remindList, nowRow[2], nowRow[3])
} else if i == nowDay && nowDay == 2 {
nowRow := cleanSlice(row)
remindList = append(remindList, nowRow[2], nowRow[3])
log.Println("第二分支判断提醒列表:", remindList)
closeList = append(closeList, cleanSlice(rows[nowDay-1])[3], cleanSlice(rows[nowDay-1])[4])
} else if i == nowDay && nowDay != 1 && nowDay != 2 {
nowRow := cleanSlice(row)
remindList = append(remindList, nowRow[2], nowRow[3])
log.Println("第三分支判断提醒列表:", remindList)
closeList = append(closeList, cleanSlice(rows[nowDay-1])[2], cleanSlice(rows[nowDay-1])[3])
} else if i == nowDay-1 {
yesterdayRow := cleanSlice(row)
closeList = append(closeList, yesterdayRow[2], yesterdayRow[3])
}
}
return remindList, closeList, nil

Binary file not shown.