|
@@ -296,9 +296,30 @@ func (this *YanxuanSpecialMessageController) MessageTop() {
|
|
|
|
|
|
messageId := req.MessageId
|
|
|
doType := req.DoType
|
|
|
+
|
|
|
+ messagerDetail, err := models.GetCygxYanxuanSpecialMessagerDetailById(messageId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败!"
|
|
|
+ br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
+ }
|
|
|
+ yanxuanSpecialId := messagerDetail.YanxuanSpecialId
|
|
|
var topTime int
|
|
|
+ var msgContent string
|
|
|
if doType == 1 {
|
|
|
+ countTop, err := models.GetCygxYanxuanSpecialMessagerCountTop(yanxuanSpecialId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败!"
|
|
|
+ br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if countTop > 0 {
|
|
|
+ br.Msg = "此文章已有置顶留言"
|
|
|
+ return
|
|
|
+ }
|
|
|
topTime = int(time.Now().Unix())
|
|
|
+ msgContent = "已置顶"
|
|
|
+ } else {
|
|
|
+ msgContent = "已取消置顶"
|
|
|
}
|
|
|
err = models.UpdateCygxYanxuanSpecialMessageTopTime(topTime, messageId)
|
|
|
if err != nil {
|
|
@@ -308,7 +329,7 @@ func (this *YanxuanSpecialMessageController) MessageTop() {
|
|
|
}
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
- br.Msg = "操作成功"
|
|
|
+ br.Msg = msgContent
|
|
|
}
|
|
|
|
|
|
// @Title 公开/取消公开留言
|
|
@@ -341,9 +362,13 @@ func (this *YanxuanSpecialMessageController) MessagePublic() {
|
|
|
doType := req.DoType
|
|
|
var status int
|
|
|
var publicTime string
|
|
|
+ var msgContent string
|
|
|
if doType == 1 {
|
|
|
status = 1
|
|
|
publicTime = time.Now().Format(utils.FormatDateTime)
|
|
|
+ msgContent = "已公开"
|
|
|
+ } else {
|
|
|
+ msgContent = "已取消公开"
|
|
|
}
|
|
|
|
|
|
err = models.UpdateCygxYanxuanSpecialMessageStatus(status, publicTime, messageIds)
|
|
@@ -354,7 +379,7 @@ func (this *YanxuanSpecialMessageController) MessagePublic() {
|
|
|
}
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
- br.Msg = "操作成功"
|
|
|
+ br.Msg = msgContent
|
|
|
}
|
|
|
|
|
|
// @Title 点赞/取消点赞
|
|
@@ -393,7 +418,7 @@ func (this *YanxuanSpecialMessageController) MessageLike() {
|
|
|
br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ var msgContent string
|
|
|
if doType == 1 {
|
|
|
if total == 0 {
|
|
|
item := new(models.CygxYanxuanSpecialMessageLike)
|
|
@@ -414,6 +439,7 @@ func (this *YanxuanSpecialMessageController) MessageLike() {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ msgContent = "已点赞"
|
|
|
} else {
|
|
|
if total > 0 {
|
|
|
err = models.DeleteCygxYanxuanSpecialMessageLike(userId, messageId)
|
|
@@ -423,11 +449,12 @@ func (this *YanxuanSpecialMessageController) MessageLike() {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ msgContent = "已取消点赞"
|
|
|
}
|
|
|
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
- br.Msg = "操作成功"
|
|
|
+ br.Msg = msgContent
|
|
|
}
|
|
|
|
|
|
// @Title 专栏文章留言列表
|