mirror of
https://github.com/ZSCNetSupportDept/scheduler.git
synced 2025-10-28 20:45:05 +08:00
现在StartTime需要是周一
This commit is contained in:
@@ -10,6 +10,6 @@ DB:
|
|||||||
#[business]
|
#[business]
|
||||||
Session: "2024-2025" #学年
|
Session: "2024-2025" #学年
|
||||||
Semester: 1 #学期,1 或 2
|
Semester: 1 #学期,1 或 2
|
||||||
StartTime: "2024-9-14" #开始值班的日期
|
StartTime: "2025-3-10" #开始值班的日期,日期必须是星期一
|
||||||
Week: 15 #准备值班多少周
|
Week: 15 #准备值班多少周
|
||||||
File: "member.csv" #成员信息文件的路径,看文档
|
File: "member.csv" #成员信息文件的路径,看文档
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/golang-module/carbon/v2"
|
"github.com/golang-module/carbon/v2"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Load() {
|
func Load() {
|
||||||
@@ -26,7 +27,7 @@ func Load() {
|
|||||||
carbon.SetDefault(carbon.Default{
|
carbon.SetDefault(carbon.Default{
|
||||||
Layout: carbon.DateTimeLayout,
|
Layout: carbon.DateTimeLayout,
|
||||||
Timezone: carbon.PRC,
|
Timezone: carbon.PRC,
|
||||||
WeekStartsAt: carbon.Sunday,
|
WeekStartsAt: carbon.Monday,
|
||||||
Locale: "zh-CN", // 取值范围:lang 目录下翻译文件名,不包含文件后缀
|
Locale: "zh-CN", // 取值范围:lang 目录下翻译文件名,不包含文件后缀
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -39,6 +40,10 @@ func check() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if startTime := carbon.Parse(StartTime); startTime.IsMonday() != true {
|
||||||
|
fmt.Println("the start time must be a monday")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func debugprint() {
|
func debugprint() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user