|
@@ -36,15 +36,15 @@ func (this *YanxuanSpecialController) List() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- userId, _ := this.GetInt("UserId", 0)
|
|
|
+ specialColumnId, _ := this.GetInt("SpecialColumnId", 0)
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
|
|
|
var specialUser *models.CygxYanxuanSpecialAuthorItem
|
|
|
var err error
|
|
|
- if userId > 0 {
|
|
|
- condition += ` AND a.user_id = ? `
|
|
|
- pars = append(pars, userId)
|
|
|
+ if specialColumnId > 0 {
|
|
|
+ condition += ` AND b.id = ? `
|
|
|
+ pars = append(pars, specialColumnId)
|
|
|
}
|
|
|
|
|
|
specialUser, err = models.GetYanxuanSpecialAuthor(sysUser.UserId, sysUser.UserId)
|
|
@@ -88,13 +88,21 @@ func (this *YanxuanSpecialController) List() {
|
|
|
if v.MyCollectNum > 0 {
|
|
|
v.IsCollect = 1
|
|
|
}
|
|
|
- imgList := strings.Split(v.ImgUrl, ",")
|
|
|
- for _, s := range imgList {
|
|
|
- v.ImgUrlList = append(v.ImgUrlList, s)
|
|
|
+ if v.ImgUrl != "" {
|
|
|
+ imgList := strings.Split(v.ImgUrl, ",")
|
|
|
+ for _, s := range imgList {
|
|
|
+ v.ImgUrlList = append(v.ImgUrlList, s)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ v.ImgUrlList = []string{}
|
|
|
}
|
|
|
- tagList := strings.Split(v.Tags,",")
|
|
|
- for _, s := range tagList {
|
|
|
- v.TagList = append(v.TagList, s)
|
|
|
+ if v.Tags != "" {
|
|
|
+ tagList := strings.Split(v.Tags, ",")
|
|
|
+ for _, s := range tagList {
|
|
|
+ v.TagList = append(v.TagList, s)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ v.TagList = []string{}
|
|
|
}
|
|
|
}
|
|
|
resp := new(models.SpecialListResp)
|
|
@@ -195,8 +203,8 @@ func (this *YanxuanSpecialController) AuthorSave() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if req.UserId <= 0 {
|
|
|
- br.Msg = "用户id有误"
|
|
|
+ if req.SpecialColumnId <= 0 {
|
|
|
+ br.Msg = "栏目id有误"
|
|
|
return
|
|
|
}
|
|
|
if req.SpecialName == "" {
|
|
@@ -209,7 +217,8 @@ func (this *YanxuanSpecialController) AuthorSave() {
|
|
|
}
|
|
|
|
|
|
item := models.CygxYanxuanSpecialAuthor{
|
|
|
- UserId: req.UserId,
|
|
|
+ Id: req.SpecialColumnId,
|
|
|
+ UserId: sysUser.UserId,
|
|
|
SpecialName: req.SpecialName,
|
|
|
Introduction: req.Introduction,
|
|
|
Label: req.Label,
|
|
@@ -347,11 +356,9 @@ func (this *YanxuanSpecialController) AuthorDetail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- userId, _ := this.GetInt("UserId", 0)
|
|
|
- if userId == 0 {
|
|
|
- userId = sysUser.UserId
|
|
|
- }
|
|
|
- item, tmpErr := models.GetYanxuanSpecialAuthor(userId, sysUser.UserId)
|
|
|
+ specialColumnId, _ := this.GetInt("SpecialColumnId", 0)
|
|
|
+
|
|
|
+ item, tmpErr := models.GetYanxuanSpecialAuthorBySpecialColumnId(specialColumnId, sysUser.UserId)
|
|
|
if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
|
|
@@ -628,8 +635,8 @@ func (this *YanxuanSpecialController) Follow() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if req.FollowUserId <= 0 {
|
|
|
- br.Msg = "被关注的用户id"
|
|
|
+ if req.FollowSpecialColumnId <= 0 {
|
|
|
+ br.Msg = "被关注的专栏栏目id错误"
|
|
|
return
|
|
|
}
|
|
|
if req.Status <= 0 {
|
|
@@ -643,10 +650,17 @@ func (this *YanxuanSpecialController) Follow() {
|
|
|
br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ authorItem, err := models.GetYanxuanSpecialAuthorById(req.FollowSpecialColumnId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询栏目详情失败!"
|
|
|
+ br.ErrMsg = "查询栏目详情失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if req.Status == 1 {
|
|
|
item := models.CygxYanxuanSpecialFollow{
|
|
|
UserId: sysUser.UserId,
|
|
|
- FollowUserId: req.FollowUserId,
|
|
|
+ FollowUserId: authorItem.UserId,
|
|
|
Mobile: sysUser.Mobile,
|
|
|
Email: sysUser.Email,
|
|
|
CompanyId: sysUser.CompanyId,
|
|
@@ -666,7 +680,7 @@ func (this *YanxuanSpecialController) Follow() {
|
|
|
}
|
|
|
br.Msg = "关注成功"
|
|
|
} else {
|
|
|
- err = models.DelCygxYanxuanSpecialFollow(sysUser.UserId, req.FollowUserId)
|
|
|
+ err = models.DelCygxYanxuanSpecialFollow(sysUser.UserId, authorItem.UserId)
|
|
|
if err != nil {
|
|
|
br.Msg = "删除失败"
|
|
|
br.ErrMsg = "删除失败,Err:" + err.Error()
|
|
@@ -876,8 +890,8 @@ func (this *YanxuanSpecialController) AuthorHeadImg() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if req.UserId <= 0 {
|
|
|
- br.Msg = "用户id有误"
|
|
|
+ if req.SpecialColumnId <= 0 {
|
|
|
+ br.Msg = "专栏栏目id错误"
|
|
|
return
|
|
|
}
|
|
|
if req.HeadImg == "" {
|
|
@@ -886,7 +900,7 @@ func (this *YanxuanSpecialController) AuthorHeadImg() {
|
|
|
}
|
|
|
|
|
|
item := models.CygxYanxuanSpecialAuthor{
|
|
|
- UserId: req.UserId,
|
|
|
+ Id: req.SpecialColumnId,
|
|
|
HeadImg: req.HeadImg,
|
|
|
}
|
|
|
|
|
@@ -920,7 +934,7 @@ func (this *YanxuanSpecialController) Delete() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
- var req models.EnableCygxYanxuanSpecialReq
|
|
|
+ var req models.DelCygxYanxuanSpecialReq
|
|
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
if err != nil {
|
|
|
br.Msg = "参数解析异常!"
|