|
@@ -1343,15 +1343,68 @@ func (this *ReportController) PublishDayWeekReportChapter() {
|
|
|
}
|
|
|
|
|
|
// 同时发布报告
|
|
|
- if req.PublishReport == 1 {
|
|
|
- if _, e := services.PublishDayWeekReport(chapterInfo.ReportId); e != nil {
|
|
|
- br.Msg = "章节发布成功,报告发布失败,请手动发布报告"
|
|
|
- br.ErrMsg = "发布晨/周报失败, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
+ //if req.PublishReport == 1 {
|
|
|
+ // if _, e := services.PublishDayWeekReport(chapterInfo.ReportId); e != nil {
|
|
|
+ // br.Msg = "章节发布成功,报告发布失败,请手动发布报告"
|
|
|
+ // br.ErrMsg = "发布晨/周报失败, Err: " + e.Error()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "操作成功"
|
|
|
}
|
|
|
+
|
|
|
+// GetUnPublishReportChapterCount
|
|
|
+// @Title 获取报告中未发布的章节数
|
|
|
+// @Description 获取报告中未发布的章节数
|
|
|
+// @Param ReportId query int true "报告ID"
|
|
|
+// @Success 200 Ret=200 获取成功
|
|
|
+// @router /chapter/un_publish/count [get]
|
|
|
+func (this *ReportController) GetUnPublishReportChapterCount() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reportId, _ := this.GetInt("ReportId")
|
|
|
+ if reportId <= 0 {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reportInfo, err := models.GetReportById(reportId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "报告有误"
|
|
|
+ br.ErrMsg = "报告有误, Err: " + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if reportInfo.HasChapter == 0 {
|
|
|
+ br.Msg = "报告未包含章节"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取未发布的章节数
|
|
|
+ unPublishedNum, err := models.CountUnPublishedChapterNum(reportInfo.Id)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取未发布的章节数失败"
|
|
|
+ br.ErrMsg = "获取未发布的章节数失败, Err: " + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = unPublishedNum
|
|
|
+}
|