Browse Source

作者列表

ziwen 1 year ago
parent
commit
e699e81bee
3 changed files with 56 additions and 1 deletions
  1. 33 1
      controllers/yanxuan_special.go
  2. 14 0
      models/cygx_yanxuan_special_user.go
  3. 9 0
      routers/commentsRouter.go

+ 33 - 1
controllers/yanxuan_special.go

@@ -757,4 +757,36 @@ func (this *YanxuanSpecialController) Cancel() {
 	br.Msg = "取消发布成功"
 	br.Ret = 200
 	br.Success = true
-}
+}
+
+// @Title 作者列表
+// @Description 作者列表
+// @Param	request	body help_doc.AddHelpDocReq true "type json string"
+// @Success 200 {object} models.AddEnglishReportResp
+// @router /author/list [get]
+func (this *YanxuanSpecialController) AuthorList() {
+	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
+	}
+
+	list, tmpErr := models.GetYanxuanSpecialAuthorList()
+	if tmpErr != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
+		return
+	}
+
+	br.Data = list
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+}

+ 14 - 0
models/cygx_yanxuan_special_user.go

@@ -94,3 +94,17 @@ func UpdateYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (err error) {
 	_, err = o.Raw(sql, item.SpecialName, item.Introduction, item.Label, item.NickName, item.UserId).Exec()
 	return
 }
+
+
+func GetYanxuanSpecialAuthorList() (items []*CygxYanxuanSpecialAuthorItem, err error) {
+	o := orm.NewOrm()
+	sql := ``
+	sql = `SELECT
+	a.*,c.company_name  
+FROM
+	cygx_yanxuan_special_author as a
+	INNER JOIN wx_user AS u ON u.user_id = a.user_id
+	INNER JOIN company AS c ON c.company_id = u.company_id ORDER BY create_time DESC `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 9 - 0
routers/commentsRouter.go

@@ -1654,6 +1654,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"],
+        beego.ControllerComments{
+            Method: "AuthorList",
+            Router: `/author/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:YanxuanSpecialController"],
         beego.ControllerComments{
             Method: "AuthorSave",