|
@@ -321,7 +321,7 @@ func (this *SmartReportController) Detail() {
|
|
|
// @Description 发布/取消发布
|
|
|
// @Param request body smart_report.SmartReportPublishReq true "type json string"
|
|
|
// @Success 200 string "操作成功"
|
|
|
-// @router /edit [post]
|
|
|
+// @router /publish [post]
|
|
|
func (this *SmartReportController) Publish() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
@@ -370,6 +370,10 @@ func (this *SmartReportController) Publish() {
|
|
|
cols := []string{"State", "ModifyTime"}
|
|
|
item.State = req.PublishState
|
|
|
item.ModifyTime = time.Now().Local()
|
|
|
+ if req.PublishState == 2 {
|
|
|
+ cols = append(cols, "PublishTime")
|
|
|
+ item.PublishTime = time.Now().Local()
|
|
|
+ }
|
|
|
// 取消发布时同时清除掉Img和PDF的文件地址
|
|
|
if req.PublishState == 1 {
|
|
|
cols = append(cols, "DetailImgUrl", "DetailPdfUrl")
|
|
@@ -436,11 +440,11 @@ func (this *SmartReportController) PrePublish() {
|
|
|
br.Msg = "发布时间不能为空"
|
|
|
return
|
|
|
}
|
|
|
- //if req.PreMsgSend != 0 && req.PreMsgSend != 1 {
|
|
|
- // br.Msg = "参数错误"
|
|
|
- // br.ErrMsg = "是否发送模版消息标识错误"
|
|
|
- // return
|
|
|
- //}
|
|
|
+ if req.PreMsgSend != 0 && req.PreMsgSend != 1 {
|
|
|
+ br.Msg = "参数错误"
|
|
|
+ br.ErrMsg = "是否发送模版消息标识错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
preTime, e := time.ParseInLocation(utils.FormatDateTime, req.PrePublishTime, time.Local)
|
|
|
if e != nil {
|
|
|
br.Msg = "发布时间格式错误"
|
|
@@ -553,10 +557,15 @@ func (this *SmartReportController) SendMsg() {
|
|
|
br.Msg = "消息已推送,请勿重复操作"
|
|
|
return
|
|
|
}
|
|
|
+ if item.State != 2 {
|
|
|
+ br.Msg = "报告未发布, 不可推送"
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
item.MsgIsSend = 1
|
|
|
+ item.MsgSendTime = time.Now().Local()
|
|
|
item.ModifyTime = time.Now().Local()
|
|
|
- if e = item.Update([]string{"MsgIsSend", "ModifyTime"}); e != nil {
|
|
|
+ if e = item.Update([]string{"MsgIsSend", "MsgSendTime", "ModifyTime"}); e != nil {
|
|
|
br.Msg = "操作失败"
|
|
|
br.ErrMsg = "更新报告推送状态失败, Err: " + e.Error()
|
|
|
return
|
|
@@ -689,7 +698,7 @@ func (this *SmartReportController) SaveContent() {
|
|
|
// @Description 标记报告编辑状态接口
|
|
|
// @Param request body request.MarkEditEnReport true "type json string"
|
|
|
// @Success 200 标记成功 ;202 标记成功
|
|
|
-// @router /mark [post]
|
|
|
+// @router /mark_edit [post]
|
|
|
func (this *SmartReportController) MarkEditStatus() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
@@ -706,14 +715,14 @@ func (this *SmartReportController) MarkEditStatus() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
- var req models.MarkEditReport
|
|
|
+ var req smart_report.SmartReportMarkEditReq
|
|
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
if err != nil {
|
|
|
br.Msg = "参数解析异常!"
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if req.ReportId <= 0 {
|
|
|
+ if req.SmartReportId <= 0 {
|
|
|
br.Msg = "缺少报告Id"
|
|
|
return
|
|
|
}
|
|
@@ -734,7 +743,7 @@ func (this *SmartReportController) MarkEditStatus() {
|
|
|
adminIdName[ad.AdminId] = ad.RealName
|
|
|
}
|
|
|
|
|
|
- data, e := smartReportService.UpdateSmartReportEditing(req.ReportId, req.Status, sysUser.AdminId, sysUser.RealName, adminIdName)
|
|
|
+ data, e := smartReportService.UpdateSmartReportEditing(req.SmartReportId, req.Status, sysUser.AdminId, sysUser.RealName, adminIdName)
|
|
|
if e != nil {
|
|
|
br.Msg = e.Error()
|
|
|
return
|
|
@@ -790,7 +799,7 @@ func (this *SmartReportController) List() {
|
|
|
Keyword string `form:"Keyword"`
|
|
|
}
|
|
|
params := new(SmartReportListReq)
|
|
|
- if e := this.ParseForm(¶ms); e != nil {
|
|
|
+ if e := this.ParseForm(params); e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "入参解析失败, Err: " + e.Error()
|
|
|
return
|
|
@@ -865,9 +874,9 @@ func (this *SmartReportController) List() {
|
|
|
|
|
|
// 列表查询过滤掉富文本内容
|
|
|
fields := []string{
|
|
|
- "SmartReportId", "ReportCode", "ClassifyIdFirst", "ClassifyNameFirst", "ClassifyIdSecond", "ClassifyNameSecond", "AddType",
|
|
|
- "Title", "Author", "Frequency", "Stage", "VideoUrl", "VideoName", "VideoPlaySeconds", "VideoSize", "AdminId", "AdminRealName", "State",
|
|
|
- "PublishTime", "PrePublishTime", "PreMsgSend", "MsgIsSend", "MsgSendTime", "CreateTime", "ModifyTime",
|
|
|
+ "smart_report_id", "report_code", "classify_id_first", "classify_name_first", "classify_id_second", "classify_name_second", "add_type",
|
|
|
+ "title", "author", "frequency", "stage", "video_url", "video_name", "video_play_seconds", "video_size", "detail_img_url", "detail_pdf_url",
|
|
|
+ "admin_id", "admin_real_name", "state", "publish_time", "pre_publish_time", "pre_msg_send", "msg_is_send", "msg_send_time", "create_time", "modify_time",
|
|
|
}
|
|
|
list, e := reportOB.GetPageItemsByCondition(condition, pars, fields, "", startSize, params.PageSize)
|
|
|
if e != nil {
|