Эх сурвалжийг харах

Merge branch 'cygx_12.0' into debug

ziwen 1 жил өмнө
parent
commit
5505a97b24

+ 43 - 1
controllers/yanxuan_special.go

@@ -959,4 +959,46 @@ func (this *YanxuanSpecialController) AuthorHeadImg() {
 //	br.Ret = 200
 //	br.Ret = 200
 //	br.Success = true
 //	br.Success = true
 //	br.Data = resourceItem
 //	br.Data = resourceItem
-//}
+//}
+
+// @Title 删除专栏
+// @Description 删除专栏
+// @Param	request	body help_doc.AddHelpDocReq true "type json string"
+// @Success 200 {object} models.AddEnglishReportResp
+// @router /del [post]
+func (this *YanxuanSpecialController) Delete() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.User
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var req models.EnableCygxYanxuanSpecialReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	if req.Id <= 0 {
+		br.Msg = "文章id错误"
+		return
+	}
+
+	if tmpErr := models.DelYanxuanSpecial(req.Id); tmpErr != nil {
+		br.Msg = "删除失败"
+		br.ErrMsg = "删除失败, Err:" + tmpErr.Error()
+		return
+	}
+
+	br.Msg = "删除成功"
+	br.Ret = 200
+	br.Success = true
+}

+ 12 - 0
models/cygx_yanxuan_special.go

@@ -160,3 +160,15 @@ func CancelPublishYanxuanSpecial(id int) (err error) {
 	_, err = o.Raw(sql, id).Exec()
 	_, err = o.Raw(sql, id).Exec()
 	return
 	return
 }
 }
+
+type DelCygxYanxuanSpecialReq struct {
+	Id     int    // 文章id
+}
+
+func DelYanxuanSpecial(id int) (err error) {
+	o := orm.NewOrm()
+	sql := ``
+	sql = `DELETE FROM cygx_yanxuan_special WHERE id = ? `
+	_, err = o.Raw(sql, id).Exec()
+	return
+}

+ 9 - 0
routers/commentsRouter.go

@@ -1762,6 +1762,15 @@ func init() {
             Filters: nil,
             Filters: nil,
             Params: nil})
             Params: nil})
 
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"],
+        beego.ControllerComments{
+            Method: "Delete",
+            Router: `/del`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"],
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"],
         beego.ControllerComments{
         beego.ControllerComments{
             Method: "Detail",
             Method: "Detail",