|
@@ -377,6 +377,9 @@ type EdbInfoData struct {
|
|
|
SmmData
|
|
|
}
|
|
|
|
|
|
+// 如果历史数据入库,就不再执行OldExcel
|
|
|
+var isSave bool
|
|
|
+
|
|
|
func SyncShangHaiSmm(cont context.Context) (err error) {
|
|
|
upMonth := time.Now().AddDate(0, -1, 0).Format(utils.FormatDate)
|
|
|
curDate := time.Now().Format(utils.FormatDate)
|
|
@@ -447,6 +450,9 @@ func SyncShangHaiSmm(cont context.Context) (err error) {
|
|
|
fmt.Println("上海有色爬虫更新失败")
|
|
|
return
|
|
|
}
|
|
|
+ if resp.Ret == 200 && utils.BusinessCode == utils.BusinessCodeJinRui {
|
|
|
+ OldExcel()
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -506,7 +512,10 @@ func ExcelToSmm(f *excelize.File, s string) (edbInfoList []*EdbInfoData) {
|
|
|
}
|
|
|
|
|
|
func OldExcel() {
|
|
|
- excelPath := ""
|
|
|
+ excelPath := utils.OLD_EXCEL_PATH_JR
|
|
|
+ if excelPath == "" || isSave {
|
|
|
+ return
|
|
|
+ }
|
|
|
f, err := excelize.OpenFile(excelPath)
|
|
|
if err != nil {
|
|
|
fmt.Print(err)
|
|
@@ -547,4 +556,5 @@ func OldExcel() {
|
|
|
}
|
|
|
time.Sleep(10 * time.Second)
|
|
|
}
|
|
|
+ isSave = true
|
|
|
}
|