|
@@ -1850,7 +1850,7 @@ func (this *ReportController) MarkEditStatus() {
|
|
|
// @Title 模板消息/客群消息推送接口
|
|
|
// @Description 模板消息/客群消息推送接口
|
|
|
// @Param request body models.SendTemplateMsgReq true "type json string"
|
|
|
-// @Success 200 Ret=200 推送成功
|
|
|
+// @Success 200 {object} models.SendTemplateMsgResp
|
|
|
// @router /sendMsg [post]
|
|
|
func (this *ReportController) SendMsg() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
@@ -1884,13 +1884,13 @@ func (this *ReportController) SendMsg() {
|
|
|
}()
|
|
|
}
|
|
|
|
|
|
- report, e := models.GetReportById(req.ReportId)
|
|
|
+ reportInfo, e := models.GetReportByReportId(req.ReportId)
|
|
|
if e != nil {
|
|
|
br.Msg = "报告不存在或已被删除, 请刷新页面"
|
|
|
br.ErrMsg = "获取报告失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- if report.MsgIsSend == 1 && report.ThsMsgIsSend == 1 {
|
|
|
+ if reportInfo.MsgIsSend == 1 && reportInfo.ThsMsgIsSend == 1 {
|
|
|
br.Msg = "消息已推送,请勿重复操作"
|
|
|
br.ErrMsg = "消息已推送,请勿重复操作"
|
|
|
return
|
|
@@ -1911,7 +1911,7 @@ func (this *ReportController) SendMsg() {
|
|
|
|
|
|
// 可能存在历史数据两个只推了一个所以此处加个判断
|
|
|
// 推送模板消息
|
|
|
- if report.MsgIsSend == 0 {
|
|
|
+ if reportInfo.MsgIsSend == 0 {
|
|
|
go func() {
|
|
|
fmt.Println("推送模板消息:", req.ReportId)
|
|
|
_ = services.SendMiniProgramReportWxMsg(req.ReportId)
|
|
@@ -1919,7 +1919,12 @@ func (this *ReportController) SendMsg() {
|
|
|
}
|
|
|
|
|
|
// 更新推送消息状态
|
|
|
- if err = models.ModifyReportMsgIsSendV2(req.ReportId); err != nil {
|
|
|
+ reportInfo.MsgIsSend = 1
|
|
|
+ reportInfo.ThsMsgIsSend = 1
|
|
|
+ reportInfo.MsgSendTime = time.Now()
|
|
|
+ reportInfo.ModifyTime = time.Now()
|
|
|
+ err = reportInfo.UpdateReport([]string{"MsgIsSend", "ThsMsgIsSend", "MsgSendTime", "ModifyTime"})
|
|
|
+ if err != nil {
|
|
|
br.Msg = "推送失败"
|
|
|
br.ErrMsg = "更新报告消息状态失败, Err:" + err.Error()
|
|
|
return
|
|
@@ -1929,6 +1934,10 @@ func (this *ReportController) SendMsg() {
|
|
|
br.Success = true
|
|
|
br.Msg = "推送成功"
|
|
|
br.IsAddLog = true
|
|
|
+ br.Data = models.SendTemplateMsgResp{
|
|
|
+ ReportId: reportInfo.Id,
|
|
|
+ MsgSendTime: reportInfo.MsgSendTime.Format(utils.FormatDateTime),
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// CheckDayWeekReportChapterVideo
|