🎨 improvement of comment-related code and database structure
This commit is contained in:
@@ -103,16 +103,16 @@ type (
|
||||
// 评论列表请求参数
|
||||
CommentListRequest {
|
||||
TopicId string `json:"topic_id"`
|
||||
Page int64 `json:"page,default=1,optional"`
|
||||
Size int64 `json:"size,default=5,optional"`
|
||||
Page int `json:"page,default=1,optional"`
|
||||
Size int `json:"size,default=5,optional"`
|
||||
IsHot bool `json:"is_hot,default=true,optional"`
|
||||
}
|
||||
// 回复列表请求参数
|
||||
ReplyListRequest {
|
||||
TopicId string `json:"topic_id"`
|
||||
CommentId int64 `json:"comment_id"`
|
||||
Page int64 `json:"page,default=1,optional"`
|
||||
Size int64 `json:"size,default=5,optional"`
|
||||
Page int `json:"page,default=1,optional"`
|
||||
Size int `json:"size,default=5,optional"`
|
||||
}
|
||||
// 点赞评论的请求参数
|
||||
CommentLikeRequest {
|
||||
|
@@ -2,7 +2,9 @@ package comment
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
|
||||
@@ -24,7 +26,34 @@ func NewDislikeCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Di
|
||||
}
|
||||
|
||||
func (l *DislikeCommentLogic) DislikeComment(req *types.CommentDisLikeRequest) (resp *types.Response, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
uid, ok := l.ctx.Value("user_id").(string)
|
||||
if !ok {
|
||||
return nil, errors.New("user_id not found in context")
|
||||
}
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
commentLike := l.svcCtx.DB.ScaCommentLike
|
||||
resultInfo, err := tx.ScaCommentLike.Where(commentLike.TopicID.Eq(req.TopicId), commentLike.CommentID.Eq(req.CommentId), commentLike.UserID.Eq(uid)).Delete()
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
if resultInfo.RowsAffected == 0 {
|
||||
_ = tx.Rollback()
|
||||
return response.ErrorWithI18n(l.ctx, "comment.CancelLikeError"), nil
|
||||
}
|
||||
comment := l.svcCtx.DB.ScaCommentReply
|
||||
updates, err := tx.ScaCommentReply.Where(comment.TopicID.Eq(req.TopicId), comment.ID.Eq(req.CommentId)).Update(comment.Likes, comment.Likes.Sub(1))
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
if updates.RowsAffected == 0 {
|
||||
_ = tx.Rollback()
|
||||
return response.ErrorWithI18n(l.ctx, "comment.LikeError"), nil
|
||||
}
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response.Success(), nil
|
||||
}
|
||||
|
@@ -2,17 +2,28 @@ package comment
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/chenmingyong0423/go-mongox/v2/builder/query"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/utils"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mongodb/collection"
|
||||
)
|
||||
|
||||
type GetCommentListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
wg sync.WaitGroup
|
||||
}
|
||||
|
||||
func NewGetCommentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCommentListLogic {
|
||||
@@ -25,11 +36,128 @@ func NewGetCommentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge
|
||||
|
||||
func (l *GetCommentListLogic) GetCommentList(req *types.CommentListRequest) (resp *types.Response, err error) {
|
||||
// 获取用户ID
|
||||
// uid, ok := l.ctx.Value("user_id").(string)
|
||||
// if !ok {
|
||||
// return nil, errors.New("user_id not found in context")
|
||||
// }
|
||||
uid, ok := l.ctx.Value("user_id").(string)
|
||||
if !ok {
|
||||
return nil, errors.New("user_id not found in context")
|
||||
}
|
||||
var commentQueryList []types.CommentListQueryResult
|
||||
comment := l.svcCtx.DB.ScaCommentReply
|
||||
user := l.svcCtx.DB.ScaAuthUser
|
||||
var orderConditions []field.Expr
|
||||
|
||||
// 查询评论列表
|
||||
return
|
||||
if req.IsHot {
|
||||
orderConditions = append(orderConditions, comment.Likes.Desc(), comment.ReplyCount.Desc())
|
||||
} else {
|
||||
orderConditions = append(orderConditions, comment.CreatedAt.Desc())
|
||||
}
|
||||
count, err := comment.Select(
|
||||
comment.ID,
|
||||
comment.UserID,
|
||||
comment.TopicID,
|
||||
comment.Content,
|
||||
comment.CreatedAt,
|
||||
comment.Author,
|
||||
comment.Likes,
|
||||
comment.ReplyCount,
|
||||
comment.Browser,
|
||||
comment.OperatingSystem,
|
||||
comment.Location,
|
||||
user.Avatar,
|
||||
user.Nickname,
|
||||
).LeftJoin(user, comment.UserID.EqCol(user.UID)).
|
||||
Where(comment.TopicID.Eq(req.TopicId), comment.CommentType.Eq(constant.COMMENT)).
|
||||
Order(orderConditions...).
|
||||
ScanByPage(&commentQueryList, (req.Page-1)*req.Size, req.Size)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if count == 0 || len(commentQueryList) == 0 {
|
||||
return response.SuccessWithData(types.CommentListPageResponse{
|
||||
Total: count,
|
||||
Size: req.Size,
|
||||
Current: req.Page,
|
||||
}), nil
|
||||
}
|
||||
// **************** 获取评论Id和用户Id ************
|
||||
commentIds := make([]int64, 0, len(commentQueryList))
|
||||
for _, commentList := range commentQueryList {
|
||||
commentIds = append(commentIds, commentList.ID)
|
||||
}
|
||||
l.wg.Add(2)
|
||||
|
||||
// *************** 获取评论点赞状态 **********
|
||||
likeMap := make(map[int64]bool)
|
||||
go func() {
|
||||
defer l.wg.Done()
|
||||
commentLike := l.svcCtx.DB.ScaCommentLike
|
||||
likeList, err := commentLike.Where(
|
||||
commentLike.TopicID.Eq(req.TopicId),
|
||||
commentLike.UserID.Eq(uid),
|
||||
commentLike.CommentID.In(commentIds...)).
|
||||
Find()
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
for _, like := range likeList {
|
||||
likeMap[like.CommentID] = true
|
||||
}
|
||||
}()
|
||||
// ***************获取评论图片 **********
|
||||
commentImageMap := make(map[int64][]string)
|
||||
go func() {
|
||||
defer l.wg.Done()
|
||||
newCollection := collection.MustNewCollection[types.CommentImages](l.svcCtx, constant.COMMENT_IMAGES)
|
||||
commentImages, err := newCollection.Finder().
|
||||
Filter(query.Eq("topic_id", req.TopicId)).
|
||||
Filter(query.In("comment_id", commentIds...)).
|
||||
Find(l.ctx)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, image := range commentImages {
|
||||
if len(image.Images) == 0 {
|
||||
continue
|
||||
}
|
||||
imagesBase64 := make([]string, len(image.Images))
|
||||
for i, img := range image.Images {
|
||||
imagesBase64[i] = fmt.Sprintf("data:%s;base64,%s", utils.GetMimeType(img), base64.StdEncoding.EncodeToString(img))
|
||||
}
|
||||
commentImageMap[image.CommentId] = imagesBase64
|
||||
}
|
||||
}()
|
||||
l.wg.Wait()
|
||||
|
||||
// *************** 组装数据 **********
|
||||
result := make([]types.CommentContent, 0, len(commentQueryList))
|
||||
for _, commentData := range commentQueryList {
|
||||
commentContent := types.CommentContent{
|
||||
Avatar: commentData.Avatar,
|
||||
NickName: commentData.Nickname,
|
||||
Content: commentData.Content,
|
||||
CreatedTime: commentData.CreatedAt,
|
||||
Level: 0,
|
||||
Id: commentData.ID,
|
||||
UserId: commentData.UserID,
|
||||
TopicId: commentData.TopicID,
|
||||
IsAuthor: commentData.Author,
|
||||
Likes: commentData.Likes,
|
||||
ReplyCount: commentData.ReplyCount,
|
||||
Location: commentData.Location,
|
||||
Browser: commentData.Browser,
|
||||
OperatingSystem: commentData.OperatingSystem,
|
||||
IsLiked: likeMap[commentData.ID],
|
||||
Images: commentImageMap[commentData.ID],
|
||||
}
|
||||
result = append(result, commentContent)
|
||||
}
|
||||
commentListPageResponse := types.CommentListPageResponse{
|
||||
Total: count,
|
||||
Size: req.Size,
|
||||
Current: req.Page,
|
||||
Comments: result,
|
||||
}
|
||||
return response.SuccessWithData(commentListPageResponse), nil
|
||||
}
|
||||
|
@@ -2,9 +2,19 @@ package comment
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/chenmingyong0423/go-mongox/v2/builder/query"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/utils"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mongodb/collection"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@@ -13,6 +23,7 @@ type GetReplyListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
wg sync.WaitGroup
|
||||
}
|
||||
|
||||
func NewGetReplyListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetReplyListLogic {
|
||||
@@ -24,7 +35,134 @@ func NewGetReplyListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetR
|
||||
}
|
||||
|
||||
func (l *GetReplyListLogic) GetReplyList(req *types.ReplyListRequest) (resp *types.Response, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
// 获取用户ID
|
||||
uid, ok := l.ctx.Value("user_id").(string)
|
||||
if !ok {
|
||||
return nil, errors.New("user_id not found in context")
|
||||
}
|
||||
var replyQueryList []types.ReplyListQueryResult
|
||||
reply := l.svcCtx.DB.ScaCommentReply
|
||||
user := l.svcCtx.DB.ScaAuthUser
|
||||
commentUser := user.As("comment_user")
|
||||
replyUser := user.As("reply_user")
|
||||
|
||||
return
|
||||
count, err := reply.Select(
|
||||
reply.ID,
|
||||
reply.UserID,
|
||||
reply.TopicID,
|
||||
reply.Content,
|
||||
reply.CreatedAt,
|
||||
reply.Author,
|
||||
reply.ReplyCount,
|
||||
reply.Likes,
|
||||
reply.Browser,
|
||||
reply.OperatingSystem,
|
||||
reply.Location,
|
||||
reply.ReplyUser,
|
||||
reply.ReplyTo,
|
||||
reply.ReplyID,
|
||||
commentUser.Avatar,
|
||||
commentUser.Nickname,
|
||||
replyUser.Nickname.As("reply_nickname"),
|
||||
).LeftJoin(commentUser, reply.UserID.EqCol(commentUser.UID)).
|
||||
LeftJoin(replyUser, reply.ReplyUser.EqCol(replyUser.UID)).
|
||||
Where(reply.TopicID.Eq(req.TopicId), reply.CommentType.Eq(constant.REPLY)).
|
||||
Order(reply.Likes.Desc(), reply.CreatedAt.Desc()).
|
||||
ScanByPage(&replyQueryList, (req.Page-1)*req.Size, req.Size)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if count == 0 || len(replyQueryList) == 0 {
|
||||
return response.SuccessWithData(types.CommentListPageResponse{
|
||||
Total: count,
|
||||
Size: req.Size,
|
||||
Current: req.Page,
|
||||
}), nil
|
||||
}
|
||||
// **************** 获取评论Id和用户Id ************
|
||||
commentIds := make([]int64, 0, len(replyQueryList))
|
||||
for _, commentList := range replyQueryList {
|
||||
commentIds = append(commentIds, commentList.ID)
|
||||
}
|
||||
l.wg.Add(2)
|
||||
|
||||
// *************** 获取评论点赞状态 **********
|
||||
likeMap := make(map[int64]bool)
|
||||
go func() {
|
||||
defer l.wg.Done()
|
||||
commentLike := l.svcCtx.DB.ScaCommentLike
|
||||
likeList, err := commentLike.Where(
|
||||
commentLike.TopicID.Eq(req.TopicId),
|
||||
commentLike.UserID.Eq(uid),
|
||||
commentLike.CommentID.In(commentIds...)).
|
||||
Find()
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
for _, like := range likeList {
|
||||
likeMap[like.CommentID] = true
|
||||
}
|
||||
}()
|
||||
// ***************获取评论图片 **********
|
||||
commentImageMap := make(map[int64][]string)
|
||||
go func() {
|
||||
defer l.wg.Done()
|
||||
newCollection := collection.MustNewCollection[types.CommentImages](l.svcCtx, constant.COMMENT_IMAGES)
|
||||
commentImages, err := newCollection.Finder().
|
||||
Filter(query.Eq("topic_id", req.TopicId)).
|
||||
Filter(query.In("comment_id", commentIds...)).
|
||||
Find(l.ctx)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, image := range commentImages {
|
||||
if len(image.Images) == 0 {
|
||||
continue
|
||||
}
|
||||
imagesBase64 := make([]string, len(image.Images))
|
||||
for i, img := range image.Images {
|
||||
imagesBase64[i] = fmt.Sprintf("data:%s;base64,%s", utils.GetMimeType(img), base64.StdEncoding.EncodeToString(img))
|
||||
}
|
||||
commentImageMap[image.CommentId] = imagesBase64
|
||||
}
|
||||
}()
|
||||
l.wg.Wait()
|
||||
|
||||
// *************** 组装数据 **********
|
||||
result := make([]types.CommentContent, 0, len(replyQueryList))
|
||||
for _, replyData := range replyQueryList {
|
||||
commentContent := types.CommentContent{
|
||||
Avatar: replyData.Avatar,
|
||||
NickName: replyData.Nickname,
|
||||
Content: replyData.Content,
|
||||
CreatedTime: replyData.CreatedAt,
|
||||
Level: 0,
|
||||
Id: replyData.ID,
|
||||
UserId: replyData.UserID,
|
||||
TopicId: replyData.TopicID,
|
||||
IsAuthor: replyData.Author,
|
||||
Likes: replyData.Likes,
|
||||
ReplyCount: replyData.ReplyCount,
|
||||
Location: replyData.Location,
|
||||
Browser: replyData.Browser,
|
||||
OperatingSystem: replyData.OperatingSystem,
|
||||
IsLiked: likeMap[replyData.ID],
|
||||
Images: commentImageMap[replyData.ID],
|
||||
ReplyUser: replyData.ReplyUser,
|
||||
ReplyTo: replyData.ReplyTo,
|
||||
ReplyId: replyData.ReplyId,
|
||||
ReplyNickname: replyData.ReplyNickname,
|
||||
}
|
||||
result = append(result, commentContent)
|
||||
}
|
||||
commentListPageResponse := types.CommentListPageResponse{
|
||||
Total: count,
|
||||
Size: req.Size,
|
||||
Current: req.Page,
|
||||
Comments: result,
|
||||
}
|
||||
return response.SuccessWithData(commentListPageResponse), nil
|
||||
}
|
||||
|
@@ -2,9 +2,13 @@ package comment
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@@ -24,7 +28,35 @@ func NewLikeCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeC
|
||||
}
|
||||
|
||||
func (l *LikeCommentLogic) LikeComment(req *types.CommentLikeRequest) (resp *types.Response, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
uid, ok := l.ctx.Value("user_id").(string)
|
||||
if !ok {
|
||||
return nil, errors.New("user_id not found in context")
|
||||
}
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
commentLike := &model.ScaCommentLike{
|
||||
CommentID: req.CommentId,
|
||||
TopicID: req.TopicId,
|
||||
UserID: uid,
|
||||
LikeTime: time.Now(),
|
||||
}
|
||||
err = tx.ScaCommentLike.Create(commentLike)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
comment := l.svcCtx.DB.ScaCommentReply
|
||||
updates, err := tx.ScaCommentReply.Where(comment.TopicID.Eq(req.TopicId), comment.ID.Eq(req.CommentId)).Update(comment.Likes, comment.Likes.Add(1))
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
if updates.RowsAffected == 0 {
|
||||
_ = tx.Rollback()
|
||||
return response.ErrorWithI18n(l.ctx, "comment.LikeError"), nil
|
||||
}
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response.Success(), nil
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/utils"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mongodb/collection"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
@@ -59,7 +60,7 @@ func (l *SubmitCommentLogic) SubmitComment(r *http.Request, req *types.CommentRe
|
||||
operatingSystem := ua.OS()
|
||||
var isAuthor int64 = 0
|
||||
session, err := l.svcCtx.Session.Get(r, constant.SESSION_KEY)
|
||||
if err == nil {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uid, ok := session.Values["uid"].(string)
|
||||
@@ -99,14 +100,16 @@ func (l *SubmitCommentLogic) SubmitComment(r *http.Request, req *types.CommentRe
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
commentImages := types.CommentImages{
|
||||
commentImages := &types.CommentImages{
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
CommentId: comment.ID,
|
||||
Images: imagesData,
|
||||
CreatedAt: comment.CreatedAt.String(),
|
||||
}
|
||||
if _, err = l.svcCtx.MongoClient.Collection(constant.COMMENT_IMAGES).InsertOne(l.ctx, commentImages); err != nil {
|
||||
|
||||
newCollection := collection.MustNewCollection[types.CommentImages](l.svcCtx, constant.COMMENT_IMAGES)
|
||||
_, err = newCollection.Creator().InsertOne(l.ctx, commentImages)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/utils"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mongodb/collection"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
@@ -99,7 +100,7 @@ func (l *SubmitReplyCommentLogic) SubmitReplyComment(r *http.Request, req *types
|
||||
return nil, err
|
||||
}
|
||||
commentReply := l.svcCtx.DB.ScaCommentReply
|
||||
update, err := tx.ScaCommentReply.Updates(commentReply.ReplyCount.Add(1))
|
||||
update, err := tx.ScaCommentReply.Where(commentReply.ID.Eq(req.ReplyId)).Update(commentReply.ReplyCount, commentReply.ReplyCount.Add(1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -113,14 +114,16 @@ func (l *SubmitReplyCommentLogic) SubmitReplyComment(r *http.Request, req *types
|
||||
return nil, err
|
||||
}
|
||||
|
||||
commentImages := types.CommentImages{
|
||||
commentImages := &types.CommentImages{
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
CommentId: reply.ID,
|
||||
Images: imagesData,
|
||||
CreatedAt: reply.CreatedAt.String(),
|
||||
}
|
||||
if _, err = l.svcCtx.MongoClient.Collection(constant.COMMENT_IMAGES).InsertOne(l.ctx, commentImages); err != nil {
|
||||
|
||||
newCollection := collection.MustNewCollection[types.CommentImages](l.svcCtx, constant.COMMENT_IMAGES)
|
||||
_, err = newCollection.Creator().InsertOne(l.ctx, commentImages)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/utils"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mongodb/collection"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
@@ -110,7 +111,7 @@ func (l *SubmitReplyReplyLogic) SubmitReplyReply(r *http.Request, req *types.Rep
|
||||
return nil, err
|
||||
}
|
||||
commentReply := l.svcCtx.DB.ScaCommentReply
|
||||
update, err := tx.ScaCommentReply.Updates(commentReply.ReplyCount.Add(1))
|
||||
update, err := tx.ScaCommentReply.Where(commentReply.ID.Eq(req.ReplyId)).Update(commentReply.ReplyCount, commentReply.ReplyCount.Add(1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -124,14 +125,16 @@ func (l *SubmitReplyReplyLogic) SubmitReplyReply(r *http.Request, req *types.Rep
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
commentImages := types.CommentImages{
|
||||
commentImages := &types.CommentImages{
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
CommentId: replyReply.ID,
|
||||
Images: imagesData,
|
||||
CreatedAt: replyReply.CreatedAt.String(),
|
||||
}
|
||||
if _, err = l.svcCtx.MongoClient.Collection(constant.COMMENT_IMAGES).InsertOne(l.ctx, commentImages); err != nil {
|
||||
|
||||
newCollection := collection.MustNewCollection[types.CommentImages](l.svcCtx, constant.COMMENT_IMAGES)
|
||||
_, err = newCollection.Creator().InsertOne(l.ctx, commentImages)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ func (l *GiteeCallbackLogic) GiteeCallback(w http.ResponseWriter, r *http.Reques
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
|
||||
userSocial := l.svcCtx.DB.ScaAuthUserSocial
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(Id), userSocial.Source.Eq(constant.OAuthSourceGitee), userSocial.Deleted.Eq(constant.NotDeleted)).First()
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(Id), userSocial.Source.Eq(constant.OAuthSourceGitee)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
@@ -123,7 +123,6 @@ func (l *GiteeCallbackLogic) GiteeCallback(w http.ResponseWriter, r *http.Reques
|
||||
Nickname: giteeUser.Name,
|
||||
Blog: giteeUser.Blog,
|
||||
Email: giteeUser.Email,
|
||||
Deleted: constant.NotDeleted,
|
||||
Gender: constant.Male,
|
||||
}
|
||||
err = tx.ScaAuthUser.Create(addUser)
|
||||
@@ -154,7 +153,7 @@ func (l *GiteeCallbackLogic) GiteeCallback(w http.ResponseWriter, r *http.Reques
|
||||
} else {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
|
@@ -106,7 +106,7 @@ func (l *GithubCallbackLogic) GithubCallback(w http.ResponseWriter, r *http.Requ
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
|
||||
userSocial := l.svcCtx.DB.ScaAuthUserSocial
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(Id), userSocial.Source.Eq(constant.OAuthSourceGithub), userSocial.Deleted.Eq(constant.NotDeleted)).First()
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(Id), userSocial.Source.Eq(constant.OAuthSourceGithub)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
@@ -116,7 +116,6 @@ func (l *GithubCallbackLogic) GithubCallback(w http.ResponseWriter, r *http.Requ
|
||||
uid := idgen.NextId()
|
||||
uidStr := strconv.FormatInt(uid, 10)
|
||||
|
||||
notDeleted := constant.NotDeleted
|
||||
male := constant.Male
|
||||
addUser := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
@@ -125,8 +124,8 @@ func (l *GithubCallbackLogic) GithubCallback(w http.ResponseWriter, r *http.Requ
|
||||
Nickname: gitHubUser.Name,
|
||||
Blog: gitHubUser.Blog,
|
||||
Email: gitHubUser.Email,
|
||||
Deleted: notDeleted,
|
||||
Gender: male,
|
||||
|
||||
Gender: male,
|
||||
}
|
||||
err = tx.ScaAuthUser.Create(addUser)
|
||||
if err != nil {
|
||||
@@ -157,7 +156,7 @@ func (l *GithubCallbackLogic) GithubCallback(w http.ResponseWriter, r *http.Requ
|
||||
} else {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
|
@@ -103,7 +103,7 @@ func (l *QqCallbackLogic) QqCallback(w http.ResponseWriter, r *http.Request, req
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
|
||||
userSocial := l.svcCtx.DB.ScaAuthUserSocial
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(authQQme.OpenID), userSocial.Source.Eq(constant.OAuthSourceQQ), userSocial.Deleted.Eq(constant.NotDeleted)).First()
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(authQQme.OpenID), userSocial.Source.Eq(constant.OAuthSourceQQ)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
@@ -113,14 +113,12 @@ func (l *QqCallbackLogic) QqCallback(w http.ResponseWriter, r *http.Request, req
|
||||
uid := idgen.NextId()
|
||||
uidStr := strconv.FormatInt(uid, 10)
|
||||
|
||||
notDeleted := constant.NotDeleted
|
||||
male := constant.Male
|
||||
addUser := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
Avatar: qqUserInfo.FigureurlQq1,
|
||||
Username: authQQme.OpenID,
|
||||
Nickname: qqUserInfo.Nickname,
|
||||
Deleted: notDeleted,
|
||||
Gender: male,
|
||||
}
|
||||
err = tx.ScaAuthUser.Create(addUser)
|
||||
@@ -153,7 +151,7 @@ func (l *QqCallbackLogic) QqCallback(w http.ResponseWriter, r *http.Request, req
|
||||
} else {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
|
@@ -117,7 +117,7 @@ func (l *WechatCallbackLogic) HandlerWechatLogin(openId string, clientId string,
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
|
||||
userSocial := l.svcCtx.DB.ScaAuthUserSocial
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(openId), userSocial.Source.Eq(constant.OAuthSourceWechat), userSocial.Deleted.Eq(constant.NotDeleted)).First()
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(openId), userSocial.Source.Eq(constant.OAuthSourceWechat)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
@@ -129,14 +129,12 @@ func (l *WechatCallbackLogic) HandlerWechatLogin(openId string, clientId string,
|
||||
avatar := utils.GenerateAvatar(uidStr)
|
||||
name := randomname.GenerateName()
|
||||
|
||||
notDeleted := constant.NotDeleted
|
||||
male := constant.Male
|
||||
addUser := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
Avatar: avatar,
|
||||
Username: openId,
|
||||
Nickname: name,
|
||||
Deleted: notDeleted,
|
||||
Gender: male,
|
||||
}
|
||||
err = tx.ScaAuthUser.Create(addUser)
|
||||
@@ -181,7 +179,7 @@ func (l *WechatCallbackLogic) HandlerWechatLogin(openId string, clientId string,
|
||||
} else {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
|
@@ -45,11 +45,11 @@ func (l *AccountLoginLogic) AccountLogin(w http.ResponseWriter, r *http.Request,
|
||||
|
||||
switch {
|
||||
case utils.IsPhone(req.Account):
|
||||
selectedUser = user.Where(user.Phone.Eq(req.Account), user.Deleted.Eq(constant.NotDeleted))
|
||||
selectedUser = user.Where(user.Phone.Eq(req.Account))
|
||||
case utils.IsEmail(req.Account):
|
||||
selectedUser = user.Where(user.Email.Eq(req.Account), user.Deleted.Eq(constant.NotDeleted))
|
||||
selectedUser = user.Where(user.Email.Eq(req.Account))
|
||||
case utils.IsUsername(req.Account):
|
||||
selectedUser = user.Where(user.Username.Eq(req.Account), user.Deleted.Eq(constant.NotDeleted))
|
||||
selectedUser = user.Where(user.Username.Eq(req.Account))
|
||||
default:
|
||||
return response.ErrorWithI18n(l.ctx, "login.invalidAccount"), nil
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ func (l *PhoneLoginLogic) PhoneLogin(r *http.Request, w http.ResponseWriter, req
|
||||
return response.ErrorWithI18n(l.ctx, "login.captchaError"), nil
|
||||
}
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
userInfo, err := authUser.Where(authUser.Phone.Eq(req.Phone), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
userInfo, err := authUser.Where(authUser.Phone.Eq(req.Phone)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
@@ -61,14 +61,12 @@ func (l *PhoneLoginLogic) PhoneLogin(r *http.Request, w http.ResponseWriter, req
|
||||
uidStr := strconv.FormatInt(uid, 10)
|
||||
avatar := utils.GenerateAvatar(uidStr)
|
||||
name := randomname.GenerateName()
|
||||
notDeleted := constant.NotDeleted
|
||||
male := constant.Male
|
||||
user := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
Phone: req.Phone,
|
||||
Avatar: avatar,
|
||||
Nickname: name,
|
||||
Deleted: notDeleted,
|
||||
Gender: male,
|
||||
}
|
||||
err := tx.ScaAuthUser.Create(user)
|
||||
|
@@ -1,6 +1,19 @@
|
||||
package types
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/chenmingyong0423/go-mongox/v2"
|
||||
)
|
||||
|
||||
// CommentImages 评论 图片
|
||||
type CommentImages struct {
|
||||
mongox.Model `bson:",inline"`
|
||||
TopicId string `json:"topic_id" bson:"topic_id"`
|
||||
CommentId int64 `json:"comment_id" bson:"comment_id"`
|
||||
UserId string `json:"user_id" bson:"user_id"`
|
||||
Images [][]byte `json:"images" bson:"images"`
|
||||
}
|
||||
|
||||
// CommentResponse 评论响应
|
||||
type CommentResponse struct {
|
||||
@@ -18,11 +31,72 @@ type CommentResponse struct {
|
||||
ReplyTo int64 `json:"reply_to,omitempty"`
|
||||
}
|
||||
|
||||
// CommentImages 评论图片
|
||||
type CommentImages struct {
|
||||
TopicId string `json:"topic_id" bson:"topic_id"`
|
||||
CommentId int64 `json:"comment_id" bson:"comment_id"`
|
||||
UserId string `json:"user_id" bson:"user_id"`
|
||||
Images [][]byte `json:"images" bson:"images"`
|
||||
CreatedAt string `json:"created_at" bson:"created_at"`
|
||||
// CommentContent 评论内容
|
||||
type CommentContent struct {
|
||||
NickName string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
Level int64 `json:"level,omitempty" default:"0"`
|
||||
Id int64 `json:"id"`
|
||||
UserId string `json:"user_id"`
|
||||
TopicId string `json:"topic_id"`
|
||||
Content string `json:"content"`
|
||||
ReplyTo int64 `json:"reply_to,omitempty"`
|
||||
ReplyId int64 `json:"reply_id,omitempty"`
|
||||
ReplyUser string `json:"reply_user,omitempty"`
|
||||
ReplyNickname string `json:"reply_nickname,omitempty"`
|
||||
IsAuthor int64 `json:"is_author"`
|
||||
Likes int64 `json:"likes"`
|
||||
ReplyCount int64 `json:"reply_count"`
|
||||
CreatedTime time.Time `json:"created_time"`
|
||||
Location string `json:"location"`
|
||||
Browser string `json:"browser"`
|
||||
OperatingSystem string `json:"operating_system"`
|
||||
IsLiked bool `json:"is_liked" default:"false"`
|
||||
Images []string `json:"images,omitempty"`
|
||||
}
|
||||
|
||||
// CommentListPageResponse 评论返回值
|
||||
type CommentListPageResponse struct {
|
||||
Size int `json:"size"`
|
||||
Total int64 `json:"total"`
|
||||
Current int `json:"current"`
|
||||
Comments []CommentContent `json:"comments"`
|
||||
}
|
||||
|
||||
// CommentListQueryResult 评论列表查询结果
|
||||
type CommentListQueryResult struct {
|
||||
ID int64 `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
TopicID string `json:"topic_id"`
|
||||
Content string `json:"content"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Author int64 `json:"author"`
|
||||
Likes int64 `json:"likes"`
|
||||
ReplyCount int64 `json:"reply_count"`
|
||||
Browser string `json:"browser"`
|
||||
OperatingSystem string `json:"operating_system"`
|
||||
Location string `json:"location"`
|
||||
Avatar string `json:"avatar"`
|
||||
Nickname string `json:"nickname"`
|
||||
}
|
||||
|
||||
// ReplyListQueryResult 回复列表查询结果
|
||||
type ReplyListQueryResult struct {
|
||||
ID int64 `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
TopicID string `json:"topic_id"`
|
||||
Content string `json:"content"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Author int64 `json:"author"`
|
||||
Likes int64 `json:"likes"`
|
||||
ReplyCount int64 `json:"reply_count"`
|
||||
Browser string `json:"browser"`
|
||||
OperatingSystem string `json:"operating_system"`
|
||||
Location string `json:"location"`
|
||||
Avatar string `json:"avatar"`
|
||||
Nickname string `json:"nickname"`
|
||||
ReplyUser string `json:"reply_user"`
|
||||
ReplyId int64 `json:"reply_id"`
|
||||
ReplyTo int64 `json:"reply_to"`
|
||||
ReplyNickname string `json:"reply_nickname"`
|
||||
}
|
||||
|
@@ -23,8 +23,8 @@ type CommentLikeRequest struct {
|
||||
|
||||
type CommentListRequest struct {
|
||||
TopicId string `json:"topic_id"`
|
||||
Page int64 `json:"page,default=1,optional"`
|
||||
Size int64 `json:"size,default=5,optional"`
|
||||
Page int `json:"page,default=1,optional"`
|
||||
Size int `json:"size,default=5,optional"`
|
||||
IsHot bool `json:"is_hot,default=true,optional"`
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ type ReplyCommentRequest struct {
|
||||
type ReplyListRequest struct {
|
||||
TopicId string `json:"topic_id"`
|
||||
CommentId int64 `json:"comment_id"`
|
||||
Page int64 `json:"page,default=1,optional"`
|
||||
Size int64 `json:"size,default=5,optional"`
|
||||
Page int `json:"page,default=1,optional"`
|
||||
Size int `json:"size,default=5,optional"`
|
||||
}
|
||||
|
||||
type ReplyReplyRequest struct {
|
||||
|
@@ -1,11 +0,0 @@
|
||||
package types
|
||||
|
||||
import "github.com/chenmingyong0423/go-mongox/v2"
|
||||
|
||||
type CommentImage struct {
|
||||
mongox.Model `bson:",inline"`
|
||||
TopicID string `bson:"topic_id"`
|
||||
CommentID string `bson:"comment_id"`
|
||||
UserID string `bson:"user_id"`
|
||||
Images []string `bson:"images"`
|
||||
}
|
@@ -91,8 +91,9 @@ func main() {
|
||||
return tag.Append("autoCreateTime")
|
||||
})
|
||||
softDeleteField := gen.FieldType("delete_at", "gorm.DeletedAt")
|
||||
versionField := gen.FieldType("version", "optimisticlock.Version")
|
||||
// 模型自定义选项组
|
||||
fieldOpts := []gen.ModelOpt{jsonField, autoUpdateTimeField, autoCreateTimeField, softDeleteField}
|
||||
fieldOpts := []gen.ModelOpt{jsonField, autoUpdateTimeField, autoCreateTimeField, softDeleteField, versionField}
|
||||
|
||||
// 创建全部模型文件, 并覆盖前面创建的同名模型
|
||||
allModel := g.GenerateAllTable(fieldOpts...)
|
||||
|
@@ -25,7 +25,6 @@ type ScaAuthMenu struct {
|
||||
Order_ int64 `gorm:"column:order;type:int;comment:排序" json:"order"` // 排序
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否删除" json:"deleted"` // 是否删除
|
||||
Remark string `gorm:"column:remark;type:varchar(255);comment:备注 描述" json:"remark"` // 备注 描述
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
@@ -18,7 +18,6 @@ type ScaAuthRole struct {
|
||||
RoleName string `gorm:"column:role_name;type:varchar(32);not null;comment:角色名称" json:"role_name"` // 角色名称
|
||||
RoleKey string `gorm:"column:role_key;type:varchar(64);not null;comment:角色关键字" json:"role_key"` // 角色关键字
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ type ScaAuthUser struct {
|
||||
Status int64 `gorm:"column:status;type:tinyint;comment:状态 0 正常 1 封禁" json:"status"` // 状态 0 正常 1 封禁
|
||||
Introduce string `gorm:"column:introduce;type:varchar(255);comment:介绍" json:"introduce"` // 介绍
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Blog string `gorm:"column:blog;type:varchar(30);comment:博客" json:"blog"` // 博客
|
||||
Location string `gorm:"column:location;type:varchar(50);comment:地址" json:"location"` // 地址
|
||||
Company string `gorm:"column:company;type:varchar(50);comment:公司" json:"company"` // 公司
|
||||
|
@@ -20,7 +20,6 @@ type ScaAuthUserDevice struct {
|
||||
Location string `gorm:"column:location;type:varchar(20);comment:地址" json:"location"` // 地址
|
||||
Agent string `gorm:"column:agent;type:varchar(255);comment:设备信息" json:"agent"` // 设备信息
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Browser string `gorm:"column:browser;type:varchar(20);comment:浏览器" json:"browser"` // 浏览器
|
||||
OperatingSystem string `gorm:"column:operating_system;type:varchar(20);comment:操作系统" json:"operating_system"` // 操作系统
|
||||
BrowserVersion string `gorm:"column:browser_version;type:varchar(20);comment:浏览器版本" json:"browser_version"` // 浏览器版本
|
||||
|
@@ -20,7 +20,6 @@ type ScaAuthUserSocial struct {
|
||||
Source string `gorm:"column:source;type:varchar(10);comment:第三方用户来源" json:"source"` // 第三方用户来源
|
||||
Status int64 `gorm:"column:status;type:bigint;comment:状态 0正常 1 封禁" json:"status"` // 状态 0正常 1 封禁
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
@@ -8,34 +8,34 @@ import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/plugin/optimisticlock"
|
||||
)
|
||||
|
||||
const TableNameScaCommentReply = "sca_comment_reply"
|
||||
|
||||
// ScaCommentReply mapped from table <sca_comment_reply>
|
||||
type ScaCommentReply struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;uniqueIndex:id,priority:1;comment:主键id" json:"id,string"` // 主键id
|
||||
UserID string `gorm:"column:user_id;type:varchar(50);not null;comment:评论用户id" json:"user_id"` // 评论用户id
|
||||
TopicID string `gorm:"column:topic_id;type:varchar(50);comment:评论话题id" json:"topic_id"` // 评论话题id
|
||||
TopicType int64 `gorm:"column:topic_type;type:tinyint;comment:话题类型" json:"topic_type"` // 话题类型
|
||||
Content string `gorm:"column:content;type:text;comment:评论内容" json:"content"` // 评论内容
|
||||
CommentType int64 `gorm:"column:comment_type;type:bigint;comment:评论类型 0评论 1 回复" json:"comment_type"` // 评论类型 0评论 1 回复
|
||||
ReplyTo int64 `gorm:"column:reply_to;type:bigint;comment:回复子评论ID" json:"reply_to"` // 回复子评论ID
|
||||
ReplyID int64 `gorm:"column:reply_id;type:bigint;comment:回复父评论Id" json:"reply_id"` // 回复父评论Id
|
||||
ReplyUser string `gorm:"column:reply_user;type:varchar(50);comment:回复人id" json:"reply_user"` // 回复人id
|
||||
Author int64 `gorm:"column:author;type:tinyint;comment:评论回复是否作者 0否 1是" json:"author"` // 评论回复是否作者 0否 1是
|
||||
Likes int64 `gorm:"column:likes;type:bigint;comment:点赞数" json:"likes"` // 点赞数
|
||||
ReplyCount int64 `gorm:"column:reply_count;type:bigint;comment:回复数量" json:"reply_count"` // 回复数量
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Browser string `gorm:"column:browser;type:varchar(50);comment:浏览器" json:"browser"` // 浏览器
|
||||
OperatingSystem string `gorm:"column:operating_system;type:varchar(50);comment:操作系统" json:"operating_system"` // 操作系统
|
||||
CommentIP string `gorm:"column:comment_ip;type:varchar(50);comment:IP地址" json:"comment_ip"` // IP地址
|
||||
Location string `gorm:"column:location;type:varchar(50);comment:地址" json:"location"` // 地址
|
||||
Agent string `gorm:"column:agent;type:varchar(255);comment:设备信息" json:"agent"` // 设备信息
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Version int64 `gorm:"column:version;type:bigint;comment:版本" json:"version"` // 版本
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;uniqueIndex:id,priority:1;comment:主键id" json:"id,string"` // 主键id
|
||||
UserID string `gorm:"column:user_id;type:varchar(50);not null;comment:评论用户id" json:"user_id"` // 评论用户id
|
||||
TopicID string `gorm:"column:topic_id;type:varchar(50);comment:评论话题id" json:"topic_id"` // 评论话题id
|
||||
TopicType int64 `gorm:"column:topic_type;type:tinyint;comment:话题类型" json:"topic_type"` // 话题类型
|
||||
Content string `gorm:"column:content;type:text;comment:评论内容" json:"content"` // 评论内容
|
||||
CommentType int64 `gorm:"column:comment_type;type:bigint;comment:评论类型 0评论 1 回复" json:"comment_type"` // 评论类型 0评论 1 回复
|
||||
ReplyTo int64 `gorm:"column:reply_to;type:bigint;comment:回复子评论ID" json:"reply_to"` // 回复子评论ID
|
||||
ReplyID int64 `gorm:"column:reply_id;type:bigint;comment:回复父评论Id" json:"reply_id"` // 回复父评论Id
|
||||
ReplyUser string `gorm:"column:reply_user;type:varchar(50);comment:回复人id" json:"reply_user"` // 回复人id
|
||||
Author int64 `gorm:"column:author;type:tinyint;comment:评论回复是否作者 0否 1是" json:"author"` // 评论回复是否作者 0否 1是
|
||||
Likes int64 `gorm:"column:likes;type:bigint;comment:点赞数" json:"likes"` // 点赞数
|
||||
ReplyCount int64 `gorm:"column:reply_count;type:bigint;comment:回复数量" json:"reply_count"` // 回复数量
|
||||
Browser string `gorm:"column:browser;type:varchar(50);comment:浏览器" json:"browser"` // 浏览器
|
||||
OperatingSystem string `gorm:"column:operating_system;type:varchar(50);comment:操作系统" json:"operating_system"` // 操作系统
|
||||
CommentIP string `gorm:"column:comment_ip;type:varchar(50);comment:IP地址" json:"comment_ip"` // IP地址
|
||||
Location string `gorm:"column:location;type:varchar(50);comment:地址" json:"location"` // 地址
|
||||
Agent string `gorm:"column:agent;type:varchar(255);comment:设备信息" json:"agent"` // 设备信息
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Version optimisticlock.Version `gorm:"column:version;type:bigint;comment:版本" json:"version"` // 版本
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaCommentReply's table name
|
||||
|
@@ -14,16 +14,15 @@ const TableNameScaFileFolder = "sca_file_folder"
|
||||
|
||||
// ScaFileFolder mapped from table <sca_file_folder>
|
||||
type ScaFileFolder struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键" json:"id,string"` // 主键
|
||||
FolderName string `gorm:"column:folder_name;type:varchar(512);comment:文件夹名称" json:"folder_name"` // 文件夹名称
|
||||
ParentFolderID int64 `gorm:"column:parent_folder_id;type:bigint;comment:父文件夹编号" json:"parent_folder_id"` // 父文件夹编号
|
||||
FolderAddr string `gorm:"column:folder_addr;type:varchar(1024);comment:文件夹名称" json:"folder_addr"` // 文件夹名称
|
||||
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户编号" json:"user_id"` // 用户编号
|
||||
FolderSource int64 `gorm:"column:folder_source;type:int;comment:文件夹来源 0相册 1 评论" json:"folder_source"` // 文件夹来源 0相册 1 评论
|
||||
CreatedTime *time.Time `gorm:"column:created_time;type:datetime;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_time"` // 创建时间
|
||||
UpdateTime *time.Time `gorm:"column:update_time;type:datetime;default:CURRENT_TIMESTAMP;comment:更新时间" json:"update_time"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键" json:"id,string"` // 主键
|
||||
FolderName string `gorm:"column:folder_name;type:varchar(512);comment:文件夹名称" json:"folder_name"` // 文件夹名称
|
||||
ParentFolderID int64 `gorm:"column:parent_folder_id;type:bigint;comment:父文件夹编号" json:"parent_folder_id"` // 父文件夹编号
|
||||
FolderAddr string `gorm:"column:folder_addr;type:varchar(1024);comment:文件夹名称" json:"folder_addr"` // 文件夹名称
|
||||
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户编号" json:"user_id"` // 用户编号
|
||||
FolderSource int64 `gorm:"column:folder_source;type:int;comment:文件夹来源 0相册 1 评论" json:"folder_source"` // 文件夹来源 0相册 1 评论
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:datetime;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:datetime;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaFileFolder's table name
|
||||
|
@@ -25,7 +25,6 @@ type ScaFileInfo struct {
|
||||
Status int64 `gorm:"column:status;type:int;comment:文件状态" json:"status"` // 文件状态
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:datetime;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:datetime;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,6 @@ type ScaFileRecycle struct {
|
||||
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户编号" json:"user_id"` // 用户编号
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
OriginalPath string `gorm:"column:original_path;type:varchar(1024);comment:原始路径" json:"original_path"` // 原始路径
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否被永久删除 0否 1是" json:"deleted"` // 是否被永久删除 0否 1是
|
||||
FileSource int64 `gorm:"column:file_source;type:int;comment:文件来源 0 相册 1 评论" json:"file_source"` // 文件来源 0 相册 1 评论
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,6 @@ type ScaFileType struct {
|
||||
Status int64 `gorm:"column:status;type:int;comment:类型状态" json:"status"` // 类型状态
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:datetime;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:datetime;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
|
@@ -24,9 +24,7 @@ type ScaMessageReport struct {
|
||||
ReportTag string `gorm:"column:report_tag;type:varchar(255);comment:举报标签" json:"report_tag"` // 举报标签
|
||||
Status int64 `gorm:"column:status;type:tinyint;comment:状态(0 未处理 1 已处理)" json:"status"` // 状态(0 未处理 1 已处理)
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdateBy string `gorm:"column:update_by;type:varchar(32);comment:更新人" json:"update_by"` // 更新人
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0否 1是" json:"deleted"` // 是否删除 0否 1是
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,6 @@ type ScaUserMessage struct {
|
||||
ToID string `gorm:"column:to_id;type:varchar(50);comment:送达人" json:"to_id"` // 送达人
|
||||
Content string `gorm:"column:content;type:text;comment:消息内容" json:"content"` // 消息内容
|
||||
IsRead int64 `gorm:"column:is_read;type:tinyint;comment:是否已读" json:"is_read"` // 是否已读
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
|
@@ -38,7 +38,6 @@ func newScaAuthMenu(db *gorm.DB, opts ...gen.DOOption) scaAuthMenu {
|
||||
_scaAuthMenu.Order_ = field.NewInt64(tableName, "order")
|
||||
_scaAuthMenu.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthMenu.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaAuthMenu.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthMenu.Remark = field.NewString(tableName, "remark")
|
||||
_scaAuthMenu.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
@@ -62,7 +61,6 @@ type scaAuthMenu struct {
|
||||
Order_ field.Int64 // 排序
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除
|
||||
Remark field.String // 备注 描述
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
@@ -92,7 +90,6 @@ func (s *scaAuthMenu) updateTableName(table string) *scaAuthMenu {
|
||||
s.Order_ = field.NewInt64(table, "order")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.Remark = field.NewString(table, "remark")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
@@ -111,7 +108,7 @@ func (s *scaAuthMenu) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
}
|
||||
|
||||
func (s *scaAuthMenu) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 14)
|
||||
s.fieldMap = make(map[string]field.Expr, 13)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["menu_name"] = s.MenuName
|
||||
s.fieldMap["parent_id"] = s.ParentID
|
||||
@@ -123,7 +120,6 @@ func (s *scaAuthMenu) fillFieldMap() {
|
||||
s.fieldMap["order"] = s.Order_
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["remark"] = s.Remark
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@ func newScaAuthRole(db *gorm.DB, opts ...gen.DOOption) scaAuthRole {
|
||||
_scaAuthRole.RoleName = field.NewString(tableName, "role_name")
|
||||
_scaAuthRole.RoleKey = field.NewString(tableName, "role_key")
|
||||
_scaAuthRole.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthRole.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthRole.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaAuthRole.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
@@ -48,7 +47,6 @@ type scaAuthRole struct {
|
||||
RoleName field.String // 角色名称
|
||||
RoleKey field.String // 角色关键字
|
||||
CreatedAt field.Time // 创建时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
@@ -71,7 +69,6 @@ func (s *scaAuthRole) updateTableName(table string) *scaAuthRole {
|
||||
s.RoleName = field.NewString(table, "role_name")
|
||||
s.RoleKey = field.NewString(table, "role_key")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
@@ -90,12 +87,11 @@ func (s *scaAuthRole) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
}
|
||||
|
||||
func (s *scaAuthRole) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 7)
|
||||
s.fieldMap = make(map[string]field.Expr, 6)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["role_name"] = s.RoleName
|
||||
s.fieldMap["role_key"] = s.RoleKey
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
@@ -39,7 +39,6 @@ func newScaAuthUser(db *gorm.DB, opts ...gen.DOOption) scaAuthUser {
|
||||
_scaAuthUser.Status = field.NewInt64(tableName, "status")
|
||||
_scaAuthUser.Introduce = field.NewString(tableName, "introduce")
|
||||
_scaAuthUser.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthUser.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthUser.Blog = field.NewString(tableName, "blog")
|
||||
_scaAuthUser.Location = field.NewString(tableName, "location")
|
||||
_scaAuthUser.Company = field.NewString(tableName, "company")
|
||||
@@ -67,7 +66,6 @@ type scaAuthUser struct {
|
||||
Status field.Int64 // 状态 0 正常 1 封禁
|
||||
Introduce field.String // 介绍
|
||||
CreatedAt field.Time // 创建时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
Blog field.String // 博客
|
||||
Location field.String // 地址
|
||||
Company field.String // 公司
|
||||
@@ -101,7 +99,6 @@ func (s *scaAuthUser) updateTableName(table string) *scaAuthUser {
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.Introduce = field.NewString(table, "introduce")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.Blog = field.NewString(table, "blog")
|
||||
s.Location = field.NewString(table, "location")
|
||||
s.Company = field.NewString(table, "company")
|
||||
@@ -123,7 +120,7 @@ func (s *scaAuthUser) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
}
|
||||
|
||||
func (s *scaAuthUser) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 18)
|
||||
s.fieldMap = make(map[string]field.Expr, 17)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["uid"] = s.UID
|
||||
s.fieldMap["username"] = s.Username
|
||||
@@ -136,7 +133,6 @@ func (s *scaAuthUser) fillFieldMap() {
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["introduce"] = s.Introduce
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["blog"] = s.Blog
|
||||
s.fieldMap["location"] = s.Location
|
||||
s.fieldMap["company"] = s.Company
|
||||
|
@@ -33,7 +33,6 @@ func newScaAuthUserDevice(db *gorm.DB, opts ...gen.DOOption) scaAuthUserDevice {
|
||||
_scaAuthUserDevice.Location = field.NewString(tableName, "location")
|
||||
_scaAuthUserDevice.Agent = field.NewString(tableName, "agent")
|
||||
_scaAuthUserDevice.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthUserDevice.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthUserDevice.Browser = field.NewString(tableName, "browser")
|
||||
_scaAuthUserDevice.OperatingSystem = field.NewString(tableName, "operating_system")
|
||||
_scaAuthUserDevice.BrowserVersion = field.NewString(tableName, "browser_version")
|
||||
@@ -61,7 +60,6 @@ type scaAuthUserDevice struct {
|
||||
Location field.String // 地址
|
||||
Agent field.String // 设备信息
|
||||
CreatedAt field.Time // 创建时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
Browser field.String // 浏览器
|
||||
OperatingSystem field.String // 操作系统
|
||||
BrowserVersion field.String // 浏览器版本
|
||||
@@ -95,7 +93,6 @@ func (s *scaAuthUserDevice) updateTableName(table string) *scaAuthUserDevice {
|
||||
s.Location = field.NewString(table, "location")
|
||||
s.Agent = field.NewString(table, "agent")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.Browser = field.NewString(table, "browser")
|
||||
s.OperatingSystem = field.NewString(table, "operating_system")
|
||||
s.BrowserVersion = field.NewString(table, "browser_version")
|
||||
@@ -123,14 +120,13 @@ func (s *scaAuthUserDevice) GetFieldByName(fieldName string) (field.OrderExpr, b
|
||||
}
|
||||
|
||||
func (s *scaAuthUserDevice) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 18)
|
||||
s.fieldMap = make(map[string]field.Expr, 17)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["ip"] = s.IP
|
||||
s.fieldMap["location"] = s.Location
|
||||
s.fieldMap["agent"] = s.Agent
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["browser"] = s.Browser
|
||||
s.fieldMap["operating_system"] = s.OperatingSystem
|
||||
s.fieldMap["browser_version"] = s.BrowserVersion
|
||||
|
@@ -33,7 +33,6 @@ func newScaAuthUserSocial(db *gorm.DB, opts ...gen.DOOption) scaAuthUserSocial {
|
||||
_scaAuthUserSocial.Source = field.NewString(tableName, "source")
|
||||
_scaAuthUserSocial.Status = field.NewInt64(tableName, "status")
|
||||
_scaAuthUserSocial.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthUserSocial.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthUserSocial.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaAuthUserSocial.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
@@ -52,7 +51,6 @@ type scaAuthUserSocial struct {
|
||||
Source field.String // 第三方用户来源
|
||||
Status field.Int64 // 状态 0正常 1 封禁
|
||||
CreatedAt field.Time // 创建时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
@@ -77,7 +75,6 @@ func (s *scaAuthUserSocial) updateTableName(table string) *scaAuthUserSocial {
|
||||
s.Source = field.NewString(table, "source")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
@@ -96,14 +93,13 @@ func (s *scaAuthUserSocial) GetFieldByName(fieldName string) (field.OrderExpr, b
|
||||
}
|
||||
|
||||
func (s *scaAuthUserSocial) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 9)
|
||||
s.fieldMap = make(map[string]field.Expr, 8)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["open_id"] = s.OpenID
|
||||
s.fieldMap["source"] = s.Source
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
@@ -39,7 +39,6 @@ func newScaCommentReply(db *gorm.DB, opts ...gen.DOOption) scaCommentReply {
|
||||
_scaCommentReply.Author = field.NewInt64(tableName, "author")
|
||||
_scaCommentReply.Likes = field.NewInt64(tableName, "likes")
|
||||
_scaCommentReply.ReplyCount = field.NewInt64(tableName, "reply_count")
|
||||
_scaCommentReply.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaCommentReply.Browser = field.NewString(tableName, "browser")
|
||||
_scaCommentReply.OperatingSystem = field.NewString(tableName, "operating_system")
|
||||
_scaCommentReply.CommentIP = field.NewString(tableName, "comment_ip")
|
||||
@@ -47,7 +46,7 @@ func newScaCommentReply(db *gorm.DB, opts ...gen.DOOption) scaCommentReply {
|
||||
_scaCommentReply.Agent = field.NewString(tableName, "agent")
|
||||
_scaCommentReply.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaCommentReply.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaCommentReply.Version = field.NewInt64(tableName, "version")
|
||||
_scaCommentReply.Version = field.NewField(tableName, "version")
|
||||
_scaCommentReply.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaCommentReply.fillFieldMap()
|
||||
@@ -71,7 +70,6 @@ type scaCommentReply struct {
|
||||
Author field.Int64 // 评论回复是否作者 0否 1是
|
||||
Likes field.Int64 // 点赞数
|
||||
ReplyCount field.Int64 // 回复数量
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
Browser field.String // 浏览器
|
||||
OperatingSystem field.String // 操作系统
|
||||
CommentIP field.String // IP地址
|
||||
@@ -79,7 +77,7 @@ type scaCommentReply struct {
|
||||
Agent field.String // 设备信息
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Version field.Int64 // 版本
|
||||
Version field.Field // 版本
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
@@ -109,7 +107,6 @@ func (s *scaCommentReply) updateTableName(table string) *scaCommentReply {
|
||||
s.Author = field.NewInt64(table, "author")
|
||||
s.Likes = field.NewInt64(table, "likes")
|
||||
s.ReplyCount = field.NewInt64(table, "reply_count")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.Browser = field.NewString(table, "browser")
|
||||
s.OperatingSystem = field.NewString(table, "operating_system")
|
||||
s.CommentIP = field.NewString(table, "comment_ip")
|
||||
@@ -117,7 +114,7 @@ func (s *scaCommentReply) updateTableName(table string) *scaCommentReply {
|
||||
s.Agent = field.NewString(table, "agent")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Version = field.NewInt64(table, "version")
|
||||
s.Version = field.NewField(table, "version")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
@@ -135,7 +132,7 @@ func (s *scaCommentReply) GetFieldByName(fieldName string) (field.OrderExpr, boo
|
||||
}
|
||||
|
||||
func (s *scaCommentReply) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 22)
|
||||
s.fieldMap = make(map[string]field.Expr, 21)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["topic_id"] = s.TopicID
|
||||
@@ -148,7 +145,6 @@ func (s *scaCommentReply) fillFieldMap() {
|
||||
s.fieldMap["author"] = s.Author
|
||||
s.fieldMap["likes"] = s.Likes
|
||||
s.fieldMap["reply_count"] = s.ReplyCount
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["browser"] = s.Browser
|
||||
s.fieldMap["operating_system"] = s.OperatingSystem
|
||||
s.fieldMap["comment_ip"] = s.CommentIP
|
||||
|
@@ -33,9 +33,8 @@ func newScaFileFolder(db *gorm.DB, opts ...gen.DOOption) scaFileFolder {
|
||||
_scaFileFolder.FolderAddr = field.NewString(tableName, "folder_addr")
|
||||
_scaFileFolder.UserID = field.NewString(tableName, "user_id")
|
||||
_scaFileFolder.FolderSource = field.NewInt64(tableName, "folder_source")
|
||||
_scaFileFolder.CreatedTime = field.NewTime(tableName, "created_time")
|
||||
_scaFileFolder.UpdateTime = field.NewTime(tableName, "update_time")
|
||||
_scaFileFolder.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaFileFolder.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaFileFolder.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaFileFolder.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaFileFolder.fillFieldMap()
|
||||
@@ -53,9 +52,8 @@ type scaFileFolder struct {
|
||||
FolderAddr field.String // 文件夹名称
|
||||
UserID field.String // 用户编号
|
||||
FolderSource field.Int64 // 文件夹来源 0相册 1 评论
|
||||
CreatedTime field.Time // 创建时间
|
||||
UpdateTime field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
@@ -79,9 +77,8 @@ func (s *scaFileFolder) updateTableName(table string) *scaFileFolder {
|
||||
s.FolderAddr = field.NewString(table, "folder_addr")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.FolderSource = field.NewInt64(table, "folder_source")
|
||||
s.CreatedTime = field.NewTime(table, "created_time")
|
||||
s.UpdateTime = field.NewTime(table, "update_time")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
@@ -99,16 +96,15 @@ func (s *scaFileFolder) GetFieldByName(fieldName string) (field.OrderExpr, bool)
|
||||
}
|
||||
|
||||
func (s *scaFileFolder) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 10)
|
||||
s.fieldMap = make(map[string]field.Expr, 9)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["folder_name"] = s.FolderName
|
||||
s.fieldMap["parent_folder_id"] = s.ParentFolderID
|
||||
s.fieldMap["folder_addr"] = s.FolderAddr
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["folder_source"] = s.FolderSource
|
||||
s.fieldMap["created_time"] = s.CreatedTime
|
||||
s.fieldMap["update_time"] = s.UpdateTime
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,6 @@ func newScaFileInfo(db *gorm.DB, opts ...gen.DOOption) scaFileInfo {
|
||||
_scaFileInfo.Status = field.NewInt64(tableName, "status")
|
||||
_scaFileInfo.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaFileInfo.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaFileInfo.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaFileInfo.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaFileInfo.fillFieldMap()
|
||||
@@ -61,7 +60,6 @@ type scaFileInfo struct {
|
||||
Status field.Int64 // 文件状态
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
@@ -90,7 +88,6 @@ func (s *scaFileInfo) updateTableName(table string) *scaFileInfo {
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
@@ -108,7 +105,7 @@ func (s *scaFileInfo) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
}
|
||||
|
||||
func (s *scaFileInfo) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 13)
|
||||
s.fieldMap = make(map[string]field.Expr, 12)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["file_name"] = s.FileName
|
||||
s.fieldMap["file_size"] = s.FileSize
|
||||
@@ -120,7 +117,6 @@ func (s *scaFileInfo) fillFieldMap() {
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,6 @@ func newScaFileRecycle(db *gorm.DB, opts ...gen.DOOption) scaFileRecycle {
|
||||
_scaFileRecycle.UserID = field.NewString(tableName, "user_id")
|
||||
_scaFileRecycle.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
_scaFileRecycle.OriginalPath = field.NewString(tableName, "original_path")
|
||||
_scaFileRecycle.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaFileRecycle.FileSource = field.NewInt64(tableName, "file_source")
|
||||
|
||||
_scaFileRecycle.fillFieldMap()
|
||||
@@ -53,7 +52,6 @@ type scaFileRecycle struct {
|
||||
UserID field.String // 用户编号
|
||||
DeletedAt field.Field // 删除时间
|
||||
OriginalPath field.String // 原始路径
|
||||
Deleted field.Int64 // 是否被永久删除 0否 1是
|
||||
FileSource field.Int64 // 文件来源 0 相册 1 评论
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
@@ -78,7 +76,6 @@ func (s *scaFileRecycle) updateTableName(table string) *scaFileRecycle {
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
s.OriginalPath = field.NewString(table, "original_path")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.FileSource = field.NewInt64(table, "file_source")
|
||||
|
||||
s.fillFieldMap()
|
||||
@@ -96,7 +93,7 @@ func (s *scaFileRecycle) GetFieldByName(fieldName string) (field.OrderExpr, bool
|
||||
}
|
||||
|
||||
func (s *scaFileRecycle) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 9)
|
||||
s.fieldMap = make(map[string]field.Expr, 8)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["file_id"] = s.FileID
|
||||
s.fieldMap["folder_id"] = s.FolderID
|
||||
@@ -104,7 +101,6 @@ func (s *scaFileRecycle) fillFieldMap() {
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
s.fieldMap["original_path"] = s.OriginalPath
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["file_source"] = s.FileSource
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,6 @@ func newScaFileType(db *gorm.DB, opts ...gen.DOOption) scaFileType {
|
||||
_scaFileType.Status = field.NewInt64(tableName, "status")
|
||||
_scaFileType.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaFileType.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaFileType.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaFileType.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaFileType.fillFieldMap()
|
||||
@@ -51,7 +50,6 @@ type scaFileType struct {
|
||||
Status field.Int64 // 类型状态
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
@@ -75,7 +73,6 @@ func (s *scaFileType) updateTableName(table string) *scaFileType {
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
@@ -93,14 +90,13 @@ func (s *scaFileType) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
}
|
||||
|
||||
func (s *scaFileType) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 8)
|
||||
s.fieldMap = make(map[string]field.Expr, 7)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["type_name"] = s.TypeName
|
||||
s.fieldMap["mime_type"] = s.MimeType
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
|
@@ -37,9 +37,7 @@ func newScaMessageReport(db *gorm.DB, opts ...gen.DOOption) scaMessageReport {
|
||||
_scaMessageReport.ReportTag = field.NewString(tableName, "report_tag")
|
||||
_scaMessageReport.Status = field.NewInt64(tableName, "status")
|
||||
_scaMessageReport.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaMessageReport.UpdateBy = field.NewString(tableName, "update_by")
|
||||
_scaMessageReport.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaMessageReport.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaMessageReport.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaMessageReport.fillFieldMap()
|
||||
@@ -61,9 +59,7 @@ type scaMessageReport struct {
|
||||
ReportTag field.String // 举报标签
|
||||
Status field.Int64 // 状态(0 未处理 1 已处理)
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdateBy field.String // 更新人
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除 0否 1是
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
@@ -91,9 +87,7 @@ func (s *scaMessageReport) updateTableName(table string) *scaMessageReport {
|
||||
s.ReportTag = field.NewString(table, "report_tag")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdateBy = field.NewString(table, "update_by")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
@@ -111,7 +105,7 @@ func (s *scaMessageReport) GetFieldByName(fieldName string) (field.OrderExpr, bo
|
||||
}
|
||||
|
||||
func (s *scaMessageReport) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 14)
|
||||
s.fieldMap = make(map[string]field.Expr, 12)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["type"] = s.Type
|
||||
@@ -122,9 +116,7 @@ func (s *scaMessageReport) fillFieldMap() {
|
||||
s.fieldMap["report_tag"] = s.ReportTag
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["update_by"] = s.UpdateBy
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,6 @@ func newScaUserMessage(db *gorm.DB, opts ...gen.DOOption) scaUserMessage {
|
||||
_scaUserMessage.ToID = field.NewString(tableName, "to_id")
|
||||
_scaUserMessage.Content = field.NewString(tableName, "content")
|
||||
_scaUserMessage.IsRead = field.NewInt64(tableName, "is_read")
|
||||
_scaUserMessage.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaUserMessage.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaUserMessage.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaUserMessage.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
@@ -53,7 +52,6 @@ type scaUserMessage struct {
|
||||
ToID field.String // 送达人
|
||||
Content field.String // 消息内容
|
||||
IsRead field.Int64 // 是否已读
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
@@ -79,7 +77,6 @@ func (s *scaUserMessage) updateTableName(table string) *scaUserMessage {
|
||||
s.ToID = field.NewString(table, "to_id")
|
||||
s.Content = field.NewString(table, "content")
|
||||
s.IsRead = field.NewInt64(table, "is_read")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
@@ -99,14 +96,13 @@ func (s *scaUserMessage) GetFieldByName(fieldName string) (field.OrderExpr, bool
|
||||
}
|
||||
|
||||
func (s *scaUserMessage) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 10)
|
||||
s.fieldMap = make(map[string]field.Expr, 9)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["topic_id"] = s.TopicID
|
||||
s.fieldMap["from_id"] = s.FromID
|
||||
s.fieldMap["to_id"] = s.ToID
|
||||
s.fieldMap["content"] = s.Content
|
||||
s.fieldMap["is_read"] = s.IsRead
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
|
@@ -23,4 +23,6 @@ smsSendFailed = "sms send failed!"
|
||||
smsSendSuccess = "sms send success!"
|
||||
[comment]
|
||||
tooManyImages = "too many images!"
|
||||
commentError = "comment error!"
|
||||
commentError = "comment error!"
|
||||
LikeError = "like error!"
|
||||
CancelLikeError = "cancel like error!"
|
@@ -24,3 +24,5 @@ smsSendSuccess = "短信发送成功!"
|
||||
[comment]
|
||||
tooManyImages = "图片数量过多,请上传不超过3张!"
|
||||
commentError = "评论失败!"
|
||||
LikeError = "点赞失败!"
|
||||
CancelLikeError = "取消点赞失败!"
|
||||
|
Reference in New Issue
Block a user