|
@@ -170,7 +170,7 @@ func OneMinute(cont context.Context) (err error) {
|
|
|
|
|
|
func RefreshData(cont context.Context) (err error) {
|
|
|
wg := sync.WaitGroup{}
|
|
|
- wg.Add(7)
|
|
|
+ wg.Add(8)
|
|
|
//wind
|
|
|
go data.RefreshDataFromWind(&wg)
|
|
|
//同花顺
|
|
@@ -185,6 +185,8 @@ func RefreshData(cont context.Context) (err error) {
|
|
|
go data.RefreshDataFromYs(&wg)
|
|
|
//钢联
|
|
|
go data.RefreshDataFromGl(&wg)
|
|
|
+ //路透
|
|
|
+ go data.RefreshDataFromLt(&wg)
|
|
|
|
|
|
wg.Wait()
|
|
|
//计算指标
|
|
@@ -340,13 +342,15 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
nowYearLastDay := utils.GetNowYearLastDay()
|
|
|
|
|
|
debugNoticeUserId := 0 //测试环境,需要发送消息的用户
|
|
|
- if utils.RunMode == "debug" {
|
|
|
- tmpWxUser, tmpErr := models.GetWxUserByMobile("17634786714")
|
|
|
- if tmpErr == nil && tmpWxUser != nil {
|
|
|
- //debugNoticeUserId = 44078 //测试环境的话,发送邮箱给颜鹏
|
|
|
- debugNoticeUserId = int(tmpWxUser.UserId) //测试环境的话,发送邮箱给嘉豪
|
|
|
- }
|
|
|
- }
|
|
|
+ //测试环境也不发了
|
|
|
+ //if utils.RunMode == "debug" {
|
|
|
+ // tmpWxUser, tmpErr := models.GetWxUserByMobile("17634786714")
|
|
|
+ // if tmpErr == nil && tmpWxUser != nil {
|
|
|
+ // //debugNoticeUserId = 44078 //测试环境的话,发送邮箱给颜鹏
|
|
|
+ // debugNoticeUserId = int(tmpWxUser.UserId) //测试环境的话,发送邮箱给嘉豪
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
//task.globalTaskManager.adminTaskList
|
|
|
for _, edb := range list {
|
|
|
if edb.UserId <= 0 {
|
|
@@ -357,10 +361,10 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
noticeTime := "12:00:00" //提醒时间
|
|
|
|
|
|
var dataDtTime time.Time
|
|
|
- edbData, tmpErr := models.GetLastEdbdataInfo(edb.TradeCode)
|
|
|
+ edbData, tmpErr := models.GetLastEdbdataInfo(tmpEdb.TradeCode)
|
|
|
if tmpErr != nil {
|
|
|
if tmpErr.Error() != utils.ErrNoRow() {
|
|
|
- failList = append(failList, fmt.Sprint(edb.TradeCode, "失败,Err:", tmpErr.Error()))
|
|
|
+ failList = append(failList, fmt.Sprint(tmpEdb.TradeCode, "失败,Err:", tmpErr.Error()))
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
@@ -371,12 +375,12 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
dataDtTime = tmpDataDtTime
|
|
|
}
|
|
|
|
|
|
- switch edb.Frequency {
|
|
|
+ switch tmpEdb.Frequency {
|
|
|
case "周度":
|
|
|
modifyDate := nowWeekLastDay //下次更新日期
|
|
|
- if edb.NoticeTime != "" {
|
|
|
+ if tmpEdb.NoticeTime != "" {
|
|
|
addDay := 7
|
|
|
- noticeArr := strings.Split(edb.NoticeTime, " ")
|
|
|
+ noticeArr := strings.Split(tmpEdb.NoticeTime, " ")
|
|
|
if len(noticeArr) >= 2 {
|
|
|
noticeTime = noticeArr[1]
|
|
|
}
|
|
@@ -407,8 +411,8 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
case "月度":
|
|
|
addDay := 0
|
|
|
modifyDate := nowMonthLastDay //下次更新日期
|
|
|
- if edb.NoticeTime != "" {
|
|
|
- strArr := strings.Split(edb.NoticeTime, "日")
|
|
|
+ if tmpEdb.NoticeTime != "" {
|
|
|
+ strArr := strings.Split(tmpEdb.NoticeTime, "日")
|
|
|
if len(strArr) >= 2 {
|
|
|
noticeTime = strArr[1]
|
|
|
}
|
|
@@ -426,8 +430,8 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
}
|
|
|
case "季度":
|
|
|
//提醒时间
|
|
|
- if edb.NoticeTime != "" {
|
|
|
- noticeArr := strings.Split(edb.NoticeTime, " ")
|
|
|
+ if tmpEdb.NoticeTime != "" {
|
|
|
+ noticeArr := strings.Split(tmpEdb.NoticeTime, " ")
|
|
|
if len(noticeArr) >= 2 {
|
|
|
noticeTime = noticeArr[1]
|
|
|
}
|
|
@@ -439,8 +443,8 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
}
|
|
|
case "半年度":
|
|
|
//提醒时间
|
|
|
- if edb.NoticeTime != "" {
|
|
|
- noticeArr := strings.Split(edb.NoticeTime, " ")
|
|
|
+ if tmpEdb.NoticeTime != "" {
|
|
|
+ noticeArr := strings.Split(tmpEdb.NoticeTime, " ")
|
|
|
if len(noticeArr) >= 2 {
|
|
|
noticeTime = noticeArr[1]
|
|
|
}
|
|
@@ -452,8 +456,8 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
}
|
|
|
case "年度":
|
|
|
//提醒时间
|
|
|
- if edb.NoticeTime != "" {
|
|
|
- noticeArr := strings.Split(edb.NoticeTime, " ")
|
|
|
+ if tmpEdb.NoticeTime != "" {
|
|
|
+ noticeArr := strings.Split(tmpEdb.NoticeTime, " ")
|
|
|
if len(noticeArr) >= 2 {
|
|
|
noticeTime = noticeArr[1]
|
|
|
}
|
|
@@ -466,8 +470,8 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
}
|
|
|
|
|
|
if isNotice {
|
|
|
- taskName := "edb_task_" + todayStr + ":" + fmt.Sprint(edb.TradeCode)
|
|
|
- //fmt.Println(taskName, ";", edb.SecName)
|
|
|
+ taskName := "edb_task_" + todayStr + ":" + fmt.Sprint(tmpEdb.TradeCode)
|
|
|
+ //fmt.Println(taskName, ";", tmpEdb.SecName)
|
|
|
|
|
|
//定时任务
|
|
|
tmpTaskFunc := func(ctx context.Context) (funcErr error) {
|
|
@@ -497,8 +501,12 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
funcDataDtTime = tmpDataDtTime
|
|
|
}
|
|
|
|
|
|
+ //提示频度文案
|
|
|
+ notifyFrequency := "每日"
|
|
|
+
|
|
|
switch tmpEdb.Frequency {
|
|
|
case "周度":
|
|
|
+ notifyFrequency = "每周"
|
|
|
modifyDate := nowWeekLastDay //下次更新日期
|
|
|
if tmpEdb.NoticeTime != "" {
|
|
|
addDay := 7
|
|
@@ -531,6 +539,7 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
funcIsNotice = true
|
|
|
}
|
|
|
case "月度":
|
|
|
+ notifyFrequency = "每月"
|
|
|
addDay := 0
|
|
|
modifyDate := nowMonthLastDay //下次更新日期
|
|
|
if tmpEdb.NoticeTime != "" {
|
|
@@ -551,6 +560,7 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
funcIsNotice = true
|
|
|
}
|
|
|
case "季度":
|
|
|
+ notifyFrequency = "每季度"
|
|
|
//提醒时间
|
|
|
if tmpEdb.NoticeTime != "" {
|
|
|
noticeArr := strings.Split(tmpEdb.NoticeTime, " ")
|
|
@@ -564,6 +574,7 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
funcIsNotice = true
|
|
|
}
|
|
|
case "半年度":
|
|
|
+ notifyFrequency = "每半年度"
|
|
|
//提醒时间
|
|
|
if tmpEdb.NoticeTime != "" {
|
|
|
noticeArr := strings.Split(tmpEdb.NoticeTime, " ")
|
|
@@ -577,6 +588,7 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
funcIsNotice = true
|
|
|
}
|
|
|
case "年度":
|
|
|
+ notifyFrequency = "每年"
|
|
|
//提醒时间
|
|
|
if tmpEdb.NoticeTime != "" {
|
|
|
noticeArr := strings.Split(tmpEdb.NoticeTime, " ")
|
|
@@ -643,7 +655,7 @@ func AddEdbTask(cont context.Context) (err error) {
|
|
|
|
|
|
first := "数据录入提醒"
|
|
|
keyword1 := tmpEdb.SecName
|
|
|
- keyword2 := "每周 " + edb.NoticeTime
|
|
|
+ keyword2 := notifyFrequency + " " + tmpEdb.NoticeTime
|
|
|
remark := tmpEdb.SecName + "该更新了"
|
|
|
|
|
|
err = SendWxMsgWithFrequency(first, keyword1, keyword2, remark, openIdList)
|