refactor: reorganize modules and add Linux build tooling
This commit is contained in:
36
module/base/cms/internal/logic/post/incr_comment_unlike.go
Normal file
36
module/base/cms/internal/logic/post/incr_comment_unlike.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package post
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"bsm/full/module/base/cms/internal/impl"
|
||||
"bsm/full/module/base/cms/internal/models"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
"git.apinb.com/bsm-sdk/core/utils"
|
||||
|
||||
pb "bsm/full/module/base/cms/pb"
|
||||
)
|
||||
|
||||
// 评论点踩处理
|
||||
func IncrCommentUnlike(ctx context.Context, in *pb.CommentOpIdentityRequest) (*pb.StatusReply, error) {
|
||||
_, err := service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var cnt int64
|
||||
if in.GetCommentIdentity() == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
err = models.IncrOrDescCommentField(in.CommentIdentity, "unlike_hits", false)
|
||||
if err != nil {
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
if err := impl.DBService.Model(&models.CmsComment{}).Where("identity = ?", in.CommentIdentity).
|
||||
Pluck("unlike_hits", &cnt).Error; err != nil {
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
return &pb.StatusReply{
|
||||
Details: utils.Int642String(cnt),
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user