Browse Source

no message

xingzai 11 months ago
parent
commit
66816c8322

+ 50 - 0
controllers/cygx/yanxuan_special.go

@@ -79,6 +79,8 @@ func (this *YanxuanSpecialController) Add() {
 		MobileInit:  infoUser.Mobile,
 		CompanyName: infoUser.CompanyName,
 		CompanyId:   infoUser.CompanyId,
+		InviteName:  req.InviteName,
+		Remark:      req.Remark,
 		CreateTime:  time.Now(),
 		ModifyTime:  time.Now(),
 		HeadImg:     utils.CYGX_YANXUAN_SPECIAL_HEAD_IMG_URL + strconv.Itoa(rnd) + ".png",
@@ -157,6 +159,7 @@ func (this *YanxuanSpecialController) AuthorEnable() {
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Param   Status   query   string  true       "状态: 1:启用 、 2:禁用 。传其他默认所有"
 // @Param   KeyWord   query   string  false       "搜索关键词"
+// @Param   NickName   query   string  false       "昵称"
 // @Param   SortParam   query   string  false       "排序字段参数,用来排序的字段, 枚举值:'CreatTime':开通时间 、 'articleNum':已发布文章 、 'pv':总Pv/Uv "
 // @Param   SortType   query   string  true       "如何排序,是正序还是倒序,枚举值:`asc 正序`,`desc 倒叙`"
 // @Success 200 {object} models.AddEnglishReportResp
@@ -182,6 +185,7 @@ func (this *YanxuanSpecialController) AuthorList() {
 	//排序参数
 	sortParam := this.GetString("SortParam")
 	sortType := this.GetString("SortType")
+	nickName := this.GetString("NickName")
 
 	var startSize int
 	if pageSize <= 0 {
@@ -206,6 +210,13 @@ func (this *YanxuanSpecialController) AuthorList() {
 		pars = append(pars, keyWord)
 	}
 
+	//关键词搜索
+	if nickName != "" {
+		nickName = "%" + nickName + "%"
+		condition += ` AND art.nick_name like  ? `
+		pars = append(pars, nickName)
+	}
+
 	//排序字段以及排序方式处理
 	var sortStr string
 	if sortParam != "" && sortType != "" {
@@ -874,3 +885,42 @@ func init_928() {
 	}
 	return
 }
+
+// @Title 修改作者信息
+// @Description 修改作者信息接口
+// @Param	request	body help_doc.AddHelpDocReq true "type json string"
+// @router /yanxuan_special/author/update [post]
+func (this *YanxuanSpecialController) AuthorUpdate() {
+	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
+	}
+	var req cygx.AddCygxYanxuanSpecialAuthorReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	if req.UserId <= 0 {
+		br.Msg = "请输入用户信息"
+		return
+	}
+	err = cygx.UpdateYanxuanSpecialAuthorInviteName(req.InviteName, req.Remark, req.UserId)
+	if err != nil {
+		br.Msg = "新增失败"
+		br.ErrMsg = "新增失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "修改成功"
+}

+ 18 - 3
models/cygx/cygx_yanxuan_special_user.go

@@ -25,6 +25,8 @@ type CygxYanxuanSpecialAuthor struct {
 	Status       int       // 1启用2禁用
 	CompanyId    int       `description:"公司id"`
 	CompanyName  string    `description:"公司名称"`
+	InviteName   string    //引荐人
+	Remark       string    //备注
 }
 
 type CygxYanxuanSpecialAuthorItem struct {
@@ -51,6 +53,8 @@ type CygxYanxuanSpecialAuthorItem struct {
 	FansNum            int    // 粉丝数量
 	ArticleCollectNum  int    // 文章收藏数量
 	SpecialAuthorId    int    //cygx_yanxuan_special_author 表主键ID 作者专栏ID
+	InviteName         string //引荐人
+	Remark             string //备注
 }
 
 func AddCygxYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (lastId int64, err error) {
@@ -60,9 +64,11 @@ func AddCygxYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (lastId int64,
 }
 
 type AddCygxYanxuanSpecialAuthorReq struct {
-	UserId   int    // 用户ID
-	RealName string // 姓名
-	Mobile   string // 手机号
+	UserId     int    // 用户ID
+	RealName   string // 姓名
+	Mobile     string // 手机号
+	InviteName string //引荐人
+	Remark     string //备注
 }
 
 type EnableCygxYanxuanSpecialAuthorReq struct {
@@ -147,3 +153,12 @@ func UpdateSpecialAuthormobile_init(mobile_init string, userId int) (err error)
 	_, err = o.Raw(sql, mobile_init, userId).Exec()
 	return
 }
+
+// 更新作者引荐人相关信息
+func UpdateYanxuanSpecialAuthorInviteName(inviteName, remark string, userId int) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := ``
+	sql = `UPDATE cygx_yanxuan_special_author SET invite_name=? , remark = ?  WHERE user_id = ? `
+	_, err = o.Raw(sql, inviteName, remark, userId).Exec()
+	return
+}

+ 9 - 0
routers/commentsRouter.go

@@ -3076,6 +3076,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"],
+        beego.ControllerComments{
+            Method: "AuthorUpdate",
+            Router: `/yanxuan_special/author/update`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"],
         beego.ControllerComments{
             Method: "Enable",