|
@@ -259,7 +259,7 @@ func (this *YanxuanSpecialController) Detail() {
|
|
|
br.ErrMsg = "获取失败, Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if followCount == 1 {
|
|
|
+ if followCount > 0 {
|
|
|
resp.IsFollowAuthor = true
|
|
|
}
|
|
|
}
|
|
@@ -495,6 +495,9 @@ func (this *YanxuanSpecialController) AuthorDetail() {
|
|
|
br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
|
|
|
return
|
|
|
}
|
|
|
+ if item.IsFollow > 0 {
|
|
|
+ item.IsFollow = 1
|
|
|
+ }
|
|
|
|
|
|
br.Data = item
|
|
|
br.Ret = 200
|
|
@@ -799,26 +802,34 @@ func (this *YanxuanSpecialController) Follow() {
|
|
|
}
|
|
|
|
|
|
if req.Status == 1 {
|
|
|
- item := models.CygxYanxuanSpecialFollow{
|
|
|
- UserId: user.UserId,
|
|
|
- FollowUserId: req.FollowUserId,
|
|
|
- Mobile: user.Mobile,
|
|
|
- Email: user.Email,
|
|
|
- CompanyId: user.CompanyId,
|
|
|
- CompanyName: user.CompanyName,
|
|
|
- RealName: user.RealName,
|
|
|
- SellerName: sellerName,
|
|
|
- CreateTime: time.Now(),
|
|
|
- ModifyTime: time.Now(),
|
|
|
- RegisterPlatform: utils.REGISTER_PLATFORM,
|
|
|
- YanxuanSpecialId: req.SpecialId,
|
|
|
- }
|
|
|
- err = models.AddCygxYanxuanSpecialFollow(&item)
|
|
|
+ followCount, err := models.GetCygxYanxuanSpecialFollowCountByUser(user.UserId, req.FollowUserId)
|
|
|
if err != nil {
|
|
|
- br.Msg = "新增失败"
|
|
|
- br.ErrMsg = "新增失败,Err:" + err.Error()
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败, Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ if followCount == 0 {
|
|
|
+ item := models.CygxYanxuanSpecialFollow{
|
|
|
+ UserId: user.UserId,
|
|
|
+ FollowUserId: req.FollowUserId,
|
|
|
+ Mobile: user.Mobile,
|
|
|
+ Email: user.Email,
|
|
|
+ CompanyId: user.CompanyId,
|
|
|
+ CompanyName: user.CompanyName,
|
|
|
+ RealName: user.RealName,
|
|
|
+ SellerName: sellerName,
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ RegisterPlatform: utils.REGISTER_PLATFORM,
|
|
|
+ YanxuanSpecialId: req.SpecialId,
|
|
|
+ }
|
|
|
+ err = models.AddCygxYanxuanSpecialFollow(&item)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "新增失败"
|
|
|
+ br.ErrMsg = "新增失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
br.Msg = "关注成功"
|
|
|
} else {
|
|
|
err = models.DelCygxYanxuanSpecialFollow(user.UserId, req.FollowUserId)
|