瀏覽代碼

feat: 定时任务调整

zhangxinlei1996 1 年之前
父節點
當前提交
1961fdba9c
共有 3 個文件被更改,包括 8 次插入5 次删除
  1. 3 1
      api/crmapplication.go
  2. 2 2
      api/etc/push.yaml
  3. 3 2
      api/timetask/timetask.go

+ 3 - 1
api/crmapplication.go

@@ -17,7 +17,9 @@ import (
 )
 
 func main() {
-
+	timetask.Run()
+	select {}
+	return
 	//注册代理服务
 	closeNotify, err := node.NewNode(C.Gateway.Etcd...).Register(C.Gateway.ServerCode, mc.InterfaceToStr(C.Port))
 	if err != nil {

+ 2 - 2
api/etc/push.yaml

@@ -41,6 +41,6 @@ Custom:
     Content: "%s即将到期,请及时跟进。"
     PcHref: "/succbi/crm_system/app/crm.app/task_follow/Intermediate_part/Customer_part/customer_information_max.spg?E_position_id=%v&E_task_id=%v&E_cust_oppo_lead=%v&E_control_editing=1"
     MobileHref: "/jy_mobile/message/msgGuide"
-PushTime: "0 0 8 * * *"
-# PushTime: "0 50 13 * * *"
+#PushTime: "0 0 8 * * *"
+PushTime: "0 50 16 * * *"
 DueDay: 2

+ 3 - 2
api/timetask/timetask.go

@@ -31,7 +31,7 @@ func getTime() (string, string) {
 	startTime := time.Date(twoDaysAgo.Year(), twoDaysAgo.Month(), twoDaysAgo.Day(), 0, 0, 0, 0, twoDaysAgo.Location())
 
 	// 设置时间为 24 点
-	endTime := startTime.Add(24 * time.Hour)
+	endTime := startTime.Add(time.Duration(cm.Push.DueDay) * 24 * time.Hour)
 	return startTime.Format(date.Date_Full_Layout), endTime.Format(date.Date_Full_Layout)
 }
 
@@ -67,6 +67,7 @@ func sendMess() {
 				u := &service.User{}
 				resp := u.IdentityByPositionId(positionId)
 				if resp == nil {
+					log.Println("%v未找到身份", positionId)
 					continue
 				}
 				user := &service.User{
@@ -81,7 +82,7 @@ func sendMess() {
 		}, `select a.id,a.name,b.position_id,a.source,a.source_id from task a left join task_team b on (a.id =b.task_id and b.role=1)
 				where a.status!=3 and a.next_follow_time >= ? and a.next_follow_time < ?`, st, et)
 
-		log.Println("end cron")
+		log.Println("end cron", st, et)
 	}, "sendMsg")
 	if err != nil {
 		log.Println("cron err:", err)