Roc 1 week ago
parent
commit
9cc02423af
2 changed files with 14 additions and 13 deletions
  1. 1 1
      init_serve/task.go
  2. 13 12
      utils/constants.go

+ 1 - 1
init_serve/task.go

@@ -72,7 +72,7 @@ func getMenuStr(menuList []*models.EtaBusinessMenu) (str string) {
 
 // writeFile 文件写入
 func writeFile(baseDir, str string, etaBusiness *models.EtaBusiness) (err error) {
-	file, err := os.OpenFile(baseDir+"/"+etaBusiness.BusinessName+"_"+etaBusiness.BusinessCode+".txt", os.O_WRONLY|os.O_CREATE, 0666)
+	file, err := os.OpenFile(baseDir+"/"+time.Now().Format(utils.FormatDateMouthDayUnSpace)+"_"+etaBusiness.BusinessName+"_"+etaBusiness.BusinessCode+".txt", os.O_WRONLY|os.O_CREATE, 0666)
 	if err != nil {
 		fmt.Println(err)
 		return

+ 13 - 12
utils/constants.go

@@ -2,18 +2,19 @@ package utils
 
 // 常量定义
 const (
-	FormatTime            = "15:04:05"                //时间格式
-	FormatDate            = "2006-01-02"              //日期格式
-	FormatDateCN          = "2006年01月02日"             //日期格式(中文)
-	FormatDateUnSpace     = "20060102"                //日期格式
-	FormatDateTime        = "2006-01-02 15:04:05"     //完整时间格式
-	HlbFormatDateTime     = "2006-01-02_15:04:05.999" //完整时间格式
-	FormatDateTimeUnSpace = "20060102150405"          //完整时间格式
-	PageSize15            = 15                        //列表页每页数据量
-	PageSize5             = 5
-	PageSize10            = 10
-	PageSize20            = 20
-	PageSize30            = 30
+	FormatTime                = "15:04:05"                //时间格式
+	FormatDate                = "2006-01-02"              //日期格式
+	FormatDateCN              = "2006年01月02日"             //日期格式(中文)
+	FormatDateUnSpace         = "20060102"                //日期格式
+	FormatDateMouthDayUnSpace = "0102"                    //日期格式
+	FormatDateTime            = "2006-01-02 15:04:05"     //完整时间格式
+	HlbFormatDateTime         = "2006-01-02_15:04:05.999" //完整时间格式
+	FormatDateTimeUnSpace     = "20060102150405"          //完整时间格式
+	PageSize15                = 15                        //列表页每页数据量
+	PageSize5                 = 5
+	PageSize10                = 10
+	PageSize20                = 20
+	PageSize30                = 30
 )
 
 // 手机号,电子邮箱正则