|
@@ -1,8 +1,11 @@
|
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
"fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/common"
|
|
|
+ "hongze/hongze_open_api/models/request/article"
|
|
|
+ celuePushTable "hongze/hongze_open_api/models/tables/article"
|
|
|
tables "hongze/hongze_open_api/models/tables/report"
|
|
|
"hongze/hongze_open_api/models/tables/wx_user"
|
|
|
"hongze/hongze_open_api/utils"
|
|
@@ -257,3 +260,45 @@ func (c *ReportControllerCommon) GetResearchReportChapter() {
|
|
|
}
|
|
|
c.OkDetailed(reportInfo, "获取成功")
|
|
|
}
|
|
|
+
|
|
|
+// @Title 报告变更通知的插入点接口
|
|
|
+// @Description 报告变更通知的插入点接口
|
|
|
+// @Param request body article.CreatArticleCeluePushReq true "type json string"
|
|
|
+// @Success 200 创建成功
|
|
|
+// @router /article/change [post]
|
|
|
+func (c *ReportController) ArticleChange() {
|
|
|
+ //appid权限校验
|
|
|
+ appid := c.GetString("appid", "")
|
|
|
+ if utils.RunMode == "release" && appid != "CQWx3EqDLNk7bVHo" {
|
|
|
+ c.FailWithMessage("无权限")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var req article.CreatArticleCeluePushReq
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ c.FailWithMessage("参数解析异常")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ articleId := req.ArticleId
|
|
|
+ action := req.Action
|
|
|
+ if articleId < 0 {
|
|
|
+ c.FailWithMessage("缺少 article_id 参数")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if action != "add" && action != "edit" && action != "move" {
|
|
|
+ c.FailWithMessage("action参数类型错误")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item := new(celuePushTable.CygxArticleCeluePush)
|
|
|
+ item.ArticleId = articleId
|
|
|
+ item.Action = action
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ err = celuePushTable.AddCygxArticleCeluePush(item)
|
|
|
+ if err != nil {
|
|
|
+ c.OkWithMessage("创建失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ c.OkWithMessage("创建成功")
|
|
|
+}
|