|
@@ -254,7 +254,7 @@ func (this *ReportPushStatusController) PushCancel() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- reportPush, err := models.GetReportPushStatusByReportId(req.ReportId, 1)
|
|
|
+ reportPush, err := models.GetReportPushStatusByReportId(req.ReportPushStatusId, 1)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "推送失败"
|
|
|
br.ErrMsg = "获取推送消息失败,Err:" + err.Error()
|
|
@@ -295,17 +295,7 @@ func (this *ReportPushStatusController) Push() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- count, err := models.GetReportCountById(req.ReportId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "研报未发布或已删除"
|
|
|
- br.ErrMsg = "研报查询失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if count == 0 {
|
|
|
- br.Msg = "研报未发布或已删除"
|
|
|
- return
|
|
|
- }
|
|
|
- reportPush, err := models.GetReportPushStatusByReportId(req.ReportId, 0)
|
|
|
+ reportPush, err := models.GetReportPushStatusByReportId(req.ReportPushStatusId, 0)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "推送失败"
|
|
|
br.ErrMsg = "获取推送消息失败,Err:" + err.Error()
|
|
@@ -349,6 +339,7 @@ func (this *ReportPushStatusController) BatchPush() {
|
|
|
}
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
+ condition = ` AND state = 0 `
|
|
|
if req.PublishStartDate != "" && req.PublishEndDate != "" {
|
|
|
condition += " AND publish_time >= ?"
|
|
|
publishStartTime, err := time.Parse(utils.FormatDate, req.PublishStartDate)
|
|
@@ -414,39 +405,39 @@ func (this *ReportPushStatusController) BatchPush() {
|
|
|
}
|
|
|
if req.IsSelectAll {
|
|
|
if len(req.SelectedIds) > 0 {
|
|
|
- condition += ` AND report_id NOT IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
|
|
|
+ condition += ` AND report_push_status_id NOT IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
|
|
|
pars = append(pars, req.SelectedIds)
|
|
|
}
|
|
|
} else {
|
|
|
if len(req.SelectedIds) > 0 {
|
|
|
- condition += ` AND report_id IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
|
|
|
+ condition += ` AND report_push_status_id IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
|
|
|
pars = append(pars, req.SelectedIds)
|
|
|
}
|
|
|
}
|
|
|
- reportIds, err := models.GetReportIdListByCondition(condition, pars)
|
|
|
+ reportPushStatusIds, err := models.GetReportPushStatusIdListByCondition(condition, pars)
|
|
|
if err != nil {
|
|
|
br.Msg = "批量推送失败"
|
|
|
br.ErrMsg = "查询研报失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- reportPush, err := models.GetReportPushStatusByReportIdAndState(reportIds, 0)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "批量推送失败"
|
|
|
- br.ErrMsg = "查询推送状态失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- existReportMap := make(map[int]struct{})
|
|
|
- for _, v := range reportPush {
|
|
|
- existReportMap[v.ReportId] = struct{}{}
|
|
|
- }
|
|
|
- existReportIds := make([]int, 0)
|
|
|
- for _, v := range reportIds {
|
|
|
- if _, ok := existReportMap[v]; ok {
|
|
|
- existReportIds = append(existReportIds, v)
|
|
|
- }
|
|
|
- }
|
|
|
+ // reportPush, err := models.GetReportPushStatusByIdAndState(reportIds, 0)
|
|
|
+ // if err != nil {
|
|
|
+ // br.Msg = "批量推送失败"
|
|
|
+ // br.ErrMsg = "查询推送状态失败,Err:" + err.Error()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // existReportMap := make(map[int]struct{})
|
|
|
+ // for _, v := range reportPush {
|
|
|
+ // existReportMap[v.ReportId] = struct{}{}
|
|
|
+ // }
|
|
|
+ // existReportIds := make([]int, 0)
|
|
|
+ // for _, v := range reportIds {
|
|
|
+ // if _, ok := existReportMap[v]; ok {
|
|
|
+ // existReportIds = append(existReportIds, v)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- err = models.BatchPushReport(existReportIds)
|
|
|
+ err = models.BatchPushReport(reportPushStatusIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "批量推送失败"
|
|
|
br.ErrMsg = "批量修改推送失败,Err:" + err.Error()
|
|
@@ -478,6 +469,7 @@ func (this *ReportPushStatusController) BatchPushCancel() {
|
|
|
}
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
+ condition = ` AND state = 1 `
|
|
|
if req.PublishStartDate != "" && req.PublishEndDate != "" {
|
|
|
condition += " AND publish_time >= ?"
|
|
|
publishStartTime, err := time.Parse(utils.FormatDate, req.PublishStartDate)
|
|
@@ -543,39 +535,46 @@ func (this *ReportPushStatusController) BatchPushCancel() {
|
|
|
}
|
|
|
if req.IsSelectAll {
|
|
|
if len(req.SelectedIds) > 0 {
|
|
|
- condition += ` AND report_id NOT IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
|
|
|
+ condition += ` AND report_push_status_id NOT IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
|
|
|
pars = append(pars, req.SelectedIds)
|
|
|
}
|
|
|
} else {
|
|
|
if len(req.SelectedIds) > 0 {
|
|
|
- condition += ` AND report_id IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
|
|
|
+ condition += ` AND report_push_status_id IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
|
|
|
pars = append(pars, req.SelectedIds)
|
|
|
}
|
|
|
}
|
|
|
- reportIds, err := models.GetReportIdListByCondition(condition, pars)
|
|
|
+
|
|
|
+ reportPushStatusIds, err := models.GetReportPushStatusIdListByCondition(condition, pars)
|
|
|
if err != nil {
|
|
|
br.Msg = "批量推送失败"
|
|
|
br.ErrMsg = "查询研报失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- reportPush, err := models.GetReportPushStatusByReportIdAndState(reportIds, 1)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "批量推送失败"
|
|
|
- br.ErrMsg = "查询推送状态失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- existReportMap := make(map[int]struct{})
|
|
|
- for _, v := range reportPush {
|
|
|
- existReportMap[v.ReportId] = struct{}{}
|
|
|
- }
|
|
|
- existReportIds := make([]int, 0)
|
|
|
- for _, v := range reportIds {
|
|
|
- if _, ok := existReportMap[v]; ok {
|
|
|
- existReportIds = append(existReportIds, v)
|
|
|
- }
|
|
|
- }
|
|
|
+ // reportIds, err := models.GetReportIdListByCondition(condition, pars)
|
|
|
+ // if err != nil {
|
|
|
+ // br.Msg = "批量推送失败"
|
|
|
+ // br.ErrMsg = "查询研报失败,Err:" + err.Error()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // reportPush, err := models.GetReportPushStatusByReportIdAndState(reportIds, 1)
|
|
|
+ // if err != nil {
|
|
|
+ // br.Msg = "批量推送失败"
|
|
|
+ // br.ErrMsg = "查询推送状态失败,Err:" + err.Error()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // existReportMap := make(map[int]struct{})
|
|
|
+ // for _, v := range reportPush {
|
|
|
+ // existReportMap[v.ReportId] = struct{}{}
|
|
|
+ // }
|
|
|
+ // existReportIds := make([]int, 0)
|
|
|
+ // for _, v := range reportIds {
|
|
|
+ // if _, ok := existReportMap[v]; ok {
|
|
|
+ // existReportIds = append(existReportIds, v)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- err = models.BatchPushCancelReport(existReportIds)
|
|
|
+ err = models.BatchPushCancelReport(reportPushStatusIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "批量取消推送失败"
|
|
|
br.ErrMsg = "批量修改推送失败,Err:" + err.Error()
|