diff --git a/app/task/svc/svc_no_login_send.go b/app/task/svc/svc_no_login_send.go index 7be91fa..8caf528 100644 --- a/app/task/svc/svc_no_login_send.go +++ b/app/task/svc/svc_no_login_send.go @@ -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())}) } diff --git a/app/task/svc/svc_no_sign_send.go b/app/task/svc/svc_no_sign_send.go index e47aff3..cb1c8f9 100644 --- a/app/task/svc/svc_no_sign_send.go +++ b/app/task/svc/svc_no_sign_send.go @@ -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())}) }