tuoling805 hace 1 año
padre
commit
333c428a5e
Se han modificado 4 ficheros con 11 adiciones y 5 borrados
  1. 2 1
      config/config.go
  2. 1 1
      init_serve/task.go
  3. 2 1
      services/index.go
  4. 6 2
      services/index_queue.go

+ 2 - 1
config/config.go

@@ -15,7 +15,8 @@ type Serve struct {
 	StaticDir         string `mapstructure:"static-dir" json:"static-dir" yaml:"static-dir" description:"上传的文件存储目录地址"`
 	IndexSaveDir      string `mapstructure:"index-save-dir" json:"index-save-dir" yaml:"index-save-dir" description:"监听文件夹的路径"`
 	IndexMergeSaveDir string `mapstructure:"index-merge-save-dir" json:"index-merge-save-dir" yaml:"index-merge-save-dir" description:"监听合并文件夹的路径"`
-	Frequency     string `mapstructure:"frequency" json:"frequency" yaml:"frequency" description:"频度"`
+	Frequency         string `mapstructure:"frequency" json:"frequency" yaml:"frequency" description:"频度"`
+	SystemType        string `mapstructure:"frequency" json:"frequency" yaml:"frequency" description:"类型定义"`
 	EdbLibUrl         string `mapstructure:"edb-lib-url" json:"edb-lib-url" yaml:"edb-lib-url" description:"公共指标库的地址"`
 	AppEdbLibNameEn   string `mapstructure:"app_edb_lib_name_en" json:"app_edb_lib_name_en" yaml:"app_edb_lib_name_en" description:"指标库的英文名称"`
 	EdbLibMd5Key      string `mapstructure:"edb_lib_md5_key" json:"edb_lib_md5_key" yaml:"edb_lib_md5_key" description:"指标库服务秘钥"`

+ 1 - 1
init_serve/task.go

@@ -30,7 +30,7 @@ func InitTask() {
 	//	panic("DownloadCvTask err" + err.Error())
 	//}
 
-	_, err = c.AddFunc("0 00 17 * * *", services.IndexRefreshAll)
+	_, err = c.AddFunc("0 0 17 * * *", services.IndexRefreshAll)
 	//_, err = c.AddFunc("0 */10 * * * *", services.IndexRefreshAll)
 	if err != nil {
 		global.LOG.Info("DownloadCvTask err" + err.Error())

+ 2 - 1
services/index.go

@@ -37,6 +37,7 @@ func IndexCreateCheck() (err error) {
 		return
 	}
 	fmt.Println("listLen:", len(list))
+	time.Sleep(5 * time.Second)
 	if len(list) <= 0 {
 		return nil
 	}
@@ -46,7 +47,7 @@ func IndexCreateCheck() (err error) {
 	}
 	indexCodeStr := strings.Join(indexCode, ";")
 	fmt.Println("indexCodeStr:" + indexCodeStr)
-	go alarm_msg.SendAlarmMsg(utils.APPNAME+" 存在指标数据未生成:"+indexCodeStr, 3)
+	//go alarm_msg.SendAlarmMsg(utils.APPNAME+" 存在指标数据未生成:"+indexCodeStr, 3)
 	for _, v := range list {
 		fmt.Println("IndexCreateCheck start:", v.IndexCode, v.FilePath)
 		if v.FilePath != "" && utils.FileIsExist(v.FilePath) {

+ 6 - 2
services/index_queue.go

@@ -31,10 +31,14 @@ func IndexHandle(filePath string) {
 	filePath = strings.Replace(filePath, `"`, ``, -1)
 	fmt.Println("开始刷新文件:", filePath)
 	time.Sleep(1 * time.Second)
-	if global.CONFIG.Serve.Frequency != "周度" && !strings.Contains(filePath, "week") {
+	if global.CONFIG.Serve.SystemType == "custom" {
 		MysteelChemicalRefresh(filePath)
 	} else {
-		MysteelChemicalRefresh(filePath)
+		if global.CONFIG.Serve.Frequency != "周度" && !strings.Contains(filePath, "week") {
+			MysteelChemicalRefresh(filePath)
+		} else {
+			MysteelChemicalRefresh(filePath)
+		}
 	}
 	//刷新完成后,清除缓存
 	//global.Rc.Delete(filePath)