Bläddra i källkod

定时脚本

master
huangjiajun 1 vecka sedan
förälder
incheckning
dfa71522e2
2 ändrade filer med 24 tillägg och 16 borttagningar
  1. +12
    -8
      app/task/svc/svc_no_login_send.go
  2. +12
    -8
      app/task/svc/svc_no_sign_send.go

+ 12
- 8
app/task/svc/svc_no_login_send.go Visa fil

@@ -57,15 +57,19 @@ WHERE unt.login_time<'%d' and unt.login_notice_time<'%d' and unt.login_time>0 %s
data.Content = strings.ReplaceAll(data.Content, "{手机号}", v["phone"])
data.Content = strings.ReplaceAll(data.Content, "{小时}", utils.Int64ToStr(hour))
extra = "{\"hour\":\"" + utils.Int64ToStr(hour) + "\"}"
arg := md.JpushRecordFundData{UserId: v["id"], Target: "1", Platform: "all", Title: data.Title, Content: data.Content}
err := ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue)
if err != nil {
ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue)
if data.JpushOpen == 1 {
arg := md.JpushRecordFundData{UserId: v["id"], Target: "1", Platform: "all", Title: data.Title, Content: data.Content}
err := ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue)
if err != nil {
ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue)
}
}
arg1 := md.AliyunSmsRecordFundData{Phone: v["phone"], Title: data.Title, Content: data.Content, Code: data.SmsCode, Extra: extra}
err = ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue)
if err != nil {
ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue)
if data.SmsOpen == 1 {
arg1 := md.AliyunSmsRecordFundData{Phone: v["phone"], Title: data.Title, Content: data.Content, Code: data.SmsCode, Extra: extra}
err := ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue)
if err != nil {
ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue)
}
}
eg.Where("id=?", v["unt_id"]).Cols("login_notice_time").Update(&model.UserNoticeTime{LoginNoticeTime: int(time.Now().Unix())})
}


+ 12
- 8
app/task/svc/svc_no_sign_send.go Visa fil

@@ -56,15 +56,19 @@ WHERE unt.sign_time<'%d' and unt.sign_notice_time<'%d' and unt.sign_time>0 %s
data.Content = strings.ReplaceAll(data.Content, "{手机号}", v["phone"])
data.Content = strings.ReplaceAll(data.Content, "{小时}", utils.Int64ToStr(hour))
extra = "{\"hour\":\"" + utils.Int64ToStr(hour) + "\"}"
arg := md.JpushRecordFundData{UserId: v["id"], Target: "1", Platform: "all", Title: data.Title, Content: data.Content}
err := ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue)
if err != nil {
ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue)
if data.JpushOpen == 1 {
arg := md.JpushRecordFundData{UserId: v["id"], Target: "1", Platform: "all", Title: data.Title, Content: data.Content}
err := ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue)
if err != nil {
ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue)
}
}
arg1 := md.AliyunSmsRecordFundData{Phone: v["phone"], Title: data.Title, Content: data.Content, Code: data.SmsCode, Extra: extra}
err = ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue)
if err != nil {
ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue)
if data.SmsOpen == 1 {
arg1 := md.AliyunSmsRecordFundData{Phone: v["phone"], Title: data.Title, Content: data.Content, Code: data.SmsCode, Extra: extra}
err := ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue)
if err != nil {
ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue)
}
}
eg.Where("id=?", v["unt_id"]).Cols("sign_notice_time").Update(&model.UserNoticeTime{SignNoticeTime: int(time.Now().Unix())})
}


Laddar…
Avbryt
Spara