xingzai 1 år sedan
förälder
incheckning
ace158c381

+ 43 - 0
controllers/cygx/yanxuan_special.go

@@ -711,3 +711,46 @@ func (this *YanxuanSpecialController) ShowButton() {
 	br.Success = true
 	br.Msg = "获取成功"
 }
+
+// @Title 作者粉丝列表
+// @Description 作者粉丝列表
+// @Param   SpecialAuthorId    query   int  true       "作者ID"
+// @Success 200 {object} models.AddEnglishReportResp
+// @router /yanxuan_special/special_author_fans_list [get]
+func (this *YanxuanSpecialController) SpecialAuthorFansList() {
+	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
+	}
+	specialAuthorId, _ := this.GetInt("SpecialAuthorId")
+	detail, err := cygx.GetCygxYanxuanSpecialAuthorItemById(specialAuthorId)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition += " AND follow_user_id = ?  	ORDER BY a.create_time DESC  "
+	pars = append(pars, detail.UserId)
+	list, err := cygx.GetCygxYanxuanSpecialFollowList(condition, pars, 0, 100000)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	resp := new(cygx.GetCygxYanxuanSpecialFollowResp)
+	resp.List = list
+	br.Data = resp
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+}

+ 35 - 0
models/cygx/cygx_yanxuan_special_follow.go

@@ -0,0 +1,35 @@
+package cygx
+
+import "github.com/beego/beego/v2/client/orm"
+
+type CygxYanxuanSpecialFollowResp struct {
+	CygxYanxuanSpecialFollowId int    `orm:"column(cygx_yanxuan_special_follow_id);pk"`
+	UserId                     int    // 用户ID
+	FollowUserId               int    // 被关注用户ID
+	Mobile                     string // 手机号
+	Email                      string // 邮箱
+	CompanyId                  int    // 公司ID
+	CompanyName                string // 公司名称
+	RealName                   string // 用户实际名称
+	SellerName                 string // 所属销售
+	CreateTime                 string // 创建时间
+	ModifyTime                 string // 修改时间
+	RegisterPlatform           int    // 来源 1小程序,2:网页
+	YanxuanSpecialId           int    // cygx_yanxuan_special 表主键ID
+}
+
+func GetCygxYanxuanSpecialFollowList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxYanxuanSpecialFollowResp, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := ``
+	sql = `SELECT * FROM cygx_yanxuan_special_follow AS a WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+type GetCygxYanxuanSpecialFollowResp struct {
+	List []*CygxYanxuanSpecialFollowResp
+}

+ 9 - 2
models/cygx/cygx_yanxuan_special_user.go

@@ -98,9 +98,8 @@ func GetYanxuanSpecialAuthorList(condition string, pars []interface{}, startSize
 	if condition != "" {
 		sql += condition
 	}
-	//sql += ` LIMIT ?,?  `
+	sql += ` LIMIT ?,?  `
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
 
@@ -112,3 +111,11 @@ func UpdateSpecialAuthorComapony(userId, CompanyId int, CompanyName string) (err
 	_, err = o.Raw(sql, CompanyId, CompanyName, userId).Exec()
 	return
 }
+
+// 通过ID获取详情
+func GetCygxYanxuanSpecialAuthorItemById(id int) (item *CygxYanxuanSpecialAuthorItem, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_yanxuan_special_author  WHERE id=? `
+	err = o.Raw(sql, id).QueryRow(&item)
+	return
+}

+ 9 - 0
routers/commentsRouter.go

@@ -3085,6 +3085,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: "SpecialAuthorFansList",
+            Router: `/yanxuan_special/special_author_fans_list`,
+            AllowHTTPMethods: []string{"get"},
+            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: "SpecialCollectList",