🏗️ update

This commit is contained in:
2024-12-24 18:01:54 +08:00
parent 89d64336f5
commit e31f95b943
168 changed files with 1337 additions and 14789 deletions

View File

@@ -171,6 +171,9 @@ service auth {
@handler messageWebsocket
get /message
@handler fileWebsocket
get /file
}
@server (
@@ -249,3 +252,168 @@ service auth {
get /slide/generate returns (SlideCaptchaResponse)
}
type (
// 评论提交请求参数
CommentRequest {
Content string `json:"content"`
Images []string `json:"images,optional"`
TopicId string `json:"topic_id"`
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
// 回复评论提交请求参数
ReplyCommentRequest {
Content string `json:"content"`
Images []string `json:"images,optional"`
TopicId string `json:"topic_id" `
ReplyId int64 `json:"reply_id" `
ReplyUser string `json:"reply_user" `
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
// 回复回复请求参数
ReplyReplyRequest {
Content string `json:"content"`
Images []string `json:"images,optional"`
TopicId string `json:"topic_id"`
ReplyTo int64 `json:"reply_to"`
ReplyId int64 `json:"reply_id"`
ReplyUser string `json:"reply_user" `
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
// 评论列表请求参数
CommentListRequest {
TopicId string `json:"topic_id"`
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 int `json:"page,default=1,optional"`
Size int `json:"size,default=5,optional"`
}
// 点赞评论的请求参数
CommentLikeRequest {
TopicId string `json:"topic_id"`
CommentId int64 `json:"comment_id"`
}
CommentDisLikeRequest {
TopicId string `json:"topic_id"`
CommentId int64 `json:"comment_id"`
}
)
// 响应参数
type (
// CommentContent 评论内容
CommentContent {
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 string `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 评论返回值
CommentListPageResponse {
Size int `json:"size"`
Total int64 `json:"total"`
Current int `json:"current"`
Comments []CommentContent `json:"comments"`
}
// CommentResponse 提交评论响应
CommentResponse {
Id int64 `json:"id"`
Content string `json:"content"`
UserId string `json:"user_id"`
TopicId string `json:"topic_id"`
Author int64 `json:"author"`
Location string `json:"location"`
Browser string `json:"browser"`
OperatingSystem string `json:"operating_system"`
CreatedTime string `json:"created_time"`
ReplyId int64 `json:"reply_id,omitempty"`
ReplyUser string `json:"reply_user,omitempty"`
ReplyTo int64 `json:"reply_to,omitempty"`
}
)
@server (
group: comment // 微服务分组
prefix: /api/auth/comment // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware,CasbinVerifyMiddleware,AuthorizationMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
jwt: Auth // 是否开启jwt验证
)
service auth {
@handler getCommentList
post /list (CommentListRequest) returns (CommentListPageResponse)
@handler getReplyList
post /reply/list (ReplyListRequest) returns (CommentListPageResponse)
@handler submitComment
post /submit (CommentRequest) returns (CommentResponse)
@handler submitReplyComment
post /reply/submit (ReplyCommentRequest) returns (CommentResponse)
@handler submitReplyReply
post /reply/reply/submit (ReplyReplyRequest) returns (CommentResponse)
@handler likeComment
post /like (CommentLikeRequest)
@handler dislikeComment
post /dislike (CommentDisLikeRequest)
}
// 上传图片请求参数
type (
UploadRequest {
Image string `json:"image"`
AccessToken string `json:"access_token"`
userId string `json:"user_id"`
}
)
@server (
group: upscale // 微服务分组
prefix: /api/auth/upscale // 微服务前缀
timeout: 10s // 超时时间
maxBytes: 10485760 // 最大请求大小
signature: false // 是否开启签名验证
middleware: SecurityHeadersMiddleware,NonceMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复
)
service auth {
@handler uploadImage
post /upload (UploadRequest)
}

View File

@@ -13,7 +13,7 @@ import (
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
var configFile = flag.String("f", "etc/auth.yaml", "the config file")
var configFile = flag.String("f", "api/etc/auth.yaml", "the config file")
func main() {
flag.Parse()

View File

@@ -3,7 +3,7 @@ Name: schisandra-auth-service
# 监听地址
Host: 0.0.0.0
# 监听端口
Port: 8080
Port: 80
# 服务的环境,目前我们预定义了 dev。在dev 环境我们会开启反射 dev,test,rt,pre, pro
Mode: pro
# 打点上报,将一些 metrics 上报到对应的地址,如果为空,则不上报
@@ -64,6 +64,18 @@ Mysql:
MaxOpenConn: 10
# 最大空闲连接数
MaxIdleConn: 5
# Mongo 配置
Mongo:
# MongoDB 地址
Uri: mongodb://1.95.0.111:27017
# MongoDB 用户名
Username: landaiqing
# MongoDB 密码
Password: LDQ20020618xxx
# MongoDB 数据库
Database: schisandra-cloud-album
# MongoDB 认证源
AuthSource: admin
# Auth 配置
Auth:
# 访问密钥
@@ -77,7 +89,7 @@ Signature:
# 签名私钥文件
PrivateKeys:
- Fingerprint: idm0jdoau38lwourb4pbjk4dxkat0kcx
KeyFile: etc/rsa_private_key.pem
KeyFile: api/etc/rsa_private_key.pem
# 加密配置
Encrypt:
# 密钥32

View File

@@ -19,6 +19,13 @@ type Config struct {
MaxOpenConn int
MaxIdleConn int
}
Mongo struct {
Uri string
Username string
Password string
AuthSource string
Database string
}
Redis struct {
Host string
Pass string

View File

@@ -0,0 +1,25 @@
package comment
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/comment"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func DislikeCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommentDisLikeRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := comment.NewDislikeCommentLogic(r.Context(), svcCtx)
err := l.DislikeComment(&req)
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
}
}

View File

@@ -0,0 +1,28 @@
package comment
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/comment"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func GetCommentListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommentListRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := comment.NewGetCommentListLogic(r.Context(), svcCtx)
resp, err := l.GetCommentList(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package comment
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/comment"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func GetReplyListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ReplyListRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := comment.NewGetReplyListLogic(r.Context(), svcCtx)
resp, err := l.GetReplyList(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,25 @@
package comment
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/comment"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func LikeCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommentLikeRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := comment.NewLikeCommentLogic(r.Context(), svcCtx)
err := l.LikeComment(&req)
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
}
}

View File

@@ -0,0 +1,29 @@
package comment
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/comment"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func SubmitCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommentRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := comment.NewSubmitCommentLogic(r.Context(), svcCtx)
resp, err := l.SubmitComment(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package comment
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/comment"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func SubmitReplyCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ReplyCommentRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := comment.NewSubmitReplyCommentLogic(r.Context(), svcCtx)
resp, err := l.SubmitReplyComment(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package comment
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/comment"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func SubmitReplyReplyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ReplyReplyRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := comment.NewSubmitReplyReplyLogic(r.Context(), svcCtx)
resp, err := l.SubmitReplyReply(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -9,9 +9,11 @@ import (
captcha "schisandra-album-cloud-microservices/app/auth/api/internal/handler/captcha"
client "schisandra-album-cloud-microservices/app/auth/api/internal/handler/client"
comment "schisandra-album-cloud-microservices/app/auth/api/internal/handler/comment"
oauth "schisandra-album-cloud-microservices/app/auth/api/internal/handler/oauth"
sms "schisandra-album-cloud-microservices/app/auth/api/internal/handler/sms"
token "schisandra-album-cloud-microservices/app/auth/api/internal/handler/token"
upscale "schisandra-album-cloud-microservices/app/auth/api/internal/handler/upscale"
user "schisandra-album-cloud-microservices/app/auth/api/internal/handler/user"
websocket "schisandra-album-cloud-microservices/app/auth/api/internal/handler/websocket"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
@@ -57,6 +59,53 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.CasbinVerifyMiddleware, serverCtx.AuthorizationMiddleware, serverCtx.NonceMiddleware},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/dislike",
Handler: comment.DislikeCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/like",
Handler: comment.LikeCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/list",
Handler: comment.GetCommentListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/reply/list",
Handler: comment.GetReplyListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/reply/reply/submit",
Handler: comment.SubmitReplyReplyHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/reply/submit",
Handler: comment.SubmitReplyCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/submit",
Handler: comment.SubmitCommentHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithPrefix("/api/auth/comment"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware},
@@ -151,6 +200,22 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/upload",
Handler: upscale.UploadImageHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/auth/upscale"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(10485760),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
@@ -190,6 +255,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/file",
Handler: websocket.FileWebsocketHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/message",

View File

@@ -0,0 +1,25 @@
package upscale
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/upscale"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func UploadImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UploadRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := upscale.NewUploadImageLogic(r.Context(), svcCtx)
err := l.UploadImage(r, &req)
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
}
}

View File

@@ -0,0 +1,14 @@
package websocket
import (
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/websocket"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
func FileWebsocketHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := websocket.NewFileWebsocketLogic(r.Context(), svcCtx)
l.FileWebsocket(w, r)
}
}

View File

@@ -0,0 +1,59 @@
package comment
import (
"context"
"errors"
"github.com/zeromicro/go-zero/core/logx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
errors2 "schisandra-album-cloud-microservices/common/errors"
"schisandra-album-cloud-microservices/common/i18n"
)
type DislikeCommentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDislikeCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DislikeCommentLogic {
return &DislikeCommentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *DislikeCommentLogic) DislikeComment(req *types.CommentDisLikeRequest) (err error) {
uid, ok := l.ctx.Value("user_id").(string)
if !ok {
return errors.New("user_id not found")
}
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 err
}
if resultInfo.RowsAffected == 0 {
_ = tx.Rollback()
return errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.LikeError"))
}
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 err
}
if updates.RowsAffected == 0 {
_ = tx.Rollback()
return errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.LikeError"))
}
err = tx.Commit()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,162 @@
package comment
import (
"context"
"encoding/base64"
"errors"
"fmt"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/app/auth/model/mongodb"
"schisandra-album-cloud-microservices/common/constant"
"schisandra-album-cloud-microservices/common/utils"
"sync"
"github.com/chenmingyong0423/go-mongox/v2/builder/query"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gen/field"
)
type GetCommentListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
wg sync.WaitGroup
}
func NewGetCommentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCommentListLogic {
return &GetCommentListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *GetCommentListLogic) GetCommentList(req *types.CommentListRequest) (resp *types.CommentListPageResponse, err error) {
// 获取用户ID
uid, ok := l.ctx.Value("user_id").(string)
if !ok {
return nil, errors.New("user_id not found")
}
var commentQueryList []types.CommentListQueryResult
comment := l.svcCtx.DB.ScaCommentReply
user := l.svcCtx.DB.ScaAuthUser
var orderConditions []field.Expr
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 &types.CommentListPageResponse{
Total: count,
Size: req.Size,
Current: req.Page,
Comments: []types.CommentContent{},
}, 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 := mongodb.MustNewCollection[types.CommentImages](l.svcCtx.MongoClient, 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.Format(constant.TimeFormat),
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 commentListPageResponse, nil
}

View File

@@ -0,0 +1,166 @@
package comment
import (
"context"
"encoding/base64"
"errors"
"fmt"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/app/auth/model/mongodb"
"schisandra-album-cloud-microservices/common/constant"
"schisandra-album-cloud-microservices/common/utils"
"sync"
"github.com/chenmingyong0423/go-mongox/v2/builder/query"
"github.com/zeromicro/go-zero/core/logx"
)
type GetReplyListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
wg sync.WaitGroup
}
func NewGetReplyListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetReplyListLogic {
return &GetReplyListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *GetReplyListLogic) GetReplyList(req *types.ReplyListRequest) (resp *types.CommentListPageResponse, err error) {
// 获取用户ID
uid, ok := l.ctx.Value("user_id").(string)
if !ok {
return nil, errors.New("user_id not found")
}
var replyQueryList []types.ReplyListQueryResult
reply := l.svcCtx.DB.ScaCommentReply
user := l.svcCtx.DB.ScaAuthUser
commentUser := user.As("comment_user")
replyUser := user.As("reply_user")
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.ReplyID.Eq(req.CommentId), 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 &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 := mongodb.MustNewCollection[types.CommentImages](l.svcCtx.MongoClient, 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.Format(constant.TimeFormat),
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 commentListPageResponse, nil
}

View File

@@ -0,0 +1,61 @@
package comment
import (
"context"
"errors"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"schisandra-album-cloud-microservices/common/i18n"
"time"
"github.com/zeromicro/go-zero/core/logx"
)
type LikeCommentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewLikeCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeCommentLogic {
return &LikeCommentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *LikeCommentLogic) LikeComment(req *types.CommentLikeRequest) (err error) {
uid, ok := l.ctx.Value("user_id").(string)
if !ok {
return errors.New("user_id not found")
}
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 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 err
}
if updates.RowsAffected == 0 {
_ = tx.Rollback()
return errors.New(i18n.FormatText(l.ctx, "comment.LikeError"))
}
err = tx.Commit()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,125 @@
package comment
import (
"context"
"errors"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/app/auth/model/mongodb"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"schisandra-album-cloud-microservices/common/captcha/verify"
"schisandra-album-cloud-microservices/common/constant"
errors2 "schisandra-album-cloud-microservices/common/errors"
"schisandra-album-cloud-microservices/common/i18n"
"schisandra-album-cloud-microservices/common/utils"
"time"
"github.com/mssola/useragent"
"github.com/zeromicro/go-zero/core/logx"
)
type SubmitCommentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSubmitCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubmitCommentLogic {
return &SubmitCommentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SubmitCommentLogic) SubmitComment(r *http.Request, req *types.CommentRequest) (resp *types.CommentResponse, err error) {
res := verify.VerifySlideCaptcha(l.ctx, l.svcCtx.RedisClient, req.Point, req.Key)
if !res {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "captcha.verificationFailure"))
}
if len(req.Images) > 3 {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.tooManyImages"))
}
userAgent := r.Header.Get("User-Agent")
if userAgent == "" {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.commentError"))
}
ua := useragent.New(userAgent)
ip := utils.GetClientIP(r)
location, err := l.svcCtx.Ip2Region.SearchByStr(ip)
if err != nil {
return nil, err
}
location = utils.RemoveZeroAndAdjust(location)
browser, _ := ua.Browser()
operatingSystem := ua.OS()
var isAuthor int64 = 0
uid, ok := l.ctx.Value("user_id").(string)
if !ok {
return nil, errors.New("user_id not found in context")
}
if uid == req.Author {
isAuthor = 1
}
xssFilterContent := utils.XssFilter(req.Content)
if xssFilterContent == "" {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.commentError"))
}
commentContent := l.svcCtx.Sensitive.Replace(xssFilterContent, '*')
topicType := constant.CommentTopicType
commentType := constant.COMMENT
comment := &model.ScaCommentReply{
Content: commentContent,
UserID: uid,
TopicID: req.TopicId,
TopicType: topicType,
CommentType: commentType,
Author: isAuthor,
CommentIP: ip,
Location: location,
Browser: browser,
OperatingSystem: operatingSystem,
Agent: userAgent,
}
err = l.svcCtx.DB.ScaCommentReply.Create(comment)
if err != nil {
return nil, err
}
if len(req.Images) > 0 {
imagesData, err := utils.ProcessImages(req.Images)
if err != nil {
return nil, err
}
commentImages := &types.CommentImages{
UserId: uid,
TopicId: req.TopicId,
CommentId: comment.ID,
Images: imagesData,
}
newCollection := mongodb.MustNewCollection[types.CommentImages](l.svcCtx.MongoClient, constant.COMMENT_IMAGES)
_, err = newCollection.Creator().InsertOne(l.ctx, commentImages)
if err != nil {
return nil, err
}
}
commentResponse := &types.CommentResponse{
Id: comment.ID,
Content: commentContent,
UserId: uid,
TopicId: req.TopicId,
Author: isAuthor,
Location: location,
Browser: browser,
OperatingSystem: operatingSystem,
CreatedTime: time.Now().Format(constant.TimeFormat),
}
return commentResponse, nil
}

View File

@@ -0,0 +1,146 @@
package comment
import (
"context"
"errors"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/app/auth/model/mongodb"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"schisandra-album-cloud-microservices/common/captcha/verify"
"schisandra-album-cloud-microservices/common/constant"
errors2 "schisandra-album-cloud-microservices/common/errors"
"schisandra-album-cloud-microservices/common/i18n"
"schisandra-album-cloud-microservices/common/utils"
"time"
"github.com/mssola/useragent"
"github.com/zeromicro/go-zero/core/logx"
)
type SubmitReplyCommentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSubmitReplyCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubmitReplyCommentLogic {
return &SubmitReplyCommentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SubmitReplyCommentLogic) SubmitReplyComment(r *http.Request, req *types.ReplyCommentRequest) (resp *types.CommentResponse, err error) {
res := verify.VerifySlideCaptcha(l.ctx, l.svcCtx.RedisClient, req.Point, req.Key)
if !res {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "captcha.verificationFailure"))
}
if len(req.Images) > 3 {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.tooManyImages"))
}
userAgent := r.Header.Get("User-Agent")
if userAgent == "" {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.commentError"))
}
ua := useragent.New(userAgent)
ip := utils.GetClientIP(r)
location, err := l.svcCtx.Ip2Region.SearchByStr(ip)
if err != nil {
return nil, err
}
location = utils.RemoveZeroAndAdjust(location)
browser, _ := ua.Browser()
operatingSystem := ua.OS()
uid, ok := l.ctx.Value("user_id").(string)
if !ok {
return nil, errors.New("user_id not found in context")
}
var isAuthor int64 = 0
if uid == req.Author {
isAuthor = 1
}
xssFilterContent := utils.XssFilter(req.Content)
if xssFilterContent == "" {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.commentError"))
}
commentContent := l.svcCtx.Sensitive.Replace(xssFilterContent, '*')
tx := l.svcCtx.DB.Begin()
topicType := constant.CommentTopicType
commentType := constant.REPLY
reply := &model.ScaCommentReply{
Content: commentContent,
UserID: uid,
TopicID: req.TopicId,
TopicType: topicType,
CommentType: commentType,
Author: isAuthor,
CommentIP: ip,
Location: location,
Browser: browser,
OperatingSystem: operatingSystem,
Agent: userAgent,
ReplyID: req.ReplyId,
ReplyUser: req.ReplyUser,
}
err = tx.ScaCommentReply.Create(reply)
if err != nil {
return nil, err
}
commentReply := l.svcCtx.DB.ScaCommentReply
update, err := tx.ScaCommentReply.Where(commentReply.ID.Eq(req.ReplyId)).Update(commentReply.ReplyCount, commentReply.ReplyCount.Add(1))
if err != nil {
return nil, err
}
if update.RowsAffected == 0 {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.commentError"))
}
if len(req.Images) > 0 {
imagesData, err := utils.ProcessImages(req.Images)
if err != nil {
return nil, err
}
commentImages := &types.CommentImages{
UserId: uid,
TopicId: req.TopicId,
CommentId: reply.ID,
Images: imagesData,
}
newCollection := mongodb.MustNewCollection[types.CommentImages](l.svcCtx.MongoClient, constant.COMMENT_IMAGES)
_, err = newCollection.Creator().InsertOne(l.ctx, commentImages)
if err != nil {
return nil, err
}
}
commentResponse := &types.CommentResponse{
Id: reply.ID,
Content: commentContent,
UserId: uid,
TopicId: reply.TopicID,
Author: isAuthor,
Location: location,
Browser: browser,
OperatingSystem: operatingSystem,
CreatedTime: time.Now().Format(constant.TimeFormat),
ReplyId: reply.ReplyID,
ReplyUser: reply.ReplyUser,
}
err = tx.Commit()
if err != nil {
return nil, err
}
return commentResponse, nil
}

View File

@@ -0,0 +1,156 @@
package comment
import (
"context"
"errors"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/app/auth/model/mongodb"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"schisandra-album-cloud-microservices/common/captcha/verify"
"schisandra-album-cloud-microservices/common/constant"
errors2 "schisandra-album-cloud-microservices/common/errors"
"schisandra-album-cloud-microservices/common/i18n"
"schisandra-album-cloud-microservices/common/utils"
"time"
"github.com/mssola/useragent"
"github.com/zeromicro/go-zero/core/logx"
)
type SubmitReplyReplyLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSubmitReplyReplyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubmitReplyReplyLogic {
return &SubmitReplyReplyLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SubmitReplyReplyLogic) SubmitReplyReply(r *http.Request, req *types.ReplyReplyRequest) (resp *types.CommentResponse, err error) {
res := verify.VerifySlideCaptcha(l.ctx, l.svcCtx.RedisClient, req.Point, req.Key)
if !res {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "captcha.verificationFailure"))
}
if len(req.Images) > 3 {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.tooManyImages"))
}
userAgent := r.Header.Get("User-Agent")
if userAgent == "" {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.commentError"))
}
ua := useragent.New(userAgent)
// 获取客户端IP及位置信息
ip := utils.GetClientIP(r)
location, err := l.svcCtx.Ip2Region.SearchByStr(ip)
if err != nil {
return nil, err
}
location = utils.RemoveZeroAndAdjust(location)
// 获取浏览器与操作系统信息
browser, _ := ua.Browser()
operatingSystem := ua.OS()
uid, ok := l.ctx.Value("user_id").(string)
if !ok {
return nil, errors.New("user_id not found in context")
}
// 判断作者身份
var isAuthor int64 = 0
if uid == req.Author {
isAuthor = 1
}
// XSS过滤
xssFilterContent := utils.XssFilter(req.Content)
if xssFilterContent == "" {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.commentError"))
}
commentContent := l.svcCtx.Sensitive.Replace(xssFilterContent, '*')
tx := l.svcCtx.DB.Begin()
topicType := constant.CommentTopicType
commentType := constant.REPLY
replyReply := &model.ScaCommentReply{
Content: commentContent,
UserID: uid,
TopicID: req.TopicId,
TopicType: topicType,
CommentType: commentType,
Author: isAuthor,
CommentIP: ip,
Location: location,
Browser: browser,
OperatingSystem: operatingSystem,
Agent: userAgent,
ReplyID: req.ReplyId,
ReplyUser: req.ReplyUser,
ReplyTo: req.ReplyTo,
}
err = tx.ScaCommentReply.Create(replyReply)
if err != nil {
return nil, err
}
commentReply := l.svcCtx.DB.ScaCommentReply
update, err := tx.ScaCommentReply.Where(commentReply.ID.Eq(req.ReplyId)).Update(commentReply.ReplyCount, commentReply.ReplyCount.Add(1))
if err != nil {
return nil, err
}
if update.RowsAffected == 0 {
return nil, errors2.New(http.StatusInternalServerError, i18n.FormatText(l.ctx, "comment.commentError"))
}
// 处理图片
if len(req.Images) > 0 {
imagesData, err := utils.ProcessImages(req.Images)
if err != nil {
return nil, err
}
commentImages := &types.CommentImages{
UserId: uid,
TopicId: req.TopicId,
CommentId: replyReply.ID,
Images: imagesData,
}
newCollection := mongodb.MustNewCollection[types.CommentImages](l.svcCtx.MongoClient, constant.COMMENT_IMAGES)
_, err = newCollection.Creator().InsertOne(l.ctx, commentImages)
if err != nil {
return nil, err
}
}
// 构建响应
commentResponse := &types.CommentResponse{
Id: replyReply.ID,
Content: commentContent,
UserId: uid,
TopicId: replyReply.TopicID,
Author: isAuthor,
Location: location,
Browser: browser,
OperatingSystem: operatingSystem,
CreatedTime: time.Now().Format(constant.TimeFormat),
ReplyId: replyReply.ReplyID,
ReplyUser: replyReply.ReplyUser,
ReplyTo: replyReply.ReplyTo,
}
// 提交事务
if err = tx.Commit(); err != nil {
return nil, err
}
return commentResponse, nil
}

View File

@@ -6,7 +6,7 @@ import (
"errors"
"fmt"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
model2 "schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"schisandra-album-cloud-microservices/common/constant"
"schisandra-album-cloud-microservices/common/xhttp"
"strconv"
@@ -119,7 +119,7 @@ func (l *GiteeCallbackLogic) GiteeCallback(r *http.Request, req *types.OAuthCall
// 创建用户
uid := idgen.NextId()
uidStr := strconv.FormatInt(uid, 10)
addUser := &model.ScaAuthUser{
addUser := &model2.ScaAuthUser{
UID: uidStr,
Avatar: giteeUser.AvatarURL,
Username: giteeUser.Login,
@@ -134,7 +134,7 @@ func (l *GiteeCallbackLogic) GiteeCallback(r *http.Request, req *types.OAuthCall
return "", err
}
gitee := constant.OAuthSourceGitee
newSocialUser := &model.ScaAuthUserSocial{
newSocialUser := &model2.ScaAuthUserSocial{
UserID: uidStr,
OpenID: Id,
Source: gitee,
@@ -180,7 +180,7 @@ func (l *GiteeCallbackLogic) GiteeCallback(r *http.Request, req *types.OAuthCall
}
// HandleOauthLoginResponse 处理登录响应
func HandleOauthLoginResponse(scaAuthUser *model.ScaAuthUser, svcCtx *svc.ServiceContext, r *http.Request, ctx context.Context) (string, error) {
func HandleOauthLoginResponse(scaAuthUser *model2.ScaAuthUser, svcCtx *svc.ServiceContext, r *http.Request, ctx context.Context) (string, error) {
data, err := user.HandleLoginJWT(scaAuthUser, svcCtx, true, r, ctx)
if err != nil {
return "", err

View File

@@ -6,7 +6,7 @@ import (
"errors"
"fmt"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
model2 "schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"schisandra-album-cloud-microservices/common/constant"
"strconv"
@@ -117,7 +117,7 @@ func (l *GithubCallbackLogic) GithubCallback(r *http.Request, req *types.OAuthCa
uidStr := strconv.FormatInt(uid, 10)
male := constant.Male
addUser := &model.ScaAuthUser{
addUser := &model2.ScaAuthUser{
UID: uidStr,
Avatar: gitHubUser.AvatarURL,
Username: gitHubUser.Login,
@@ -133,7 +133,7 @@ func (l *GithubCallbackLogic) GithubCallback(r *http.Request, req *types.OAuthCa
return "", err
}
githubUser := constant.OAuthSourceGithub
newSocialUser := &model.ScaAuthUserSocial{
newSocialUser := &model2.ScaAuthUserSocial{
UserID: uidStr,
OpenID: Id,
Source: githubUser,

View File

@@ -6,7 +6,7 @@ import (
"errors"
"fmt"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
model2 "schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"schisandra-album-cloud-microservices/common/constant"
"strconv"
"strings"
@@ -119,7 +119,7 @@ func (l *QqCallbackLogic) QqCallback(r *http.Request, req *types.OAuthCallbackRe
male := constant.Male
avatarUrl := strings.Replace(qqUserInfo.FigureurlQq1, "http://", "https://", 1)
addUser := &model.ScaAuthUser{
addUser := &model2.ScaAuthUser{
UID: uidStr,
Avatar: avatarUrl,
Username: authQQme.OpenID,
@@ -133,7 +133,7 @@ func (l *QqCallbackLogic) QqCallback(r *http.Request, req *types.OAuthCallbackRe
}
githubUser := constant.OAuthSourceQQ
newSocialUser := &model.ScaAuthUserSocial{
newSocialUser := &model2.ScaAuthUserSocial{
UserID: uidStr,
OpenID: authQQme.OpenID,
Source: githubUser,

View File

@@ -0,0 +1,60 @@
package upscale
import (
"context"
"encoding/json"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/websocket"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/common/errors"
"schisandra-album-cloud-microservices/common/jwt"
"github.com/zeromicro/go-zero/core/logx"
)
type UploadImageLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUploadImageLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadImageLogic {
return &UploadImageLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *UploadImageLogic) UploadImage(r *http.Request, req *types.UploadRequest) (err error) {
token, ok := jwt.ParseAccessToken(l.svcCtx.Config.Auth.AccessSecret, req.AccessToken)
if !ok {
return errors.New(http.StatusForbidden, "invalid access token")
}
if token.UserID != req.UserId {
return errors.New(http.StatusForbidden, "invalid user id")
}
correct, err := l.svcCtx.CasbinEnforcer.Enforce(req.UserId, r.URL.Path, r.Method)
if err != nil || !correct {
return errors.New(http.StatusForbidden, "permission denied")
}
data, err := json.Marshal(xhttp.BaseResponse[string]{
Data: req.Image,
Msg: "success",
Code: http.StatusOK,
})
if err != nil {
return errors.New(http.StatusForbidden, err.Error())
}
err = websocket.FileWebSocketHandler.SendMessageToClient(req.UserId, data)
if err != nil {
return errors.New(http.StatusForbidden, err.Error())
}
return nil
}

View File

@@ -6,8 +6,8 @@ import (
"github.com/lionsoul2014/ip2region/binding/golang/xdb"
"github.com/mssola/useragent"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/query"
model2 "schisandra-album-cloud-microservices/app/auth/model/mysql/model"
query2 "schisandra-album-cloud-microservices/app/auth/model/mysql/query"
"schisandra-album-cloud-microservices/common/captcha/verify"
"schisandra-album-cloud-microservices/common/constant"
"schisandra-album-cloud-microservices/common/errors"
@@ -44,7 +44,7 @@ func (l *AccountLoginLogic) AccountLogin(r *http.Request, req *types.AccountLogi
}
user := l.svcCtx.DB.ScaAuthUser
var selectedUser query.IScaAuthUserDo
var selectedUser query2.IScaAuthUserDo
switch {
case utils.IsPhone(req.Account):
@@ -75,7 +75,7 @@ func (l *AccountLoginLogic) AccountLogin(r *http.Request, req *types.AccountLogi
}
// HandleLoginJWT 处理用户登录
func HandleLoginJWT(user *model.ScaAuthUser, svcCtx *svc.ServiceContext, autoLogin bool, r *http.Request, ctx context.Context) (*types.LoginResponse, error) {
func HandleLoginJWT(user *model2.ScaAuthUser, svcCtx *svc.ServiceContext, autoLogin bool, r *http.Request, ctx context.Context) (*types.LoginResponse, error) {
// 获取用户登录设备
err := GetUserLoginDevice(user.UID, r, svcCtx.Ip2Region, svcCtx.DB)
if err != nil {
@@ -124,7 +124,7 @@ func HandleLoginJWT(user *model.ScaAuthUser, svcCtx *svc.ServiceContext, autoLog
}
// GetUserLoginDevice 获取用户登录设备
func GetUserLoginDevice(userId string, r *http.Request, ip2location *xdb.Searcher, DB *query.Query) error {
func GetUserLoginDevice(userId string, r *http.Request, ip2location *xdb.Searcher, DB *query2.Query) error {
userAgent := r.UserAgent()
if userAgent == "" {
return errors2.New("user agent not found")
@@ -157,7 +157,7 @@ func GetUserLoginDevice(userId string, r *http.Request, ip2location *xdb.Searche
if err != nil && !errors2.Is(err, gorm.ErrRecordNotFound) {
return err
}
newDevice := &model.ScaAuthUserDevice{
newDevice := &model2.ScaAuthUserDevice{
UserID: userId,
Bot: newIsBot,
Agent: userAgent,

View File

@@ -4,7 +4,7 @@ import (
"context"
"errors"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
constant2 "schisandra-album-cloud-microservices/common/constant"
errors2 "schisandra-album-cloud-microservices/common/errors"
"schisandra-album-cloud-microservices/common/i18n"

View File

@@ -6,7 +6,7 @@ import (
"github.com/yitter/idgenerator-go/idgen"
"gorm.io/gorm"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
model2 "schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"schisandra-album-cloud-microservices/common/constant"
"schisandra-album-cloud-microservices/common/encrypt"
errors2 "schisandra-album-cloud-microservices/common/errors"
@@ -61,7 +61,7 @@ func (l *WechatOffiaccountLoginLogic) WechatOffiaccountLogin(r *http.Request, re
avatar := utils.GenerateAvatar(uidStr)
name := randomname.GenerateName()
addUser := &model.ScaAuthUser{
addUser := &model2.ScaAuthUser{
UID: uidStr,
Avatar: avatar,
Username: Openid,
@@ -74,7 +74,7 @@ func (l *WechatOffiaccountLoginLogic) WechatOffiaccountLogin(r *http.Request, re
return nil, err
}
newSocialUser := &model.ScaAuthUserSocial{
newSocialUser := &model2.ScaAuthUserSocial{
UserID: uidStr,
OpenID: Openid,
Source: constant.OAuthSourceWechat,

View File

@@ -0,0 +1,126 @@
package websocket
import (
"context"
"fmt"
"github.com/lxzan/gws"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/common/jwt"
"time"
"github.com/zeromicro/go-zero/core/logx"
)
type FileWebsocketLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFileWebsocketLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FileWebsocketLogic {
return &FileWebsocketLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
type FileWebSocket struct {
ctx context.Context
gws.BuiltinEventHandler
sessions *gws.ConcurrentMap[string, *gws.Conn]
}
var FileWebSocketHandler = NewFileWebSocket()
func (l *FileWebsocketLogic) FileWebsocket(w http.ResponseWriter, r *http.Request) {
token := r.Header.Get("Sec-Websocket-Protocol")
accessToken, res := jwt.ParseAccessToken(l.svcCtx.Config.Auth.AccessSecret, token)
if !res {
return
}
upGrader := gws.NewUpgrader(FileWebSocketHandler, &gws.ServerOption{
HandshakeTimeout: 5 * time.Second, // 握手超时时间
ReadBufferSize: 1024, // 读缓冲区大小
ParallelEnabled: true, // 开启并行消息处理
Recovery: gws.Recovery, // 开启异常恢复
CheckUtf8Enabled: false, // 关闭UTF8校验
PermessageDeflate: gws.PermessageDeflate{
Enabled: true, // 开启压缩
},
Authorize: func(r *http.Request, session gws.SessionStorage) bool {
var clientId = r.URL.Query().Get("user_id")
if clientId == "" {
return false
}
if accessToken.UserID != clientId {
return false
}
session.Store("user_id", clientId)
return true
},
SubProtocols: []string{token},
})
socket, err := upGrader.Upgrade(w, r)
if err != nil {
panic(err)
}
go func() {
socket.ReadLoop()
}()
}
func NewFileWebSocket() *FileWebSocket {
return &FileWebSocket{
ctx: context.Background(),
sessions: gws.NewConcurrentMap[string, *gws.Conn](64, 128),
}
}
// OnOpen 连接建立
func (c *FileWebSocket) OnOpen(socket *gws.Conn) {
clientId := MustLoad[string](socket.Session(), "user_id")
c.sessions.Store(clientId, socket)
// 订阅该用户的频道
fmt.Printf("websocket client %s connected\n", clientId)
}
// OnClose 关闭连接
func (c *FileWebSocket) OnClose(socket *gws.Conn, err error) {
name := MustLoad[string](socket.Session(), "user_id")
sharding := c.sessions.GetSharding(name)
c.sessions.Delete(name)
sharding.Lock()
defer sharding.Unlock()
fmt.Printf("websocket closed, name=%s, msg=%s\n", name, err.Error())
}
// OnPing 处理客户端的Ping消息
func (c *FileWebSocket) OnPing(socket *gws.Conn, payload []byte) {
_ = socket.SetDeadline(time.Now().Add(PingInterval + HeartbeatWaitTimeout))
_ = socket.WritePong(payload)
}
// OnPong 处理客户端的Pong消息
func (c *FileWebSocket) OnPong(_ *gws.Conn, _ []byte) {}
// OnMessage 接受消息
func (c *FileWebSocket) OnMessage(socket *gws.Conn, message *gws.Message) {
defer message.Close()
clientId := MustLoad[string](socket.Session(), "user_id")
if conn, ok := c.sessions.Load(clientId); ok {
_ = conn.WriteMessage(gws.OpcodeText, message.Bytes())
}
// fmt.Printf("received message from client %s\n", message.Data)
}
// SendMessageToClient 向指定客户端发送消息
func (c *FileWebSocket) SendMessageToClient(clientId string, message []byte) error {
conn, ok := c.sessions.Load(clientId)
if ok {
return conn.WriteMessage(gws.OpcodeText, message)
}
return fmt.Errorf("client %s not found", clientId)
}

View File

@@ -8,14 +8,18 @@ import (
"github.com/wenlng/go-captcha/v2/rotate"
"github.com/wenlng/go-captcha/v2/slide"
"github.com/zeromicro/go-zero/rest"
sensitive "github.com/zmexing/go-sensitive-word"
"go.mongodb.org/mongo-driver/v2/mongo"
"schisandra-album-cloud-microservices/app/auth/api/internal/config"
"schisandra-album-cloud-microservices/app/auth/api/internal/middleware"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/query"
"schisandra-album-cloud-microservices/app/auth/model/mongodb"
"schisandra-album-cloud-microservices/app/auth/model/mysql"
"schisandra-album-cloud-microservices/app/auth/model/mysql/query"
"schisandra-album-cloud-microservices/common/captcha/initialize"
"schisandra-album-cloud-microservices/common/casbinx"
"schisandra-album-cloud-microservices/common/ip2region"
"schisandra-album-cloud-microservices/common/redisx"
"schisandra-album-cloud-microservices/common/sensitivex"
"schisandra-album-cloud-microservices/common/wechat_official"
)
@@ -30,9 +34,10 @@ type ServiceContext struct {
Ip2Region *xdb.Searcher
CasbinEnforcer *casbin.SyncedCachedEnforcer
WechatOfficial *officialAccount.OfficialAccount
RotateCaptcha rotate.Captcha
SlideCaptcha slide.Captcha
MongoClient *mongo.Database
RotateCaptcha rotate.Captcha
SlideCaptcha slide.Captcha
Sensitive *sensitive.Manager
}
func NewServiceContext(c config.Config) *ServiceContext {
@@ -52,5 +57,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
WechatOfficial: wechat_official.NewWechatPublic(c.Wechat.AppID, c.Wechat.AppSecret, c.Wechat.Token, c.Wechat.AESKey, c.Redis.Host, c.Redis.Pass, c.Redis.DB),
RotateCaptcha: initialize.NewRotateCaptcha(),
SlideCaptcha: initialize.NewSlideCaptcha(),
MongoClient: mongodb.NewMongoDB(c.Mongo.Uri, c.Mongo.Username, c.Mongo.Password, c.Mongo.AuthSource, c.Mongo.Database),
Sensitive: sensitivex.NewSensitive(),
}
}

View File

@@ -0,0 +1,54 @@
package types
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"`
}
// 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"`
}

View File

@@ -11,6 +11,77 @@ type AccountLoginRequest struct {
Key string `json:"key"`
}
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 string `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"`
}
type CommentDisLikeRequest struct {
TopicId string `json:"topic_id"`
CommentId int64 `json:"comment_id"`
}
type CommentLikeRequest struct {
TopicId string `json:"topic_id"`
CommentId int64 `json:"comment_id"`
}
type CommentListPageResponse struct {
Size int `json:"size"`
Total int64 `json:"total"`
Current int `json:"current"`
Comments []CommentContent `json:"comments"`
}
type CommentListRequest struct {
TopicId string `json:"topic_id"`
Page int `json:"page,default=1,optional"`
Size int `json:"size,default=5,optional"`
IsHot bool `json:"is_hot,default=true,optional"`
}
type CommentRequest struct {
Content string `json:"content"`
Images []string `json:"images,optional"`
TopicId string `json:"topic_id"`
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
type CommentResponse struct {
Id int64 `json:"id"`
Content string `json:"content"`
UserId string `json:"user_id"`
TopicId string `json:"topic_id"`
Author int64 `json:"author"`
Location string `json:"location"`
Browser string `json:"browser"`
OperatingSystem string `json:"operating_system"`
CreatedTime string `json:"created_time"`
ReplyId int64 `json:"reply_id,omitempty"`
ReplyUser string `json:"reply_user,omitempty"`
ReplyTo int64 `json:"reply_to,omitempty"`
}
type LoginResponse struct {
AccessToken string `json:"access_token"`
ExpireAt int64 `json:"expire_at"`
@@ -44,6 +115,36 @@ type RefreshTokenResponse struct {
ExpireAt int64 `json:"expire_at"`
}
type ReplyCommentRequest struct {
Content string `json:"content"`
Images []string `json:"images,optional"`
TopicId string `json:"topic_id" `
ReplyId int64 `json:"reply_id" `
ReplyUser string `json:"reply_user" `
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
type ReplyListRequest struct {
TopicId string `json:"topic_id"`
CommentId int64 `json:"comment_id"`
Page int `json:"page,default=1,optional"`
Size int `json:"size,default=5,optional"`
}
type ReplyReplyRequest struct {
Content string `json:"content"`
Images []string `json:"images,optional"`
TopicId string `json:"topic_id"`
ReplyTo int64 `json:"reply_to"`
ReplyId int64 `json:"reply_id"`
ReplyUser string `json:"reply_user" `
Author string `json:"author"`
Key string `json:"key"`
Point []int64 `json:"point"`
}
type ResetPasswordRequest struct {
Phone string `json:"phone"`
Captcha string `json:"captcha"`
@@ -73,6 +174,12 @@ type SmsSendRequest struct {
Key string `json:"key"`
}
type UploadRequest struct {
Image string `json:"image"`
AccessToken string `json:"access_token"`
UserId string `json:"user_id"`
}
type WechatOffiaccountLoginRequest struct {
Openid string `json:"openid"`
ClientId string `json:"client_id"`

View File

@@ -0,0 +1,12 @@
package mongodb
import (
"github.com/chenmingyong0423/go-mongox/v2"
"go.mongodb.org/mongo-driver/v2/mongo"
)
// MustNewCollection creates a new Collection instance with the given name.
func MustNewCollection[T any](mongoClient *mongo.Database, collectionName string) *mongox.Collection[T] {
collection := mongoClient.Collection(collectionName)
return mongox.NewCollection[T](collection)
}

View File

@@ -0,0 +1,26 @@
package mongodb
import (
"context"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.mongodb.org/mongo-driver/v2/mongo/options"
"go.mongodb.org/mongo-driver/v2/mongo/readpref"
)
// NewMongoDB initializes the MongoDB connection and returns the database object
func NewMongoDB(uri string, username string, password string, authSource string, database string) *mongo.Database {
client, err := mongo.Connect(options.Client().ApplyURI(uri).SetAuth(options.Credential{
Username: username,
Password: password,
AuthSource: authSource,
}))
if err != nil {
panic(err)
}
err = client.Ping(context.Background(), readpref.Primary())
if err != nil {
panic(err)
}
db := client.Database(database)
return db
}

View File

@@ -25,7 +25,7 @@ func main() {
if err != nil {
panic(err)
}
path := filepath.Join(dir, "app/auth/api/model/mysql/", "query")
path := filepath.Join(dir, "app/auth/api/repository/mysql/", "query")
// 生成实例
g := gen.NewGenerator(gen.Config{
// 相对执行`go run`时的路径, 会自动创建目录

View File

@@ -0,0 +1,25 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"time"
)
const TableNameScaCommentLike = "sca_comment_likes"
// ScaCommentLike mapped from table <sca_comment_likes>
type ScaCommentLike struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键id;primary_key" json:"id,string"` // 主键id
TopicID string `gorm:"column:topic_id;type:varchar(50);not null;comment:话题ID" json:"topic_id"` // 话题ID
UserID string `gorm:"column:user_id;type:varchar(50);not null;comment:用户ID" json:"user_id"` // 用户ID
CommentID int64 `gorm:"column:comment_id;type:bigint;not null;comment:评论ID" json:"comment_id"` // 评论ID
LikeTime time.Time `gorm:"column:like_time;type:timestamp;comment:点赞时间" json:"like_time"` // 点赞时间
}
// TableName ScaCommentLike's table name
func (*ScaCommentLike) TableName() string {
return TableNameScaCommentLike
}

View File

@@ -0,0 +1,44 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
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;primary_key" 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
func (*ScaCommentReply) TableName() string {
return TableNameScaCommentReply
}

View File

@@ -0,0 +1,31 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"time"
"gorm.io/gorm"
)
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:主键;primary_key" 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
func (*ScaFileFolder) TableName() string {
return TableNameScaFileFolder
}

View File

@@ -0,0 +1,34 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"time"
"gorm.io/gorm"
)
const TableNameScaFileInfo = "sca_file_info"
// ScaFileInfo mapped from table <sca_file_info>
type ScaFileInfo struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键;primary_key" json:"id,string"` // 主键
FileName string `gorm:"column:file_name;type:varchar(50);comment:文件名" json:"file_name"` // 文件名
FileSize float64 `gorm:"column:file_size;type:double;comment:文件大小" json:"file_size"` // 文件大小
FileTypeID int64 `gorm:"column:file_type_id;type:bigint;comment:文件类型编号" json:"file_type_id"` // 文件类型编号
UploadTime time.Time `gorm:"column:upload_time;type:datetime;comment:上传时间" json:"upload_time"` // 上传时间
FolderID int64 `gorm:"column:folder_id;type:bigint;comment:文件夹编号" json:"folder_id"` // 文件夹编号
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户编号" json:"user_id"` // 用户编号
FileSource int64 `gorm:"column:file_source;type:int;comment:文件来源 0 相册 1 评论" json:"file_source"` // 文件来源 0 相册 1 评论
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"` // 更新时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
}
// TableName ScaFileInfo's table name
func (*ScaFileInfo) TableName() string {
return TableNameScaFileInfo
}

View File

@@ -0,0 +1,28 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"gorm.io/gorm"
)
const TableNameScaFileRecycle = "sca_file_recycle"
// ScaFileRecycle mapped from table <sca_file_recycle>
type ScaFileRecycle struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键;primary_key" json:"id,string"` // 主键
FileID int64 `gorm:"column:file_id;type:bigint;comment:文件编号" json:"file_id"` // 文件编号
FolderID int64 `gorm:"column:folder_id;type:bigint;comment:文件夹编号" json:"folder_id"` // 文件夹编号
Type int64 `gorm:"column:type;type:int;comment:类型 0 文件 1 文件夹" json:"type"` // 类型 0 文件 1 文件夹
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"` // 原始路径
FileSource int64 `gorm:"column:file_source;type:int;comment:文件来源 0 相册 1 评论" json:"file_source"` // 文件来源 0 相册 1 评论
}
// TableName ScaFileRecycle's table name
func (*ScaFileRecycle) TableName() string {
return TableNameScaFileRecycle
}

View File

@@ -0,0 +1,29 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"time"
"gorm.io/gorm"
)
const TableNameScaFileType = "sca_file_type"
// ScaFileType mapped from table <sca_file_type>
type ScaFileType struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键;primary_key" json:"id,string"` // 主键
TypeName string `gorm:"column:type_name;type:varchar(100);comment:类型名称" json:"type_name"` // 类型名称
MimeType string `gorm:"column:mime_type;type:varchar(50);comment:MIME 类型" json:"mime_type"` // MIME 类型
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"` // 更新时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
}
// TableName ScaFileType's table name
func (*ScaFileType) TableName() string {
return TableNameScaFileType
}

View File

@@ -0,0 +1,34 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"time"
"gorm.io/gorm"
)
const TableNameScaMessageReport = "sca_message_report"
// ScaMessageReport mapped from table <sca_message_report>
type ScaMessageReport struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键;primary_key" json:"id,string"` // 主键
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户Id" json:"user_id"` // 用户Id
Type int64 `gorm:"column:type;type:tinyint;comment:举报类型 0评论 1 相册" json:"type"` // 举报类型 0评论 1 相册
CommentID int64 `gorm:"column:comment_id;type:bigint;comment:评论Id" json:"comment_id"` // 评论Id
TopicID string `gorm:"column:topic_id;type:varchar(20);comment:话题Id" json:"topic_id"` // 话题Id
ReportType int64 `gorm:"column:report_type;type:tinyint;comment:举报" json:"report_type"` // 举报
ReportContent string `gorm:"column:report_content;type:text;comment:举报说明内容" json:"report_content"` // 举报说明内容
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"` // 创建时间
UpdatedAt *time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
}
// TableName ScaMessageReport's table name
func (*ScaMessageReport) TableName() string {
return TableNameScaMessageReport
}

View File

@@ -0,0 +1,29 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package model
import (
"time"
"gorm.io/gorm"
)
const TableNameScaUserFollow = "sca_user_follows"
// ScaUserFollow mapped from table <sca_user_follows>
type ScaUserFollow struct {
FollowerID string `gorm:"column:follower_id;type:varchar(50);not null;comment:关注者" json:"follower_id"` // 关注者
FolloweeID string `gorm:"column:followee_id;type:varchar(50);not null;comment:被关注者" json:"followee_id"` // 被关注者
Status int64 `gorm:"column:status;type:tinyint unsigned;not null;comment:关注状态0 未互关 1 互关)" json:"status"` // 关注状态0 未互关 1 互关)
CreatedAt *time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
UpdatedAt *time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;primary_key" json:"id,string"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
}
// TableName ScaUserFollow's table name
func (*ScaUserFollow) TableName() string {
return TableNameScaUserFollow
}

View File

@@ -1,6 +1,11 @@
package mysql
import (
"log"
"os"
"schisandra-album-cloud-microservices/app/auth/model/mysql/query"
"time"
"github.com/asjdf/gorm-cache/cache"
"github.com/asjdf/gorm-cache/config"
"github.com/asjdf/gorm-cache/storage"
@@ -8,10 +13,6 @@ import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"log"
"os"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/query"
"time"
)
func NewMySQL(url string, maxOpenConn int, maxIdleConn int, client *redis.Client) (*gorm.DB, *query.Query) {

View File

@@ -23,6 +23,14 @@ var (
ScaAuthUser *scaAuthUser
ScaAuthUserDevice *scaAuthUserDevice
ScaAuthUserSocial *scaAuthUserSocial
ScaCommentLike *scaCommentLike
ScaCommentReply *scaCommentReply
ScaFileFolder *scaFileFolder
ScaFileInfo *scaFileInfo
ScaFileRecycle *scaFileRecycle
ScaFileType *scaFileType
ScaMessageReport *scaMessageReport
ScaUserFollow *scaUserFollow
ScaUserLevel *scaUserLevel
ScaUserMessage *scaUserMessage
)
@@ -35,6 +43,14 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
ScaAuthUser = &Q.ScaAuthUser
ScaAuthUserDevice = &Q.ScaAuthUserDevice
ScaAuthUserSocial = &Q.ScaAuthUserSocial
ScaCommentLike = &Q.ScaCommentLike
ScaCommentReply = &Q.ScaCommentReply
ScaFileFolder = &Q.ScaFileFolder
ScaFileInfo = &Q.ScaFileInfo
ScaFileRecycle = &Q.ScaFileRecycle
ScaFileType = &Q.ScaFileType
ScaMessageReport = &Q.ScaMessageReport
ScaUserFollow = &Q.ScaUserFollow
ScaUserLevel = &Q.ScaUserLevel
ScaUserMessage = &Q.ScaUserMessage
}
@@ -48,6 +64,14 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
ScaAuthUser: newScaAuthUser(db, opts...),
ScaAuthUserDevice: newScaAuthUserDevice(db, opts...),
ScaAuthUserSocial: newScaAuthUserSocial(db, opts...),
ScaCommentLike: newScaCommentLike(db, opts...),
ScaCommentReply: newScaCommentReply(db, opts...),
ScaFileFolder: newScaFileFolder(db, opts...),
ScaFileInfo: newScaFileInfo(db, opts...),
ScaFileRecycle: newScaFileRecycle(db, opts...),
ScaFileType: newScaFileType(db, opts...),
ScaMessageReport: newScaMessageReport(db, opts...),
ScaUserFollow: newScaUserFollow(db, opts...),
ScaUserLevel: newScaUserLevel(db, opts...),
ScaUserMessage: newScaUserMessage(db, opts...),
}
@@ -62,6 +86,14 @@ type Query struct {
ScaAuthUser scaAuthUser
ScaAuthUserDevice scaAuthUserDevice
ScaAuthUserSocial scaAuthUserSocial
ScaCommentLike scaCommentLike
ScaCommentReply scaCommentReply
ScaFileFolder scaFileFolder
ScaFileInfo scaFileInfo
ScaFileRecycle scaFileRecycle
ScaFileType scaFileType
ScaMessageReport scaMessageReport
ScaUserFollow scaUserFollow
ScaUserLevel scaUserLevel
ScaUserMessage scaUserMessage
}
@@ -77,6 +109,14 @@ func (q *Query) clone(db *gorm.DB) *Query {
ScaAuthUser: q.ScaAuthUser.clone(db),
ScaAuthUserDevice: q.ScaAuthUserDevice.clone(db),
ScaAuthUserSocial: q.ScaAuthUserSocial.clone(db),
ScaCommentLike: q.ScaCommentLike.clone(db),
ScaCommentReply: q.ScaCommentReply.clone(db),
ScaFileFolder: q.ScaFileFolder.clone(db),
ScaFileInfo: q.ScaFileInfo.clone(db),
ScaFileRecycle: q.ScaFileRecycle.clone(db),
ScaFileType: q.ScaFileType.clone(db),
ScaMessageReport: q.ScaMessageReport.clone(db),
ScaUserFollow: q.ScaUserFollow.clone(db),
ScaUserLevel: q.ScaUserLevel.clone(db),
ScaUserMessage: q.ScaUserMessage.clone(db),
}
@@ -99,6 +139,14 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
ScaAuthUser: q.ScaAuthUser.replaceDB(db),
ScaAuthUserDevice: q.ScaAuthUserDevice.replaceDB(db),
ScaAuthUserSocial: q.ScaAuthUserSocial.replaceDB(db),
ScaCommentLike: q.ScaCommentLike.replaceDB(db),
ScaCommentReply: q.ScaCommentReply.replaceDB(db),
ScaFileFolder: q.ScaFileFolder.replaceDB(db),
ScaFileInfo: q.ScaFileInfo.replaceDB(db),
ScaFileRecycle: q.ScaFileRecycle.replaceDB(db),
ScaFileType: q.ScaFileType.replaceDB(db),
ScaMessageReport: q.ScaMessageReport.replaceDB(db),
ScaUserFollow: q.ScaUserFollow.replaceDB(db),
ScaUserLevel: q.ScaUserLevel.replaceDB(db),
ScaUserMessage: q.ScaUserMessage.replaceDB(db),
}
@@ -111,6 +159,14 @@ type queryCtx struct {
ScaAuthUser IScaAuthUserDo
ScaAuthUserDevice IScaAuthUserDeviceDo
ScaAuthUserSocial IScaAuthUserSocialDo
ScaCommentLike IScaCommentLikeDo
ScaCommentReply IScaCommentReplyDo
ScaFileFolder IScaFileFolderDo
ScaFileInfo IScaFileInfoDo
ScaFileRecycle IScaFileRecycleDo
ScaFileType IScaFileTypeDo
ScaMessageReport IScaMessageReportDo
ScaUserFollow IScaUserFollowDo
ScaUserLevel IScaUserLevelDo
ScaUserMessage IScaUserMessageDo
}
@@ -123,6 +179,14 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
ScaAuthUser: q.ScaAuthUser.WithContext(ctx),
ScaAuthUserDevice: q.ScaAuthUserDevice.WithContext(ctx),
ScaAuthUserSocial: q.ScaAuthUserSocial.WithContext(ctx),
ScaCommentLike: q.ScaCommentLike.WithContext(ctx),
ScaCommentReply: q.ScaCommentReply.WithContext(ctx),
ScaFileFolder: q.ScaFileFolder.WithContext(ctx),
ScaFileInfo: q.ScaFileInfo.WithContext(ctx),
ScaFileRecycle: q.ScaFileRecycle.WithContext(ctx),
ScaFileType: q.ScaFileType.WithContext(ctx),
ScaMessageReport: q.ScaMessageReport.WithContext(ctx),
ScaUserFollow: q.ScaUserFollow.WithContext(ctx),
ScaUserLevel: q.ScaUserLevel.WithContext(ctx),
ScaUserMessage: q.ScaUserMessage.WithContext(ctx),
}

View File

@@ -6,11 +6,10 @@ package query
import (
"context"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"

View File

@@ -6,11 +6,10 @@ package query
import (
"context"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"

View File

@@ -6,11 +6,10 @@ package query
import (
"context"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"

View File

@@ -6,11 +6,10 @@ package query
import (
"context"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"

View File

@@ -6,11 +6,10 @@ package query
import (
"context"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"

View File

@@ -6,11 +6,10 @@ package query
import (
"context"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"

View File

@@ -0,0 +1,394 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
)
func newScaCommentLike(db *gorm.DB, opts ...gen.DOOption) scaCommentLike {
_scaCommentLike := scaCommentLike{}
_scaCommentLike.scaCommentLikeDo.UseDB(db, opts...)
_scaCommentLike.scaCommentLikeDo.UseModel(&model.ScaCommentLike{})
tableName := _scaCommentLike.scaCommentLikeDo.TableName()
_scaCommentLike.ALL = field.NewAsterisk(tableName)
_scaCommentLike.ID = field.NewInt64(tableName, "id")
_scaCommentLike.TopicID = field.NewString(tableName, "topic_id")
_scaCommentLike.UserID = field.NewString(tableName, "user_id")
_scaCommentLike.CommentID = field.NewInt64(tableName, "comment_id")
_scaCommentLike.LikeTime = field.NewTime(tableName, "like_time")
_scaCommentLike.fillFieldMap()
return _scaCommentLike
}
type scaCommentLike struct {
scaCommentLikeDo
ALL field.Asterisk
ID field.Int64 // 主键id
TopicID field.String // 话题ID
UserID field.String // 用户ID
CommentID field.Int64 // 评论ID
LikeTime field.Time // 点赞时间
fieldMap map[string]field.Expr
}
func (s scaCommentLike) Table(newTableName string) *scaCommentLike {
s.scaCommentLikeDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaCommentLike) As(alias string) *scaCommentLike {
s.scaCommentLikeDo.DO = *(s.scaCommentLikeDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaCommentLike) updateTableName(table string) *scaCommentLike {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.TopicID = field.NewString(table, "topic_id")
s.UserID = field.NewString(table, "user_id")
s.CommentID = field.NewInt64(table, "comment_id")
s.LikeTime = field.NewTime(table, "like_time")
s.fillFieldMap()
return s
}
func (s *scaCommentLike) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *scaCommentLike) fillFieldMap() {
s.fieldMap = make(map[string]field.Expr, 5)
s.fieldMap["id"] = s.ID
s.fieldMap["topic_id"] = s.TopicID
s.fieldMap["user_id"] = s.UserID
s.fieldMap["comment_id"] = s.CommentID
s.fieldMap["like_time"] = s.LikeTime
}
func (s scaCommentLike) clone(db *gorm.DB) scaCommentLike {
s.scaCommentLikeDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaCommentLike) replaceDB(db *gorm.DB) scaCommentLike {
s.scaCommentLikeDo.ReplaceDB(db)
return s
}
type scaCommentLikeDo struct{ gen.DO }
type IScaCommentLikeDo interface {
gen.SubQuery
Debug() IScaCommentLikeDo
WithContext(ctx context.Context) IScaCommentLikeDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaCommentLikeDo
WriteDB() IScaCommentLikeDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaCommentLikeDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaCommentLikeDo
Not(conds ...gen.Condition) IScaCommentLikeDo
Or(conds ...gen.Condition) IScaCommentLikeDo
Select(conds ...field.Expr) IScaCommentLikeDo
Where(conds ...gen.Condition) IScaCommentLikeDo
Order(conds ...field.Expr) IScaCommentLikeDo
Distinct(cols ...field.Expr) IScaCommentLikeDo
Omit(cols ...field.Expr) IScaCommentLikeDo
Join(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo
Group(cols ...field.Expr) IScaCommentLikeDo
Having(conds ...gen.Condition) IScaCommentLikeDo
Limit(limit int) IScaCommentLikeDo
Offset(offset int) IScaCommentLikeDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentLikeDo
Unscoped() IScaCommentLikeDo
Create(values ...*model.ScaCommentLike) error
CreateInBatches(values []*model.ScaCommentLike, batchSize int) error
Save(values ...*model.ScaCommentLike) error
First() (*model.ScaCommentLike, error)
Take() (*model.ScaCommentLike, error)
Last() (*model.ScaCommentLike, error)
Find() ([]*model.ScaCommentLike, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentLike, err error)
FindInBatches(result *[]*model.ScaCommentLike, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaCommentLike) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IScaCommentLikeDo
Assign(attrs ...field.AssignExpr) IScaCommentLikeDo
Joins(fields ...field.RelationField) IScaCommentLikeDo
Preload(fields ...field.RelationField) IScaCommentLikeDo
FirstOrInit() (*model.ScaCommentLike, error)
FirstOrCreate() (*model.ScaCommentLike, error)
FindByPage(offset int, limit int) (result []*model.ScaCommentLike, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IScaCommentLikeDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaCommentLikeDo) Debug() IScaCommentLikeDo {
return s.withDO(s.DO.Debug())
}
func (s scaCommentLikeDo) WithContext(ctx context.Context) IScaCommentLikeDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaCommentLikeDo) ReadDB() IScaCommentLikeDo {
return s.Clauses(dbresolver.Read)
}
func (s scaCommentLikeDo) WriteDB() IScaCommentLikeDo {
return s.Clauses(dbresolver.Write)
}
func (s scaCommentLikeDo) Session(config *gorm.Session) IScaCommentLikeDo {
return s.withDO(s.DO.Session(config))
}
func (s scaCommentLikeDo) Clauses(conds ...clause.Expression) IScaCommentLikeDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaCommentLikeDo) Returning(value interface{}, columns ...string) IScaCommentLikeDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaCommentLikeDo) Not(conds ...gen.Condition) IScaCommentLikeDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaCommentLikeDo) Or(conds ...gen.Condition) IScaCommentLikeDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaCommentLikeDo) Select(conds ...field.Expr) IScaCommentLikeDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaCommentLikeDo) Where(conds ...gen.Condition) IScaCommentLikeDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaCommentLikeDo) Order(conds ...field.Expr) IScaCommentLikeDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaCommentLikeDo) Distinct(cols ...field.Expr) IScaCommentLikeDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaCommentLikeDo) Omit(cols ...field.Expr) IScaCommentLikeDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaCommentLikeDo) Join(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaCommentLikeDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaCommentLikeDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaCommentLikeDo) Group(cols ...field.Expr) IScaCommentLikeDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaCommentLikeDo) Having(conds ...gen.Condition) IScaCommentLikeDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaCommentLikeDo) Limit(limit int) IScaCommentLikeDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaCommentLikeDo) Offset(offset int) IScaCommentLikeDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaCommentLikeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentLikeDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaCommentLikeDo) Unscoped() IScaCommentLikeDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaCommentLikeDo) Create(values ...*model.ScaCommentLike) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaCommentLikeDo) CreateInBatches(values []*model.ScaCommentLike, batchSize int) error {
return s.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (s scaCommentLikeDo) Save(values ...*model.ScaCommentLike) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaCommentLikeDo) First() (*model.ScaCommentLike, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentLike), nil
}
}
func (s scaCommentLikeDo) Take() (*model.ScaCommentLike, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentLike), nil
}
}
func (s scaCommentLikeDo) Last() (*model.ScaCommentLike, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentLike), nil
}
}
func (s scaCommentLikeDo) Find() ([]*model.ScaCommentLike, error) {
result, err := s.DO.Find()
return result.([]*model.ScaCommentLike), err
}
func (s scaCommentLikeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentLike, err error) {
buf := make([]*model.ScaCommentLike, 0, batchSize)
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (s scaCommentLikeDo) FindInBatches(result *[]*model.ScaCommentLike, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaCommentLikeDo) Attrs(attrs ...field.AssignExpr) IScaCommentLikeDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaCommentLikeDo) Assign(attrs ...field.AssignExpr) IScaCommentLikeDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaCommentLikeDo) Joins(fields ...field.RelationField) IScaCommentLikeDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaCommentLikeDo) Preload(fields ...field.RelationField) IScaCommentLikeDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaCommentLikeDo) FirstOrInit() (*model.ScaCommentLike, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentLike), nil
}
}
func (s scaCommentLikeDo) FirstOrCreate() (*model.ScaCommentLike, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentLike), nil
}
}
func (s scaCommentLikeDo) FindByPage(offset int, limit int) (result []*model.ScaCommentLike, count int64, err error) {
result, err = s.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = s.Offset(-1).Limit(-1).Count()
return
}
func (s scaCommentLikeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s scaCommentLikeDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaCommentLikeDo) Delete(models ...*model.ScaCommentLike) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaCommentLikeDo) withDO(do gen.Dao) *scaCommentLikeDo {
s.DO = *do.(*gen.DO)
return s
}

View File

@@ -0,0 +1,458 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
)
func newScaCommentReply(db *gorm.DB, opts ...gen.DOOption) scaCommentReply {
_scaCommentReply := scaCommentReply{}
_scaCommentReply.scaCommentReplyDo.UseDB(db, opts...)
_scaCommentReply.scaCommentReplyDo.UseModel(&model.ScaCommentReply{})
tableName := _scaCommentReply.scaCommentReplyDo.TableName()
_scaCommentReply.ALL = field.NewAsterisk(tableName)
_scaCommentReply.ID = field.NewInt64(tableName, "id")
_scaCommentReply.UserID = field.NewString(tableName, "user_id")
_scaCommentReply.TopicID = field.NewString(tableName, "topic_id")
_scaCommentReply.TopicType = field.NewInt64(tableName, "topic_type")
_scaCommentReply.Content = field.NewString(tableName, "content")
_scaCommentReply.CommentType = field.NewInt64(tableName, "comment_type")
_scaCommentReply.ReplyTo = field.NewInt64(tableName, "reply_to")
_scaCommentReply.ReplyID = field.NewInt64(tableName, "reply_id")
_scaCommentReply.ReplyUser = field.NewString(tableName, "reply_user")
_scaCommentReply.Author = field.NewInt64(tableName, "author")
_scaCommentReply.Likes = field.NewInt64(tableName, "likes")
_scaCommentReply.ReplyCount = field.NewInt64(tableName, "reply_count")
_scaCommentReply.Browser = field.NewString(tableName, "browser")
_scaCommentReply.OperatingSystem = field.NewString(tableName, "operating_system")
_scaCommentReply.CommentIP = field.NewString(tableName, "comment_ip")
_scaCommentReply.Location = field.NewString(tableName, "location")
_scaCommentReply.Agent = field.NewString(tableName, "agent")
_scaCommentReply.CreatedAt = field.NewTime(tableName, "created_at")
_scaCommentReply.UpdatedAt = field.NewTime(tableName, "updated_at")
_scaCommentReply.Version = field.NewField(tableName, "version")
_scaCommentReply.DeletedAt = field.NewField(tableName, "deleted_at")
_scaCommentReply.fillFieldMap()
return _scaCommentReply
}
type scaCommentReply struct {
scaCommentReplyDo
ALL field.Asterisk
ID field.Int64 // 主键id
UserID field.String // 评论用户id
TopicID field.String // 评论话题id
TopicType field.Int64 // 话题类型
Content field.String // 评论内容
CommentType field.Int64 // 评论类型 0评论 1 回复
ReplyTo field.Int64 // 回复子评论ID
ReplyID field.Int64 // 回复父评论Id
ReplyUser field.String // 回复人id
Author field.Int64 // 评论回复是否作者 0否 1是
Likes field.Int64 // 点赞数
ReplyCount field.Int64 // 回复数量
Browser field.String // 浏览器
OperatingSystem field.String // 操作系统
CommentIP field.String // IP地址
Location field.String // 地址
Agent field.String // 设备信息
CreatedAt field.Time // 创建时间
UpdatedAt field.Time // 更新时间
Version field.Field // 版本
DeletedAt field.Field // 删除时间
fieldMap map[string]field.Expr
}
func (s scaCommentReply) Table(newTableName string) *scaCommentReply {
s.scaCommentReplyDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaCommentReply) As(alias string) *scaCommentReply {
s.scaCommentReplyDo.DO = *(s.scaCommentReplyDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaCommentReply) updateTableName(table string) *scaCommentReply {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.UserID = field.NewString(table, "user_id")
s.TopicID = field.NewString(table, "topic_id")
s.TopicType = field.NewInt64(table, "topic_type")
s.Content = field.NewString(table, "content")
s.CommentType = field.NewInt64(table, "comment_type")
s.ReplyTo = field.NewInt64(table, "reply_to")
s.ReplyID = field.NewInt64(table, "reply_id")
s.ReplyUser = field.NewString(table, "reply_user")
s.Author = field.NewInt64(table, "author")
s.Likes = field.NewInt64(table, "likes")
s.ReplyCount = field.NewInt64(table, "reply_count")
s.Browser = field.NewString(table, "browser")
s.OperatingSystem = field.NewString(table, "operating_system")
s.CommentIP = field.NewString(table, "comment_ip")
s.Location = field.NewString(table, "location")
s.Agent = field.NewString(table, "agent")
s.CreatedAt = field.NewTime(table, "created_at")
s.UpdatedAt = field.NewTime(table, "updated_at")
s.Version = field.NewField(table, "version")
s.DeletedAt = field.NewField(table, "deleted_at")
s.fillFieldMap()
return s
}
func (s *scaCommentReply) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *scaCommentReply) fillFieldMap() {
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
s.fieldMap["topic_type"] = s.TopicType
s.fieldMap["content"] = s.Content
s.fieldMap["comment_type"] = s.CommentType
s.fieldMap["reply_to"] = s.ReplyTo
s.fieldMap["reply_id"] = s.ReplyID
s.fieldMap["reply_user"] = s.ReplyUser
s.fieldMap["author"] = s.Author
s.fieldMap["likes"] = s.Likes
s.fieldMap["reply_count"] = s.ReplyCount
s.fieldMap["browser"] = s.Browser
s.fieldMap["operating_system"] = s.OperatingSystem
s.fieldMap["comment_ip"] = s.CommentIP
s.fieldMap["location"] = s.Location
s.fieldMap["agent"] = s.Agent
s.fieldMap["created_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["version"] = s.Version
s.fieldMap["deleted_at"] = s.DeletedAt
}
func (s scaCommentReply) clone(db *gorm.DB) scaCommentReply {
s.scaCommentReplyDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaCommentReply) replaceDB(db *gorm.DB) scaCommentReply {
s.scaCommentReplyDo.ReplaceDB(db)
return s
}
type scaCommentReplyDo struct{ gen.DO }
type IScaCommentReplyDo interface {
gen.SubQuery
Debug() IScaCommentReplyDo
WithContext(ctx context.Context) IScaCommentReplyDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaCommentReplyDo
WriteDB() IScaCommentReplyDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaCommentReplyDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaCommentReplyDo
Not(conds ...gen.Condition) IScaCommentReplyDo
Or(conds ...gen.Condition) IScaCommentReplyDo
Select(conds ...field.Expr) IScaCommentReplyDo
Where(conds ...gen.Condition) IScaCommentReplyDo
Order(conds ...field.Expr) IScaCommentReplyDo
Distinct(cols ...field.Expr) IScaCommentReplyDo
Omit(cols ...field.Expr) IScaCommentReplyDo
Join(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
Group(cols ...field.Expr) IScaCommentReplyDo
Having(conds ...gen.Condition) IScaCommentReplyDo
Limit(limit int) IScaCommentReplyDo
Offset(offset int) IScaCommentReplyDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentReplyDo
Unscoped() IScaCommentReplyDo
Create(values ...*model.ScaCommentReply) error
CreateInBatches(values []*model.ScaCommentReply, batchSize int) error
Save(values ...*model.ScaCommentReply) error
First() (*model.ScaCommentReply, error)
Take() (*model.ScaCommentReply, error)
Last() (*model.ScaCommentReply, error)
Find() ([]*model.ScaCommentReply, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentReply, err error)
FindInBatches(result *[]*model.ScaCommentReply, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaCommentReply) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IScaCommentReplyDo
Assign(attrs ...field.AssignExpr) IScaCommentReplyDo
Joins(fields ...field.RelationField) IScaCommentReplyDo
Preload(fields ...field.RelationField) IScaCommentReplyDo
FirstOrInit() (*model.ScaCommentReply, error)
FirstOrCreate() (*model.ScaCommentReply, error)
FindByPage(offset int, limit int) (result []*model.ScaCommentReply, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IScaCommentReplyDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaCommentReplyDo) Debug() IScaCommentReplyDo {
return s.withDO(s.DO.Debug())
}
func (s scaCommentReplyDo) WithContext(ctx context.Context) IScaCommentReplyDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaCommentReplyDo) ReadDB() IScaCommentReplyDo {
return s.Clauses(dbresolver.Read)
}
func (s scaCommentReplyDo) WriteDB() IScaCommentReplyDo {
return s.Clauses(dbresolver.Write)
}
func (s scaCommentReplyDo) Session(config *gorm.Session) IScaCommentReplyDo {
return s.withDO(s.DO.Session(config))
}
func (s scaCommentReplyDo) Clauses(conds ...clause.Expression) IScaCommentReplyDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaCommentReplyDo) Returning(value interface{}, columns ...string) IScaCommentReplyDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaCommentReplyDo) Not(conds ...gen.Condition) IScaCommentReplyDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaCommentReplyDo) Or(conds ...gen.Condition) IScaCommentReplyDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaCommentReplyDo) Select(conds ...field.Expr) IScaCommentReplyDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaCommentReplyDo) Where(conds ...gen.Condition) IScaCommentReplyDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaCommentReplyDo) Order(conds ...field.Expr) IScaCommentReplyDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaCommentReplyDo) Distinct(cols ...field.Expr) IScaCommentReplyDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaCommentReplyDo) Omit(cols ...field.Expr) IScaCommentReplyDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaCommentReplyDo) Join(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaCommentReplyDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaCommentReplyDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaCommentReplyDo) Group(cols ...field.Expr) IScaCommentReplyDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaCommentReplyDo) Having(conds ...gen.Condition) IScaCommentReplyDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaCommentReplyDo) Limit(limit int) IScaCommentReplyDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaCommentReplyDo) Offset(offset int) IScaCommentReplyDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaCommentReplyDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentReplyDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaCommentReplyDo) Unscoped() IScaCommentReplyDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaCommentReplyDo) Create(values ...*model.ScaCommentReply) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaCommentReplyDo) CreateInBatches(values []*model.ScaCommentReply, batchSize int) error {
return s.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (s scaCommentReplyDo) Save(values ...*model.ScaCommentReply) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaCommentReplyDo) First() (*model.ScaCommentReply, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentReply), nil
}
}
func (s scaCommentReplyDo) Take() (*model.ScaCommentReply, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentReply), nil
}
}
func (s scaCommentReplyDo) Last() (*model.ScaCommentReply, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentReply), nil
}
}
func (s scaCommentReplyDo) Find() ([]*model.ScaCommentReply, error) {
result, err := s.DO.Find()
return result.([]*model.ScaCommentReply), err
}
func (s scaCommentReplyDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentReply, err error) {
buf := make([]*model.ScaCommentReply, 0, batchSize)
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (s scaCommentReplyDo) FindInBatches(result *[]*model.ScaCommentReply, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaCommentReplyDo) Attrs(attrs ...field.AssignExpr) IScaCommentReplyDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaCommentReplyDo) Assign(attrs ...field.AssignExpr) IScaCommentReplyDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaCommentReplyDo) Joins(fields ...field.RelationField) IScaCommentReplyDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaCommentReplyDo) Preload(fields ...field.RelationField) IScaCommentReplyDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaCommentReplyDo) FirstOrInit() (*model.ScaCommentReply, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentReply), nil
}
}
func (s scaCommentReplyDo) FirstOrCreate() (*model.ScaCommentReply, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaCommentReply), nil
}
}
func (s scaCommentReplyDo) FindByPage(offset int, limit int) (result []*model.ScaCommentReply, count int64, err error) {
result, err = s.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = s.Offset(-1).Limit(-1).Count()
return
}
func (s scaCommentReplyDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s scaCommentReplyDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaCommentReplyDo) Delete(models ...*model.ScaCommentReply) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaCommentReplyDo) withDO(do gen.Dao) *scaCommentReplyDo {
s.DO = *do.(*gen.DO)
return s
}

View File

@@ -0,0 +1,410 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
)
func newScaFileFolder(db *gorm.DB, opts ...gen.DOOption) scaFileFolder {
_scaFileFolder := scaFileFolder{}
_scaFileFolder.scaFileFolderDo.UseDB(db, opts...)
_scaFileFolder.scaFileFolderDo.UseModel(&model.ScaFileFolder{})
tableName := _scaFileFolder.scaFileFolderDo.TableName()
_scaFileFolder.ALL = field.NewAsterisk(tableName)
_scaFileFolder.ID = field.NewInt64(tableName, "id")
_scaFileFolder.FolderName = field.NewString(tableName, "folder_name")
_scaFileFolder.ParentFolderID = field.NewInt64(tableName, "parent_folder_id")
_scaFileFolder.FolderAddr = field.NewString(tableName, "folder_addr")
_scaFileFolder.UserID = field.NewString(tableName, "user_id")
_scaFileFolder.FolderSource = field.NewInt64(tableName, "folder_source")
_scaFileFolder.CreatedAt = field.NewTime(tableName, "created_at")
_scaFileFolder.UpdatedAt = field.NewTime(tableName, "updated_at")
_scaFileFolder.DeletedAt = field.NewField(tableName, "deleted_at")
_scaFileFolder.fillFieldMap()
return _scaFileFolder
}
type scaFileFolder struct {
scaFileFolderDo
ALL field.Asterisk
ID field.Int64 // 主键
FolderName field.String // 文件夹名称
ParentFolderID field.Int64 // 父文件夹编号
FolderAddr field.String // 文件夹名称
UserID field.String // 用户编号
FolderSource field.Int64 // 文件夹来源 0相册 1 评论
CreatedAt field.Time // 创建时间
UpdatedAt field.Time // 更新时间
DeletedAt field.Field // 删除时间
fieldMap map[string]field.Expr
}
func (s scaFileFolder) Table(newTableName string) *scaFileFolder {
s.scaFileFolderDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaFileFolder) As(alias string) *scaFileFolder {
s.scaFileFolderDo.DO = *(s.scaFileFolderDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaFileFolder) updateTableName(table string) *scaFileFolder {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.FolderName = field.NewString(table, "folder_name")
s.ParentFolderID = field.NewInt64(table, "parent_folder_id")
s.FolderAddr = field.NewString(table, "folder_addr")
s.UserID = field.NewString(table, "user_id")
s.FolderSource = field.NewInt64(table, "folder_source")
s.CreatedAt = field.NewTime(table, "created_at")
s.UpdatedAt = field.NewTime(table, "updated_at")
s.DeletedAt = field.NewField(table, "deleted_at")
s.fillFieldMap()
return s
}
func (s *scaFileFolder) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *scaFileFolder) fillFieldMap() {
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_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["deleted_at"] = s.DeletedAt
}
func (s scaFileFolder) clone(db *gorm.DB) scaFileFolder {
s.scaFileFolderDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaFileFolder) replaceDB(db *gorm.DB) scaFileFolder {
s.scaFileFolderDo.ReplaceDB(db)
return s
}
type scaFileFolderDo struct{ gen.DO }
type IScaFileFolderDo interface {
gen.SubQuery
Debug() IScaFileFolderDo
WithContext(ctx context.Context) IScaFileFolderDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaFileFolderDo
WriteDB() IScaFileFolderDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaFileFolderDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaFileFolderDo
Not(conds ...gen.Condition) IScaFileFolderDo
Or(conds ...gen.Condition) IScaFileFolderDo
Select(conds ...field.Expr) IScaFileFolderDo
Where(conds ...gen.Condition) IScaFileFolderDo
Order(conds ...field.Expr) IScaFileFolderDo
Distinct(cols ...field.Expr) IScaFileFolderDo
Omit(cols ...field.Expr) IScaFileFolderDo
Join(table schema.Tabler, on ...field.Expr) IScaFileFolderDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileFolderDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaFileFolderDo
Group(cols ...field.Expr) IScaFileFolderDo
Having(conds ...gen.Condition) IScaFileFolderDo
Limit(limit int) IScaFileFolderDo
Offset(offset int) IScaFileFolderDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileFolderDo
Unscoped() IScaFileFolderDo
Create(values ...*model.ScaFileFolder) error
CreateInBatches(values []*model.ScaFileFolder, batchSize int) error
Save(values ...*model.ScaFileFolder) error
First() (*model.ScaFileFolder, error)
Take() (*model.ScaFileFolder, error)
Last() (*model.ScaFileFolder, error)
Find() ([]*model.ScaFileFolder, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileFolder, err error)
FindInBatches(result *[]*model.ScaFileFolder, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaFileFolder) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IScaFileFolderDo
Assign(attrs ...field.AssignExpr) IScaFileFolderDo
Joins(fields ...field.RelationField) IScaFileFolderDo
Preload(fields ...field.RelationField) IScaFileFolderDo
FirstOrInit() (*model.ScaFileFolder, error)
FirstOrCreate() (*model.ScaFileFolder, error)
FindByPage(offset int, limit int) (result []*model.ScaFileFolder, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IScaFileFolderDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaFileFolderDo) Debug() IScaFileFolderDo {
return s.withDO(s.DO.Debug())
}
func (s scaFileFolderDo) WithContext(ctx context.Context) IScaFileFolderDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaFileFolderDo) ReadDB() IScaFileFolderDo {
return s.Clauses(dbresolver.Read)
}
func (s scaFileFolderDo) WriteDB() IScaFileFolderDo {
return s.Clauses(dbresolver.Write)
}
func (s scaFileFolderDo) Session(config *gorm.Session) IScaFileFolderDo {
return s.withDO(s.DO.Session(config))
}
func (s scaFileFolderDo) Clauses(conds ...clause.Expression) IScaFileFolderDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaFileFolderDo) Returning(value interface{}, columns ...string) IScaFileFolderDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaFileFolderDo) Not(conds ...gen.Condition) IScaFileFolderDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaFileFolderDo) Or(conds ...gen.Condition) IScaFileFolderDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaFileFolderDo) Select(conds ...field.Expr) IScaFileFolderDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaFileFolderDo) Where(conds ...gen.Condition) IScaFileFolderDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaFileFolderDo) Order(conds ...field.Expr) IScaFileFolderDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaFileFolderDo) Distinct(cols ...field.Expr) IScaFileFolderDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaFileFolderDo) Omit(cols ...field.Expr) IScaFileFolderDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaFileFolderDo) Join(table schema.Tabler, on ...field.Expr) IScaFileFolderDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaFileFolderDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileFolderDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaFileFolderDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaFileFolderDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaFileFolderDo) Group(cols ...field.Expr) IScaFileFolderDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaFileFolderDo) Having(conds ...gen.Condition) IScaFileFolderDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaFileFolderDo) Limit(limit int) IScaFileFolderDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaFileFolderDo) Offset(offset int) IScaFileFolderDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaFileFolderDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileFolderDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaFileFolderDo) Unscoped() IScaFileFolderDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaFileFolderDo) Create(values ...*model.ScaFileFolder) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaFileFolderDo) CreateInBatches(values []*model.ScaFileFolder, batchSize int) error {
return s.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (s scaFileFolderDo) Save(values ...*model.ScaFileFolder) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaFileFolderDo) First() (*model.ScaFileFolder, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileFolder), nil
}
}
func (s scaFileFolderDo) Take() (*model.ScaFileFolder, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileFolder), nil
}
}
func (s scaFileFolderDo) Last() (*model.ScaFileFolder, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileFolder), nil
}
}
func (s scaFileFolderDo) Find() ([]*model.ScaFileFolder, error) {
result, err := s.DO.Find()
return result.([]*model.ScaFileFolder), err
}
func (s scaFileFolderDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileFolder, err error) {
buf := make([]*model.ScaFileFolder, 0, batchSize)
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (s scaFileFolderDo) FindInBatches(result *[]*model.ScaFileFolder, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaFileFolderDo) Attrs(attrs ...field.AssignExpr) IScaFileFolderDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaFileFolderDo) Assign(attrs ...field.AssignExpr) IScaFileFolderDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaFileFolderDo) Joins(fields ...field.RelationField) IScaFileFolderDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaFileFolderDo) Preload(fields ...field.RelationField) IScaFileFolderDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaFileFolderDo) FirstOrInit() (*model.ScaFileFolder, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileFolder), nil
}
}
func (s scaFileFolderDo) FirstOrCreate() (*model.ScaFileFolder, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileFolder), nil
}
}
func (s scaFileFolderDo) FindByPage(offset int, limit int) (result []*model.ScaFileFolder, count int64, err error) {
result, err = s.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = s.Offset(-1).Limit(-1).Count()
return
}
func (s scaFileFolderDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s scaFileFolderDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaFileFolderDo) Delete(models ...*model.ScaFileFolder) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaFileFolderDo) withDO(do gen.Dao) *scaFileFolderDo {
s.DO = *do.(*gen.DO)
return s
}

View File

@@ -0,0 +1,422 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
)
func newScaFileInfo(db *gorm.DB, opts ...gen.DOOption) scaFileInfo {
_scaFileInfo := scaFileInfo{}
_scaFileInfo.scaFileInfoDo.UseDB(db, opts...)
_scaFileInfo.scaFileInfoDo.UseModel(&model.ScaFileInfo{})
tableName := _scaFileInfo.scaFileInfoDo.TableName()
_scaFileInfo.ALL = field.NewAsterisk(tableName)
_scaFileInfo.ID = field.NewInt64(tableName, "id")
_scaFileInfo.FileName = field.NewString(tableName, "file_name")
_scaFileInfo.FileSize = field.NewFloat64(tableName, "file_size")
_scaFileInfo.FileTypeID = field.NewInt64(tableName, "file_type_id")
_scaFileInfo.UploadTime = field.NewTime(tableName, "upload_time")
_scaFileInfo.FolderID = field.NewInt64(tableName, "folder_id")
_scaFileInfo.UserID = field.NewString(tableName, "user_id")
_scaFileInfo.FileSource = field.NewInt64(tableName, "file_source")
_scaFileInfo.Status = field.NewInt64(tableName, "status")
_scaFileInfo.CreatedAt = field.NewTime(tableName, "created_at")
_scaFileInfo.UpdatedAt = field.NewTime(tableName, "updated_at")
_scaFileInfo.DeletedAt = field.NewField(tableName, "deleted_at")
_scaFileInfo.fillFieldMap()
return _scaFileInfo
}
type scaFileInfo struct {
scaFileInfoDo
ALL field.Asterisk
ID field.Int64 // 主键
FileName field.String // 文件名
FileSize field.Float64 // 文件大小
FileTypeID field.Int64 // 文件类型编号
UploadTime field.Time // 上传时间
FolderID field.Int64 // 文件夹编号
UserID field.String // 用户编号
FileSource field.Int64 // 文件来源 0 相册 1 评论
Status field.Int64 // 文件状态
CreatedAt field.Time // 创建时间
UpdatedAt field.Time // 更新时间
DeletedAt field.Field // 删除时间
fieldMap map[string]field.Expr
}
func (s scaFileInfo) Table(newTableName string) *scaFileInfo {
s.scaFileInfoDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaFileInfo) As(alias string) *scaFileInfo {
s.scaFileInfoDo.DO = *(s.scaFileInfoDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaFileInfo) updateTableName(table string) *scaFileInfo {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.FileName = field.NewString(table, "file_name")
s.FileSize = field.NewFloat64(table, "file_size")
s.FileTypeID = field.NewInt64(table, "file_type_id")
s.UploadTime = field.NewTime(table, "upload_time")
s.FolderID = field.NewInt64(table, "folder_id")
s.UserID = field.NewString(table, "user_id")
s.FileSource = field.NewInt64(table, "file_source")
s.Status = field.NewInt64(table, "status")
s.CreatedAt = field.NewTime(table, "created_at")
s.UpdatedAt = field.NewTime(table, "updated_at")
s.DeletedAt = field.NewField(table, "deleted_at")
s.fillFieldMap()
return s
}
func (s *scaFileInfo) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *scaFileInfo) fillFieldMap() {
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
s.fieldMap["file_type_id"] = s.FileTypeID
s.fieldMap["upload_time"] = s.UploadTime
s.fieldMap["folder_id"] = s.FolderID
s.fieldMap["user_id"] = s.UserID
s.fieldMap["file_source"] = s.FileSource
s.fieldMap["status"] = s.Status
s.fieldMap["created_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["deleted_at"] = s.DeletedAt
}
func (s scaFileInfo) clone(db *gorm.DB) scaFileInfo {
s.scaFileInfoDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaFileInfo) replaceDB(db *gorm.DB) scaFileInfo {
s.scaFileInfoDo.ReplaceDB(db)
return s
}
type scaFileInfoDo struct{ gen.DO }
type IScaFileInfoDo interface {
gen.SubQuery
Debug() IScaFileInfoDo
WithContext(ctx context.Context) IScaFileInfoDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaFileInfoDo
WriteDB() IScaFileInfoDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaFileInfoDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaFileInfoDo
Not(conds ...gen.Condition) IScaFileInfoDo
Or(conds ...gen.Condition) IScaFileInfoDo
Select(conds ...field.Expr) IScaFileInfoDo
Where(conds ...gen.Condition) IScaFileInfoDo
Order(conds ...field.Expr) IScaFileInfoDo
Distinct(cols ...field.Expr) IScaFileInfoDo
Omit(cols ...field.Expr) IScaFileInfoDo
Join(table schema.Tabler, on ...field.Expr) IScaFileInfoDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileInfoDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaFileInfoDo
Group(cols ...field.Expr) IScaFileInfoDo
Having(conds ...gen.Condition) IScaFileInfoDo
Limit(limit int) IScaFileInfoDo
Offset(offset int) IScaFileInfoDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileInfoDo
Unscoped() IScaFileInfoDo
Create(values ...*model.ScaFileInfo) error
CreateInBatches(values []*model.ScaFileInfo, batchSize int) error
Save(values ...*model.ScaFileInfo) error
First() (*model.ScaFileInfo, error)
Take() (*model.ScaFileInfo, error)
Last() (*model.ScaFileInfo, error)
Find() ([]*model.ScaFileInfo, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileInfo, err error)
FindInBatches(result *[]*model.ScaFileInfo, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaFileInfo) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IScaFileInfoDo
Assign(attrs ...field.AssignExpr) IScaFileInfoDo
Joins(fields ...field.RelationField) IScaFileInfoDo
Preload(fields ...field.RelationField) IScaFileInfoDo
FirstOrInit() (*model.ScaFileInfo, error)
FirstOrCreate() (*model.ScaFileInfo, error)
FindByPage(offset int, limit int) (result []*model.ScaFileInfo, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IScaFileInfoDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaFileInfoDo) Debug() IScaFileInfoDo {
return s.withDO(s.DO.Debug())
}
func (s scaFileInfoDo) WithContext(ctx context.Context) IScaFileInfoDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaFileInfoDo) ReadDB() IScaFileInfoDo {
return s.Clauses(dbresolver.Read)
}
func (s scaFileInfoDo) WriteDB() IScaFileInfoDo {
return s.Clauses(dbresolver.Write)
}
func (s scaFileInfoDo) Session(config *gorm.Session) IScaFileInfoDo {
return s.withDO(s.DO.Session(config))
}
func (s scaFileInfoDo) Clauses(conds ...clause.Expression) IScaFileInfoDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaFileInfoDo) Returning(value interface{}, columns ...string) IScaFileInfoDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaFileInfoDo) Not(conds ...gen.Condition) IScaFileInfoDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaFileInfoDo) Or(conds ...gen.Condition) IScaFileInfoDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaFileInfoDo) Select(conds ...field.Expr) IScaFileInfoDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaFileInfoDo) Where(conds ...gen.Condition) IScaFileInfoDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaFileInfoDo) Order(conds ...field.Expr) IScaFileInfoDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaFileInfoDo) Distinct(cols ...field.Expr) IScaFileInfoDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaFileInfoDo) Omit(cols ...field.Expr) IScaFileInfoDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaFileInfoDo) Join(table schema.Tabler, on ...field.Expr) IScaFileInfoDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaFileInfoDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileInfoDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaFileInfoDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaFileInfoDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaFileInfoDo) Group(cols ...field.Expr) IScaFileInfoDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaFileInfoDo) Having(conds ...gen.Condition) IScaFileInfoDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaFileInfoDo) Limit(limit int) IScaFileInfoDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaFileInfoDo) Offset(offset int) IScaFileInfoDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaFileInfoDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileInfoDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaFileInfoDo) Unscoped() IScaFileInfoDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaFileInfoDo) Create(values ...*model.ScaFileInfo) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaFileInfoDo) CreateInBatches(values []*model.ScaFileInfo, batchSize int) error {
return s.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (s scaFileInfoDo) Save(values ...*model.ScaFileInfo) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaFileInfoDo) First() (*model.ScaFileInfo, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileInfo), nil
}
}
func (s scaFileInfoDo) Take() (*model.ScaFileInfo, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileInfo), nil
}
}
func (s scaFileInfoDo) Last() (*model.ScaFileInfo, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileInfo), nil
}
}
func (s scaFileInfoDo) Find() ([]*model.ScaFileInfo, error) {
result, err := s.DO.Find()
return result.([]*model.ScaFileInfo), err
}
func (s scaFileInfoDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileInfo, err error) {
buf := make([]*model.ScaFileInfo, 0, batchSize)
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (s scaFileInfoDo) FindInBatches(result *[]*model.ScaFileInfo, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaFileInfoDo) Attrs(attrs ...field.AssignExpr) IScaFileInfoDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaFileInfoDo) Assign(attrs ...field.AssignExpr) IScaFileInfoDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaFileInfoDo) Joins(fields ...field.RelationField) IScaFileInfoDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaFileInfoDo) Preload(fields ...field.RelationField) IScaFileInfoDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaFileInfoDo) FirstOrInit() (*model.ScaFileInfo, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileInfo), nil
}
}
func (s scaFileInfoDo) FirstOrCreate() (*model.ScaFileInfo, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileInfo), nil
}
}
func (s scaFileInfoDo) FindByPage(offset int, limit int) (result []*model.ScaFileInfo, count int64, err error) {
result, err = s.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = s.Offset(-1).Limit(-1).Count()
return
}
func (s scaFileInfoDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s scaFileInfoDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaFileInfoDo) Delete(models ...*model.ScaFileInfo) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaFileInfoDo) withDO(do gen.Dao) *scaFileInfoDo {
s.DO = *do.(*gen.DO)
return s
}

View File

@@ -0,0 +1,406 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
)
func newScaFileRecycle(db *gorm.DB, opts ...gen.DOOption) scaFileRecycle {
_scaFileRecycle := scaFileRecycle{}
_scaFileRecycle.scaFileRecycleDo.UseDB(db, opts...)
_scaFileRecycle.scaFileRecycleDo.UseModel(&model.ScaFileRecycle{})
tableName := _scaFileRecycle.scaFileRecycleDo.TableName()
_scaFileRecycle.ALL = field.NewAsterisk(tableName)
_scaFileRecycle.ID = field.NewInt64(tableName, "id")
_scaFileRecycle.FileID = field.NewInt64(tableName, "file_id")
_scaFileRecycle.FolderID = field.NewInt64(tableName, "folder_id")
_scaFileRecycle.Type = field.NewInt64(tableName, "type")
_scaFileRecycle.UserID = field.NewString(tableName, "user_id")
_scaFileRecycle.DeletedAt = field.NewField(tableName, "deleted_at")
_scaFileRecycle.OriginalPath = field.NewString(tableName, "original_path")
_scaFileRecycle.FileSource = field.NewInt64(tableName, "file_source")
_scaFileRecycle.fillFieldMap()
return _scaFileRecycle
}
type scaFileRecycle struct {
scaFileRecycleDo
ALL field.Asterisk
ID field.Int64 // 主键
FileID field.Int64 // 文件编号
FolderID field.Int64 // 文件夹编号
Type field.Int64 // 类型 0 文件 1 文件夹
UserID field.String // 用户编号
DeletedAt field.Field // 删除时间
OriginalPath field.String // 原始路径
FileSource field.Int64 // 文件来源 0 相册 1 评论
fieldMap map[string]field.Expr
}
func (s scaFileRecycle) Table(newTableName string) *scaFileRecycle {
s.scaFileRecycleDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaFileRecycle) As(alias string) *scaFileRecycle {
s.scaFileRecycleDo.DO = *(s.scaFileRecycleDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaFileRecycle) updateTableName(table string) *scaFileRecycle {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.FileID = field.NewInt64(table, "file_id")
s.FolderID = field.NewInt64(table, "folder_id")
s.Type = field.NewInt64(table, "type")
s.UserID = field.NewString(table, "user_id")
s.DeletedAt = field.NewField(table, "deleted_at")
s.OriginalPath = field.NewString(table, "original_path")
s.FileSource = field.NewInt64(table, "file_source")
s.fillFieldMap()
return s
}
func (s *scaFileRecycle) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *scaFileRecycle) fillFieldMap() {
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
s.fieldMap["type"] = s.Type
s.fieldMap["user_id"] = s.UserID
s.fieldMap["deleted_at"] = s.DeletedAt
s.fieldMap["original_path"] = s.OriginalPath
s.fieldMap["file_source"] = s.FileSource
}
func (s scaFileRecycle) clone(db *gorm.DB) scaFileRecycle {
s.scaFileRecycleDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaFileRecycle) replaceDB(db *gorm.DB) scaFileRecycle {
s.scaFileRecycleDo.ReplaceDB(db)
return s
}
type scaFileRecycleDo struct{ gen.DO }
type IScaFileRecycleDo interface {
gen.SubQuery
Debug() IScaFileRecycleDo
WithContext(ctx context.Context) IScaFileRecycleDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaFileRecycleDo
WriteDB() IScaFileRecycleDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaFileRecycleDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaFileRecycleDo
Not(conds ...gen.Condition) IScaFileRecycleDo
Or(conds ...gen.Condition) IScaFileRecycleDo
Select(conds ...field.Expr) IScaFileRecycleDo
Where(conds ...gen.Condition) IScaFileRecycleDo
Order(conds ...field.Expr) IScaFileRecycleDo
Distinct(cols ...field.Expr) IScaFileRecycleDo
Omit(cols ...field.Expr) IScaFileRecycleDo
Join(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo
Group(cols ...field.Expr) IScaFileRecycleDo
Having(conds ...gen.Condition) IScaFileRecycleDo
Limit(limit int) IScaFileRecycleDo
Offset(offset int) IScaFileRecycleDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileRecycleDo
Unscoped() IScaFileRecycleDo
Create(values ...*model.ScaFileRecycle) error
CreateInBatches(values []*model.ScaFileRecycle, batchSize int) error
Save(values ...*model.ScaFileRecycle) error
First() (*model.ScaFileRecycle, error)
Take() (*model.ScaFileRecycle, error)
Last() (*model.ScaFileRecycle, error)
Find() ([]*model.ScaFileRecycle, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileRecycle, err error)
FindInBatches(result *[]*model.ScaFileRecycle, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaFileRecycle) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IScaFileRecycleDo
Assign(attrs ...field.AssignExpr) IScaFileRecycleDo
Joins(fields ...field.RelationField) IScaFileRecycleDo
Preload(fields ...field.RelationField) IScaFileRecycleDo
FirstOrInit() (*model.ScaFileRecycle, error)
FirstOrCreate() (*model.ScaFileRecycle, error)
FindByPage(offset int, limit int) (result []*model.ScaFileRecycle, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IScaFileRecycleDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaFileRecycleDo) Debug() IScaFileRecycleDo {
return s.withDO(s.DO.Debug())
}
func (s scaFileRecycleDo) WithContext(ctx context.Context) IScaFileRecycleDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaFileRecycleDo) ReadDB() IScaFileRecycleDo {
return s.Clauses(dbresolver.Read)
}
func (s scaFileRecycleDo) WriteDB() IScaFileRecycleDo {
return s.Clauses(dbresolver.Write)
}
func (s scaFileRecycleDo) Session(config *gorm.Session) IScaFileRecycleDo {
return s.withDO(s.DO.Session(config))
}
func (s scaFileRecycleDo) Clauses(conds ...clause.Expression) IScaFileRecycleDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaFileRecycleDo) Returning(value interface{}, columns ...string) IScaFileRecycleDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaFileRecycleDo) Not(conds ...gen.Condition) IScaFileRecycleDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaFileRecycleDo) Or(conds ...gen.Condition) IScaFileRecycleDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaFileRecycleDo) Select(conds ...field.Expr) IScaFileRecycleDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaFileRecycleDo) Where(conds ...gen.Condition) IScaFileRecycleDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaFileRecycleDo) Order(conds ...field.Expr) IScaFileRecycleDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaFileRecycleDo) Distinct(cols ...field.Expr) IScaFileRecycleDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaFileRecycleDo) Omit(cols ...field.Expr) IScaFileRecycleDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaFileRecycleDo) Join(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaFileRecycleDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaFileRecycleDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaFileRecycleDo) Group(cols ...field.Expr) IScaFileRecycleDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaFileRecycleDo) Having(conds ...gen.Condition) IScaFileRecycleDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaFileRecycleDo) Limit(limit int) IScaFileRecycleDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaFileRecycleDo) Offset(offset int) IScaFileRecycleDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaFileRecycleDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileRecycleDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaFileRecycleDo) Unscoped() IScaFileRecycleDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaFileRecycleDo) Create(values ...*model.ScaFileRecycle) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaFileRecycleDo) CreateInBatches(values []*model.ScaFileRecycle, batchSize int) error {
return s.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (s scaFileRecycleDo) Save(values ...*model.ScaFileRecycle) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaFileRecycleDo) First() (*model.ScaFileRecycle, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileRecycle), nil
}
}
func (s scaFileRecycleDo) Take() (*model.ScaFileRecycle, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileRecycle), nil
}
}
func (s scaFileRecycleDo) Last() (*model.ScaFileRecycle, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileRecycle), nil
}
}
func (s scaFileRecycleDo) Find() ([]*model.ScaFileRecycle, error) {
result, err := s.DO.Find()
return result.([]*model.ScaFileRecycle), err
}
func (s scaFileRecycleDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileRecycle, err error) {
buf := make([]*model.ScaFileRecycle, 0, batchSize)
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (s scaFileRecycleDo) FindInBatches(result *[]*model.ScaFileRecycle, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaFileRecycleDo) Attrs(attrs ...field.AssignExpr) IScaFileRecycleDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaFileRecycleDo) Assign(attrs ...field.AssignExpr) IScaFileRecycleDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaFileRecycleDo) Joins(fields ...field.RelationField) IScaFileRecycleDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaFileRecycleDo) Preload(fields ...field.RelationField) IScaFileRecycleDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaFileRecycleDo) FirstOrInit() (*model.ScaFileRecycle, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileRecycle), nil
}
}
func (s scaFileRecycleDo) FirstOrCreate() (*model.ScaFileRecycle, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileRecycle), nil
}
}
func (s scaFileRecycleDo) FindByPage(offset int, limit int) (result []*model.ScaFileRecycle, count int64, err error) {
result, err = s.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = s.Offset(-1).Limit(-1).Count()
return
}
func (s scaFileRecycleDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s scaFileRecycleDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaFileRecycleDo) Delete(models ...*model.ScaFileRecycle) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaFileRecycleDo) withDO(do gen.Dao) *scaFileRecycleDo {
s.DO = *do.(*gen.DO)
return s
}

View File

@@ -0,0 +1,402 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
)
func newScaFileType(db *gorm.DB, opts ...gen.DOOption) scaFileType {
_scaFileType := scaFileType{}
_scaFileType.scaFileTypeDo.UseDB(db, opts...)
_scaFileType.scaFileTypeDo.UseModel(&model.ScaFileType{})
tableName := _scaFileType.scaFileTypeDo.TableName()
_scaFileType.ALL = field.NewAsterisk(tableName)
_scaFileType.ID = field.NewInt64(tableName, "id")
_scaFileType.TypeName = field.NewString(tableName, "type_name")
_scaFileType.MimeType = field.NewString(tableName, "mime_type")
_scaFileType.Status = field.NewInt64(tableName, "status")
_scaFileType.CreatedAt = field.NewTime(tableName, "created_at")
_scaFileType.UpdatedAt = field.NewTime(tableName, "updated_at")
_scaFileType.DeletedAt = field.NewField(tableName, "deleted_at")
_scaFileType.fillFieldMap()
return _scaFileType
}
type scaFileType struct {
scaFileTypeDo
ALL field.Asterisk
ID field.Int64 // 主键
TypeName field.String // 类型名称
MimeType field.String // MIME 类型
Status field.Int64 // 类型状态
CreatedAt field.Time // 创建时间
UpdatedAt field.Time // 更新时间
DeletedAt field.Field // 删除时间
fieldMap map[string]field.Expr
}
func (s scaFileType) Table(newTableName string) *scaFileType {
s.scaFileTypeDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaFileType) As(alias string) *scaFileType {
s.scaFileTypeDo.DO = *(s.scaFileTypeDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaFileType) updateTableName(table string) *scaFileType {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.TypeName = field.NewString(table, "type_name")
s.MimeType = field.NewString(table, "mime_type")
s.Status = field.NewInt64(table, "status")
s.CreatedAt = field.NewTime(table, "created_at")
s.UpdatedAt = field.NewTime(table, "updated_at")
s.DeletedAt = field.NewField(table, "deleted_at")
s.fillFieldMap()
return s
}
func (s *scaFileType) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *scaFileType) fillFieldMap() {
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_at"] = s.DeletedAt
}
func (s scaFileType) clone(db *gorm.DB) scaFileType {
s.scaFileTypeDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaFileType) replaceDB(db *gorm.DB) scaFileType {
s.scaFileTypeDo.ReplaceDB(db)
return s
}
type scaFileTypeDo struct{ gen.DO }
type IScaFileTypeDo interface {
gen.SubQuery
Debug() IScaFileTypeDo
WithContext(ctx context.Context) IScaFileTypeDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaFileTypeDo
WriteDB() IScaFileTypeDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaFileTypeDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaFileTypeDo
Not(conds ...gen.Condition) IScaFileTypeDo
Or(conds ...gen.Condition) IScaFileTypeDo
Select(conds ...field.Expr) IScaFileTypeDo
Where(conds ...gen.Condition) IScaFileTypeDo
Order(conds ...field.Expr) IScaFileTypeDo
Distinct(cols ...field.Expr) IScaFileTypeDo
Omit(cols ...field.Expr) IScaFileTypeDo
Join(table schema.Tabler, on ...field.Expr) IScaFileTypeDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileTypeDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaFileTypeDo
Group(cols ...field.Expr) IScaFileTypeDo
Having(conds ...gen.Condition) IScaFileTypeDo
Limit(limit int) IScaFileTypeDo
Offset(offset int) IScaFileTypeDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileTypeDo
Unscoped() IScaFileTypeDo
Create(values ...*model.ScaFileType) error
CreateInBatches(values []*model.ScaFileType, batchSize int) error
Save(values ...*model.ScaFileType) error
First() (*model.ScaFileType, error)
Take() (*model.ScaFileType, error)
Last() (*model.ScaFileType, error)
Find() ([]*model.ScaFileType, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileType, err error)
FindInBatches(result *[]*model.ScaFileType, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaFileType) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IScaFileTypeDo
Assign(attrs ...field.AssignExpr) IScaFileTypeDo
Joins(fields ...field.RelationField) IScaFileTypeDo
Preload(fields ...field.RelationField) IScaFileTypeDo
FirstOrInit() (*model.ScaFileType, error)
FirstOrCreate() (*model.ScaFileType, error)
FindByPage(offset int, limit int) (result []*model.ScaFileType, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IScaFileTypeDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaFileTypeDo) Debug() IScaFileTypeDo {
return s.withDO(s.DO.Debug())
}
func (s scaFileTypeDo) WithContext(ctx context.Context) IScaFileTypeDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaFileTypeDo) ReadDB() IScaFileTypeDo {
return s.Clauses(dbresolver.Read)
}
func (s scaFileTypeDo) WriteDB() IScaFileTypeDo {
return s.Clauses(dbresolver.Write)
}
func (s scaFileTypeDo) Session(config *gorm.Session) IScaFileTypeDo {
return s.withDO(s.DO.Session(config))
}
func (s scaFileTypeDo) Clauses(conds ...clause.Expression) IScaFileTypeDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaFileTypeDo) Returning(value interface{}, columns ...string) IScaFileTypeDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaFileTypeDo) Not(conds ...gen.Condition) IScaFileTypeDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaFileTypeDo) Or(conds ...gen.Condition) IScaFileTypeDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaFileTypeDo) Select(conds ...field.Expr) IScaFileTypeDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaFileTypeDo) Where(conds ...gen.Condition) IScaFileTypeDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaFileTypeDo) Order(conds ...field.Expr) IScaFileTypeDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaFileTypeDo) Distinct(cols ...field.Expr) IScaFileTypeDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaFileTypeDo) Omit(cols ...field.Expr) IScaFileTypeDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaFileTypeDo) Join(table schema.Tabler, on ...field.Expr) IScaFileTypeDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaFileTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileTypeDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaFileTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaFileTypeDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaFileTypeDo) Group(cols ...field.Expr) IScaFileTypeDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaFileTypeDo) Having(conds ...gen.Condition) IScaFileTypeDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaFileTypeDo) Limit(limit int) IScaFileTypeDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaFileTypeDo) Offset(offset int) IScaFileTypeDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaFileTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileTypeDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaFileTypeDo) Unscoped() IScaFileTypeDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaFileTypeDo) Create(values ...*model.ScaFileType) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaFileTypeDo) CreateInBatches(values []*model.ScaFileType, batchSize int) error {
return s.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (s scaFileTypeDo) Save(values ...*model.ScaFileType) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaFileTypeDo) First() (*model.ScaFileType, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileType), nil
}
}
func (s scaFileTypeDo) Take() (*model.ScaFileType, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileType), nil
}
}
func (s scaFileTypeDo) Last() (*model.ScaFileType, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileType), nil
}
}
func (s scaFileTypeDo) Find() ([]*model.ScaFileType, error) {
result, err := s.DO.Find()
return result.([]*model.ScaFileType), err
}
func (s scaFileTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileType, err error) {
buf := make([]*model.ScaFileType, 0, batchSize)
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (s scaFileTypeDo) FindInBatches(result *[]*model.ScaFileType, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaFileTypeDo) Attrs(attrs ...field.AssignExpr) IScaFileTypeDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaFileTypeDo) Assign(attrs ...field.AssignExpr) IScaFileTypeDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaFileTypeDo) Joins(fields ...field.RelationField) IScaFileTypeDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaFileTypeDo) Preload(fields ...field.RelationField) IScaFileTypeDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaFileTypeDo) FirstOrInit() (*model.ScaFileType, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileType), nil
}
}
func (s scaFileTypeDo) FirstOrCreate() (*model.ScaFileType, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaFileType), nil
}
}
func (s scaFileTypeDo) FindByPage(offset int, limit int) (result []*model.ScaFileType, count int64, err error) {
result, err = s.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = s.Offset(-1).Limit(-1).Count()
return
}
func (s scaFileTypeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s scaFileTypeDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaFileTypeDo) Delete(models ...*model.ScaFileType) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaFileTypeDo) withDO(do gen.Dao) *scaFileTypeDo {
s.DO = *do.(*gen.DO)
return s
}

View File

@@ -0,0 +1,422 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
)
func newScaMessageReport(db *gorm.DB, opts ...gen.DOOption) scaMessageReport {
_scaMessageReport := scaMessageReport{}
_scaMessageReport.scaMessageReportDo.UseDB(db, opts...)
_scaMessageReport.scaMessageReportDo.UseModel(&model.ScaMessageReport{})
tableName := _scaMessageReport.scaMessageReportDo.TableName()
_scaMessageReport.ALL = field.NewAsterisk(tableName)
_scaMessageReport.ID = field.NewInt64(tableName, "id")
_scaMessageReport.UserID = field.NewString(tableName, "user_id")
_scaMessageReport.Type = field.NewInt64(tableName, "type")
_scaMessageReport.CommentID = field.NewInt64(tableName, "comment_id")
_scaMessageReport.TopicID = field.NewString(tableName, "topic_id")
_scaMessageReport.ReportType = field.NewInt64(tableName, "report_type")
_scaMessageReport.ReportContent = field.NewString(tableName, "report_content")
_scaMessageReport.ReportTag = field.NewString(tableName, "report_tag")
_scaMessageReport.Status = field.NewInt64(tableName, "status")
_scaMessageReport.CreatedAt = field.NewTime(tableName, "created_at")
_scaMessageReport.UpdatedAt = field.NewTime(tableName, "updated_at")
_scaMessageReport.DeletedAt = field.NewField(tableName, "deleted_at")
_scaMessageReport.fillFieldMap()
return _scaMessageReport
}
type scaMessageReport struct {
scaMessageReportDo
ALL field.Asterisk
ID field.Int64 // 主键
UserID field.String // 用户Id
Type field.Int64 // 举报类型 0评论 1 相册
CommentID field.Int64 // 评论Id
TopicID field.String // 话题Id
ReportType field.Int64 // 举报
ReportContent field.String // 举报说明内容
ReportTag field.String // 举报标签
Status field.Int64 // 状态0 未处理 1 已处理)
CreatedAt field.Time // 创建时间
UpdatedAt field.Time // 更新时间
DeletedAt field.Field // 删除时间
fieldMap map[string]field.Expr
}
func (s scaMessageReport) Table(newTableName string) *scaMessageReport {
s.scaMessageReportDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaMessageReport) As(alias string) *scaMessageReport {
s.scaMessageReportDo.DO = *(s.scaMessageReportDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaMessageReport) updateTableName(table string) *scaMessageReport {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.UserID = field.NewString(table, "user_id")
s.Type = field.NewInt64(table, "type")
s.CommentID = field.NewInt64(table, "comment_id")
s.TopicID = field.NewString(table, "topic_id")
s.ReportType = field.NewInt64(table, "report_type")
s.ReportContent = field.NewString(table, "report_content")
s.ReportTag = field.NewString(table, "report_tag")
s.Status = field.NewInt64(table, "status")
s.CreatedAt = field.NewTime(table, "created_at")
s.UpdatedAt = field.NewTime(table, "updated_at")
s.DeletedAt = field.NewField(table, "deleted_at")
s.fillFieldMap()
return s
}
func (s *scaMessageReport) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *scaMessageReport) fillFieldMap() {
s.fieldMap = make(map[string]field.Expr, 12)
s.fieldMap["id"] = s.ID
s.fieldMap["user_id"] = s.UserID
s.fieldMap["type"] = s.Type
s.fieldMap["comment_id"] = s.CommentID
s.fieldMap["topic_id"] = s.TopicID
s.fieldMap["report_type"] = s.ReportType
s.fieldMap["report_content"] = s.ReportContent
s.fieldMap["report_tag"] = s.ReportTag
s.fieldMap["status"] = s.Status
s.fieldMap["created_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["deleted_at"] = s.DeletedAt
}
func (s scaMessageReport) clone(db *gorm.DB) scaMessageReport {
s.scaMessageReportDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaMessageReport) replaceDB(db *gorm.DB) scaMessageReport {
s.scaMessageReportDo.ReplaceDB(db)
return s
}
type scaMessageReportDo struct{ gen.DO }
type IScaMessageReportDo interface {
gen.SubQuery
Debug() IScaMessageReportDo
WithContext(ctx context.Context) IScaMessageReportDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaMessageReportDo
WriteDB() IScaMessageReportDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaMessageReportDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaMessageReportDo
Not(conds ...gen.Condition) IScaMessageReportDo
Or(conds ...gen.Condition) IScaMessageReportDo
Select(conds ...field.Expr) IScaMessageReportDo
Where(conds ...gen.Condition) IScaMessageReportDo
Order(conds ...field.Expr) IScaMessageReportDo
Distinct(cols ...field.Expr) IScaMessageReportDo
Omit(cols ...field.Expr) IScaMessageReportDo
Join(table schema.Tabler, on ...field.Expr) IScaMessageReportDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaMessageReportDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaMessageReportDo
Group(cols ...field.Expr) IScaMessageReportDo
Having(conds ...gen.Condition) IScaMessageReportDo
Limit(limit int) IScaMessageReportDo
Offset(offset int) IScaMessageReportDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaMessageReportDo
Unscoped() IScaMessageReportDo
Create(values ...*model.ScaMessageReport) error
CreateInBatches(values []*model.ScaMessageReport, batchSize int) error
Save(values ...*model.ScaMessageReport) error
First() (*model.ScaMessageReport, error)
Take() (*model.ScaMessageReport, error)
Last() (*model.ScaMessageReport, error)
Find() ([]*model.ScaMessageReport, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaMessageReport, err error)
FindInBatches(result *[]*model.ScaMessageReport, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaMessageReport) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IScaMessageReportDo
Assign(attrs ...field.AssignExpr) IScaMessageReportDo
Joins(fields ...field.RelationField) IScaMessageReportDo
Preload(fields ...field.RelationField) IScaMessageReportDo
FirstOrInit() (*model.ScaMessageReport, error)
FirstOrCreate() (*model.ScaMessageReport, error)
FindByPage(offset int, limit int) (result []*model.ScaMessageReport, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IScaMessageReportDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaMessageReportDo) Debug() IScaMessageReportDo {
return s.withDO(s.DO.Debug())
}
func (s scaMessageReportDo) WithContext(ctx context.Context) IScaMessageReportDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaMessageReportDo) ReadDB() IScaMessageReportDo {
return s.Clauses(dbresolver.Read)
}
func (s scaMessageReportDo) WriteDB() IScaMessageReportDo {
return s.Clauses(dbresolver.Write)
}
func (s scaMessageReportDo) Session(config *gorm.Session) IScaMessageReportDo {
return s.withDO(s.DO.Session(config))
}
func (s scaMessageReportDo) Clauses(conds ...clause.Expression) IScaMessageReportDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaMessageReportDo) Returning(value interface{}, columns ...string) IScaMessageReportDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaMessageReportDo) Not(conds ...gen.Condition) IScaMessageReportDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaMessageReportDo) Or(conds ...gen.Condition) IScaMessageReportDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaMessageReportDo) Select(conds ...field.Expr) IScaMessageReportDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaMessageReportDo) Where(conds ...gen.Condition) IScaMessageReportDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaMessageReportDo) Order(conds ...field.Expr) IScaMessageReportDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaMessageReportDo) Distinct(cols ...field.Expr) IScaMessageReportDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaMessageReportDo) Omit(cols ...field.Expr) IScaMessageReportDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaMessageReportDo) Join(table schema.Tabler, on ...field.Expr) IScaMessageReportDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaMessageReportDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaMessageReportDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaMessageReportDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaMessageReportDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaMessageReportDo) Group(cols ...field.Expr) IScaMessageReportDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaMessageReportDo) Having(conds ...gen.Condition) IScaMessageReportDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaMessageReportDo) Limit(limit int) IScaMessageReportDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaMessageReportDo) Offset(offset int) IScaMessageReportDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaMessageReportDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaMessageReportDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaMessageReportDo) Unscoped() IScaMessageReportDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaMessageReportDo) Create(values ...*model.ScaMessageReport) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaMessageReportDo) CreateInBatches(values []*model.ScaMessageReport, batchSize int) error {
return s.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (s scaMessageReportDo) Save(values ...*model.ScaMessageReport) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaMessageReportDo) First() (*model.ScaMessageReport, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaMessageReport), nil
}
}
func (s scaMessageReportDo) Take() (*model.ScaMessageReport, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaMessageReport), nil
}
}
func (s scaMessageReportDo) Last() (*model.ScaMessageReport, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaMessageReport), nil
}
}
func (s scaMessageReportDo) Find() ([]*model.ScaMessageReport, error) {
result, err := s.DO.Find()
return result.([]*model.ScaMessageReport), err
}
func (s scaMessageReportDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaMessageReport, err error) {
buf := make([]*model.ScaMessageReport, 0, batchSize)
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (s scaMessageReportDo) FindInBatches(result *[]*model.ScaMessageReport, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaMessageReportDo) Attrs(attrs ...field.AssignExpr) IScaMessageReportDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaMessageReportDo) Assign(attrs ...field.AssignExpr) IScaMessageReportDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaMessageReportDo) Joins(fields ...field.RelationField) IScaMessageReportDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaMessageReportDo) Preload(fields ...field.RelationField) IScaMessageReportDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaMessageReportDo) FirstOrInit() (*model.ScaMessageReport, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaMessageReport), nil
}
}
func (s scaMessageReportDo) FirstOrCreate() (*model.ScaMessageReport, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaMessageReport), nil
}
}
func (s scaMessageReportDo) FindByPage(offset int, limit int) (result []*model.ScaMessageReport, count int64, err error) {
result, err = s.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = s.Offset(-1).Limit(-1).Count()
return
}
func (s scaMessageReportDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s scaMessageReportDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaMessageReportDo) Delete(models ...*model.ScaMessageReport) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaMessageReportDo) withDO(do gen.Dao) *scaMessageReportDo {
s.DO = *do.(*gen.DO)
return s
}

View File

@@ -0,0 +1,402 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
)
func newScaUserFollow(db *gorm.DB, opts ...gen.DOOption) scaUserFollow {
_scaUserFollow := scaUserFollow{}
_scaUserFollow.scaUserFollowDo.UseDB(db, opts...)
_scaUserFollow.scaUserFollowDo.UseModel(&model.ScaUserFollow{})
tableName := _scaUserFollow.scaUserFollowDo.TableName()
_scaUserFollow.ALL = field.NewAsterisk(tableName)
_scaUserFollow.FollowerID = field.NewString(tableName, "follower_id")
_scaUserFollow.FolloweeID = field.NewString(tableName, "followee_id")
_scaUserFollow.Status = field.NewInt64(tableName, "status")
_scaUserFollow.CreatedAt = field.NewTime(tableName, "created_at")
_scaUserFollow.UpdatedAt = field.NewTime(tableName, "updated_at")
_scaUserFollow.ID = field.NewInt64(tableName, "id")
_scaUserFollow.DeletedAt = field.NewField(tableName, "deleted_at")
_scaUserFollow.fillFieldMap()
return _scaUserFollow
}
type scaUserFollow struct {
scaUserFollowDo
ALL field.Asterisk
FollowerID field.String // 关注者
FolloweeID field.String // 被关注者
Status field.Int64 // 关注状态0 未互关 1 互关)
CreatedAt field.Time // 创建时间
UpdatedAt field.Time // 更新时间
ID field.Int64
DeletedAt field.Field // 删除时间
fieldMap map[string]field.Expr
}
func (s scaUserFollow) Table(newTableName string) *scaUserFollow {
s.scaUserFollowDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaUserFollow) As(alias string) *scaUserFollow {
s.scaUserFollowDo.DO = *(s.scaUserFollowDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaUserFollow) updateTableName(table string) *scaUserFollow {
s.ALL = field.NewAsterisk(table)
s.FollowerID = field.NewString(table, "follower_id")
s.FolloweeID = field.NewString(table, "followee_id")
s.Status = field.NewInt64(table, "status")
s.CreatedAt = field.NewTime(table, "created_at")
s.UpdatedAt = field.NewTime(table, "updated_at")
s.ID = field.NewInt64(table, "id")
s.DeletedAt = field.NewField(table, "deleted_at")
s.fillFieldMap()
return s
}
func (s *scaUserFollow) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := s.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (s *scaUserFollow) fillFieldMap() {
s.fieldMap = make(map[string]field.Expr, 7)
s.fieldMap["follower_id"] = s.FollowerID
s.fieldMap["followee_id"] = s.FolloweeID
s.fieldMap["status"] = s.Status
s.fieldMap["created_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["id"] = s.ID
s.fieldMap["deleted_at"] = s.DeletedAt
}
func (s scaUserFollow) clone(db *gorm.DB) scaUserFollow {
s.scaUserFollowDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaUserFollow) replaceDB(db *gorm.DB) scaUserFollow {
s.scaUserFollowDo.ReplaceDB(db)
return s
}
type scaUserFollowDo struct{ gen.DO }
type IScaUserFollowDo interface {
gen.SubQuery
Debug() IScaUserFollowDo
WithContext(ctx context.Context) IScaUserFollowDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaUserFollowDo
WriteDB() IScaUserFollowDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaUserFollowDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaUserFollowDo
Not(conds ...gen.Condition) IScaUserFollowDo
Or(conds ...gen.Condition) IScaUserFollowDo
Select(conds ...field.Expr) IScaUserFollowDo
Where(conds ...gen.Condition) IScaUserFollowDo
Order(conds ...field.Expr) IScaUserFollowDo
Distinct(cols ...field.Expr) IScaUserFollowDo
Omit(cols ...field.Expr) IScaUserFollowDo
Join(table schema.Tabler, on ...field.Expr) IScaUserFollowDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaUserFollowDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaUserFollowDo
Group(cols ...field.Expr) IScaUserFollowDo
Having(conds ...gen.Condition) IScaUserFollowDo
Limit(limit int) IScaUserFollowDo
Offset(offset int) IScaUserFollowDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaUserFollowDo
Unscoped() IScaUserFollowDo
Create(values ...*model.ScaUserFollow) error
CreateInBatches(values []*model.ScaUserFollow, batchSize int) error
Save(values ...*model.ScaUserFollow) error
First() (*model.ScaUserFollow, error)
Take() (*model.ScaUserFollow, error)
Last() (*model.ScaUserFollow, error)
Find() ([]*model.ScaUserFollow, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaUserFollow, err error)
FindInBatches(result *[]*model.ScaUserFollow, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaUserFollow) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IScaUserFollowDo
Assign(attrs ...field.AssignExpr) IScaUserFollowDo
Joins(fields ...field.RelationField) IScaUserFollowDo
Preload(fields ...field.RelationField) IScaUserFollowDo
FirstOrInit() (*model.ScaUserFollow, error)
FirstOrCreate() (*model.ScaUserFollow, error)
FindByPage(offset int, limit int) (result []*model.ScaUserFollow, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IScaUserFollowDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaUserFollowDo) Debug() IScaUserFollowDo {
return s.withDO(s.DO.Debug())
}
func (s scaUserFollowDo) WithContext(ctx context.Context) IScaUserFollowDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaUserFollowDo) ReadDB() IScaUserFollowDo {
return s.Clauses(dbresolver.Read)
}
func (s scaUserFollowDo) WriteDB() IScaUserFollowDo {
return s.Clauses(dbresolver.Write)
}
func (s scaUserFollowDo) Session(config *gorm.Session) IScaUserFollowDo {
return s.withDO(s.DO.Session(config))
}
func (s scaUserFollowDo) Clauses(conds ...clause.Expression) IScaUserFollowDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaUserFollowDo) Returning(value interface{}, columns ...string) IScaUserFollowDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaUserFollowDo) Not(conds ...gen.Condition) IScaUserFollowDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaUserFollowDo) Or(conds ...gen.Condition) IScaUserFollowDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaUserFollowDo) Select(conds ...field.Expr) IScaUserFollowDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaUserFollowDo) Where(conds ...gen.Condition) IScaUserFollowDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaUserFollowDo) Order(conds ...field.Expr) IScaUserFollowDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaUserFollowDo) Distinct(cols ...field.Expr) IScaUserFollowDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaUserFollowDo) Omit(cols ...field.Expr) IScaUserFollowDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaUserFollowDo) Join(table schema.Tabler, on ...field.Expr) IScaUserFollowDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaUserFollowDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaUserFollowDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaUserFollowDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaUserFollowDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaUserFollowDo) Group(cols ...field.Expr) IScaUserFollowDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaUserFollowDo) Having(conds ...gen.Condition) IScaUserFollowDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaUserFollowDo) Limit(limit int) IScaUserFollowDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaUserFollowDo) Offset(offset int) IScaUserFollowDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaUserFollowDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaUserFollowDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaUserFollowDo) Unscoped() IScaUserFollowDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaUserFollowDo) Create(values ...*model.ScaUserFollow) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaUserFollowDo) CreateInBatches(values []*model.ScaUserFollow, batchSize int) error {
return s.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (s scaUserFollowDo) Save(values ...*model.ScaUserFollow) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaUserFollowDo) First() (*model.ScaUserFollow, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaUserFollow), nil
}
}
func (s scaUserFollowDo) Take() (*model.ScaUserFollow, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaUserFollow), nil
}
}
func (s scaUserFollowDo) Last() (*model.ScaUserFollow, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaUserFollow), nil
}
}
func (s scaUserFollowDo) Find() ([]*model.ScaUserFollow, error) {
result, err := s.DO.Find()
return result.([]*model.ScaUserFollow), err
}
func (s scaUserFollowDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaUserFollow, err error) {
buf := make([]*model.ScaUserFollow, 0, batchSize)
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (s scaUserFollowDo) FindInBatches(result *[]*model.ScaUserFollow, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaUserFollowDo) Attrs(attrs ...field.AssignExpr) IScaUserFollowDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaUserFollowDo) Assign(attrs ...field.AssignExpr) IScaUserFollowDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaUserFollowDo) Joins(fields ...field.RelationField) IScaUserFollowDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaUserFollowDo) Preload(fields ...field.RelationField) IScaUserFollowDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaUserFollowDo) FirstOrInit() (*model.ScaUserFollow, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaUserFollow), nil
}
}
func (s scaUserFollowDo) FirstOrCreate() (*model.ScaUserFollow, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaUserFollow), nil
}
}
func (s scaUserFollowDo) FindByPage(offset int, limit int) (result []*model.ScaUserFollow, count int64, err error) {
result, err = s.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = s.Offset(-1).Limit(-1).Count()
return
}
func (s scaUserFollowDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = s.Count()
if err != nil {
return
}
err = s.Offset(offset).Limit(limit).Scan(result)
return
}
func (s scaUserFollowDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaUserFollowDo) Delete(models ...*model.ScaUserFollow) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaUserFollowDo) withDO(do gen.Dao) *scaUserFollowDo {
s.DO = *do.(*gen.DO)
return s
}

View File

@@ -6,11 +6,10 @@ package query
import (
"context"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"

View File

@@ -6,11 +6,10 @@ package query
import (
"context"
"schisandra-album-cloud-microservices/app/auth/api/model/mysql/model"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
"gorm.io/gen"
"gorm.io/gen/field"

View File

@@ -1,5 +1,6 @@
[captcha]
verificationFailure = "verification failure!"
[login]
invalidAccount = "invalid account"
notFoundAccount = "account not found"
@@ -18,4 +19,10 @@ loginSuccess = "login success"
[sms]
smsSendTooFrequently = "sms send too frequently"
smsSendFailed = "sms send failed"
smsSendSuccess = "sms send success"
smsSendSuccess = "sms send success"
[comment]
tooManyImages = "too many images"
commentError = "comment error"
LikeError = "like error"
CancelLikeError = "cancel like error"

View File

@@ -1,5 +1,6 @@
[captcha]
verificationFailure = "验证失败!"
[login]
invalidAccount = "无效的账号!"
notFoundAccount = "未找到账号!"
@@ -19,3 +20,9 @@ loginSuccess = "登录成功!"
smsSendTooFrequently = "验证码发送过于频繁,请稍后再试!"
smsSendFailed = "短信发送失败!"
smsSendSuccess = "短信发送成功!"
[comment]
tooManyImages = "图片数量过多请上传不超过3张"
commentError = "评论失败!"
LikeError = "点赞失败!"
CancelLikeError = "取消点赞失败!"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,170 @@
穴海
协警
纳米比亚
专业调查
有华龙
jq的来
电信路
党鞭
第一夫人
黄巨
荡尽天下
家元自称玉皇大帝
主席李世民
何祚庥
刘刚
不要沉默
后勤集团
食堂涨价
发国难财
浪漫邂逅
红满堂
张小洋
炸学校
子宫
叫晶晶的女孩
回派
社会黑暗
国之母
国母
国姆
东方微点
震惊全球
nowto
chengdu
徐明
六月飞雪
暴力虐待
暴力袭击
天府广场
粮荒
洗脑班
李愚蠢
中国猪
台湾猪
进化不完全的生命体
震死他们
10010
10086
10159
13423205670
13725516608
13875448369
15112886328
189
6-4tianwang
64
68170802
6a6.net
7.31
7.310
89-64cdjp
8945212
23条
259o
381929279
3P
4-Jun
AV
BJ
CBD
CCTV
CDMA
DICK
Dick
FLG
FOCUSC
FUCK
Fuck
GAMEMASTER
GCD
GameMaster
IP17908
KEY_TEXT
NMD
QQb
SM
Soccer01.com
TMD
UltraSurf
bignews
Bitch
boxun
Chinaliberal
chinamz
Chinesenewsnet
cnd
Creaders
dafa
Dajiyuan
df'd
Dfdz
die
dpp
Freechina
freedom
Freenet
fuck
fuck your mother
hongzhi
hrichina
huanet
hypermart.net
incest
jiangdongriji
l2590803027
lihongzhi
ma
making
minghui
minghuinews
nacb
na?ve
nmis
paper64
peacehall
piao
playboy
renminbao
renmingbao
rfa
safeweb
sex
shit
simple
svdc
taip
tibetalk
triangle
triangleboy
txwq.net
unixbox
ustibet
voa
voachinese
wangce
wstaiji
www
xinsheng
yuming
yy通讯录
zhengjian
zhengjianwang
zhenshanren
zhuanfalu
zhuanfalun
八九
八老
fuck
duck
shit
chicken
fowl
sex
sexy
prostitute
whore
harlot
hooker
gender

View File

@@ -0,0 +1,557 @@
腐败中国
三个呆婊
你办事我放心
社会主义灭亡
打倒中国
打倒共产党
打倒共产主义
打倒胡锦涛
打倒江泽民
打倒江主席
打倒李鹏
打倒罗干
打倒温家宝
打倒中共
打倒朱镕
抵制共产党
抵制共产主义
抵制胡锦涛
抵制江泽民
抵制江主席
抵制李鹏
抵制罗干
抵制温家宝
抵制中共
抵制朱镕基
灭亡中国
亡党亡国
粉碎四人帮
激流中国
特供
特贡
特共
zf大楼
殃视
贪污腐败
强制拆除
形式主义
政治风波
太子党
上海帮
北京帮
清华帮
红色贵族
权贵集团
河蟹社会
喝血社会
九风
9风
十七大
十7大
17da
九学
9学
四风
4风
双规
南街村
最淫官员
警匪
官匪
独夫民贼
官商勾结
城管暴力执法
强制捐款
毒豺
一党执政
一党专制
一党专政
专制政权
宪法法院
胡平
苏晓康
贺卫方
谭作人
焦国标
万润南
张志新
辛灝年
高勤荣
王炳章
高智晟
司马璐
刘晓竹
刘宾雁
魏京生
寻找林昭的灵魂
别梦成灰
谁是新中国
讨伐中宣部
异议人士
民运人士
启蒙派
选国家主席
民一主
min主
民竹
民珠
民猪
chinesedemocracy
大赦国际
国际特赦
da选
投公
公头
宪政
平反
党章
维权
昝爱宗
宪章
08宪
08xz
抿主
敏主
人拳
人木又
人quan
renquan
中国人权
中国新民党
群体事件
群体性事件
上中央
去中央
讨说法
请愿
请命
公开信
联名上书
万人大签名
万人骚动
截访
上访
shangfang
信访
访民
集合
集会
组织集体
静坐
静zuo
jing坐
示威
示wei
游行
you行
油行
游xing
youxing
官逼民反
反party
反共
抗议
亢议
抵制
低制
底制
di制
抵zhi
dizhi
boycott
血书
焚烧中国国旗
baoluan
流血冲突
出现暴动
发生暴动
引起暴动
baodong
灭共
杀毙
罢工
霸工
罢考
罢餐
霸餐
罢参
罢饭
罢吃
罢食
罢课
罢ke
霸课
ba课
罢教
罢学
罢运
网特
网评员
网络评论员
五毛党
五毛们
5毛党
戒严
jieyan
jie严
戒yan
8的平方事件
知道64
八九年
贰拾年
2o年
20和谐年
贰拾周年
六四
六河蟹四
六百度四
六和谐四
陆四
陆肆
198964
5月35
89年春夏之交
64惨案
64时期
64运动
4事件
四事件
北京风波
学潮
学chao
xuechao
学百度潮
门安天
天按门
坦克压大学生
民主女神
历史的伤口
高自联
北高联
血洗京城
四二六社论
王丹
柴玲
沈彤
封从德
王超华
王维林
吾尔开希
吾尔开西
侯德健
阎明复
方励之
蒋捷连
丁子霖
辛灏年
蒋彦永
严家其
陈一咨
中华局域网
党的喉舌
互联网审查
当局严密封锁
新闻封锁
封锁消息
爱国者同盟
关闭所有论坛
网络封锁
金盾工程
gfw
无界浏览
无界网络
自由门
何清涟
中国的陷阱
汪兆钧
记者无疆界
境外媒体
维基百科
纽约时报
bbc中文网
华盛顿邮报
世界日报
东森新闻网
东森电视
星岛日报
wikipedia
youtube
googleblogger
美国广播公司
英国金融时报
自由亚洲
自由时报
中国时报
反分裂
威胁论
左翼联盟
钓鱼岛
保钓组织
主权
弓单
火乍
木仓
石肖
核蛋
步qiang
bao炸
爆zha
baozha
zha药
zha弹
炸dan
炸yao
zhadan
zhayao
hmtd
三硝基甲苯
六氟化铀
炸药配方
弹药配方
炸弹配方
皮箱炸弹
火药配方
人体炸弹
人肉炸弹
解放军
兵力部署
军转
军事社
8341部队
第21集团军
七大军区
7大军区
北京军区
沈阳军区
济南军区
成都军区
广州军区
南京军区
兰州军区
颜色革命
规模冲突
塔利班
基地组织
恐怖分子
恐怖份子
三股势力
印尼屠华
印尼事件
蒋公纪念歌
马英九
mayingjiu
李天羽
苏贞昌
林文漪
陈水扁
陈s扁
陈随便
阿扁
a扁
告全国同胞书
台百度湾
台完
台wan
taiwan
台弯
湾台
台湾国
台湾共和国
台军
台独
台毒
台du
taidu
twdl
一中一台
打台湾
两岸战争
攻占台湾
支持台湾
进攻台湾
占领台湾
统一台湾
收复台湾
登陆台湾
解放台湾
解放tw
解决台湾
光复民国
台湾独立
台湾问题
台海问题
台海危机
台海统一
台海大战
台海战争
台海局势
入联
入耳关
中华联邦
国民党
x民党
民进党
青天白日
闹独立
duli
fenlie
日本万岁
小泽一郎
劣等民族
汉人
汉维
维汉
维吾
吾尔
热比娅
伊力哈木
疆独
东突厥斯坦解放组织
东突解放组织
蒙古分裂分子
列确
阿旺晋美
藏人
臧人
zang人
藏民
藏m
达赖
赖达
dalai
哒赖
dl喇嘛
丹增嘉措
打砸抢
西独
藏独
葬独
臧独
藏毒
藏du
zangdu
支持zd
藏暴乱
藏青会
雪山狮子旗
拉萨
啦萨
啦沙
啦撒
拉sa
lasa
la萨
西藏
藏西
藏春阁
藏獨
藏独
藏独立
藏妇会
藏青会
藏字石
xizang
xi藏
x藏
西z
tibet
希葬
希藏
硒藏
稀藏
西脏
西奘
西葬
西臧
援藏
bjork
王千源
安拉
回教
回族
回回
回民
穆斯林
穆罕穆德
穆罕默德
默罕默德
伊斯兰
圣战组织
清真
清zhen
qingzhen
真主
阿拉伯
高丽棒子
韩国狗
满洲第三帝国
满狗
鞑子
江丑闻
江嫡系
江毒
江独裁
江蛤蟆
江核心
江黑心
江胡内斗
江祸心
江家帮
江绵恒
江派和胡派
江派人马
江泉集团
江人马
江三条腿
江氏集团
江氏家族
江氏政治局
江氏政治委员
江梳头
江太上
江戏子
江系人
江系人马
江宰民
江贼
江贼民
江主席
麻果丸
麻将透
麻醉弹
麻醉狗
麻醉枪
麻醉槍
麻醉药
麻醉藥
台独
台湾版假币
台湾独立
台湾国
台湾应该独立
台湾有权独立
天灭中共
中共帮凶
中共保命
中共裁
中共党文化
中共腐败
中共的血旗
中共的罪恶
中共帝国
中共独裁
中共封锁
中共封网
中共腐败
中共黑
中共黑帮
中共解体
中共近期权力斗争
中共恐惧
中共权力斗争
中共任用
中共退党
中共洗脑
中共邪教
中共政治游戏
中共邪毒素

View File

@@ -0,0 +1,178 @@
福音会
中国教徒
统一教
观音法门
清海无上师
盘古
李洪志
志洪李
李宏志
轮功
法轮
轮法功
三去车仑
氵去车仑
发论工
法x功
法o功
法0功
法一轮一功
轮子功
车仑工力
法lun
fa轮
法lg
flg
fl功
falungong
大法弟子
大纪元
dajiyuan
明慧网
明慧周报
正见网
新唐人
伪火
退党
tuidang
退dang
超越红墙
自fen
真善忍
九评
9评
9ping
九ping
jiuping
藏字石
集体自杀
自sha
zi杀
suicide
titor
逢8必灾
逢八必灾
逢9必乱
逢九必乱
朱瑟里诺
根达亚文明
诺查丹玛斯
人类灭亡进程表
按照马雅历法
推背图
推bei图
济世灵文
诸世纪
电狗
电话定位器
电话拦截器
电话窃听
电话监
电话交友
电话追杀系统
电击枪
电鸡
电警棒
枪出售
枪的制
枪货到
枪决女犯
枪模
枪手
枪销售
枪械制
枪子弹
售步枪
售纯度
售单管
售弹簧刀
售防身
售狗子
售虎头
售火药
售假币
售健卫
售军用
售猎枪
售氯胺
售麻醉
售枪支
售热武
售三棱
售手枪
售五四
售一元硬
售子弹
售左轮
亚砷(酸)酐
亚砷酸钾
亚砷酸钠
亚硒酸
亚硒酸二钠
亚硒酸镁
亚硒酸钠
亚硒酸氢钠
亚硝酸乙酯
亚硝酰乙氧
氧化二丁基锡
氧化汞
氧化铊
氧化亚铊
氧氯化磷
原装弹
原子弹方法
原子弹清单
安眠酮
代血浆
普萘洛尔
呋塞米
西布曲明
testosterone
胰岛素样生长因子
促红细胞生成素
地西泮
尼可刹米
甲睾酮
adrenaline
erythropoietin
地奈德
莫达非尼
氯噻嗪
苯巴比妥
促性腺激素
泼尼松
麻黄草
雄烯二醇
地塞米松
tamoxifen
strychnine
androst
新型毒品
杜冷丁
兴奋剂
mdma
海洛因
海luo因
heroin
diamorphine
diacetylmorphine
鸦片
阿芙蓉
咖啡因
cocain
三唑仑
美沙酮
麻古
k粉
凯他敏
ketamine
冰毒
苯丙胺
cannabis
大麻
爱他死
氯胺酮
benzodiazepines
甲基安非他明
吗啡
安非他命

View File

@@ -0,0 +1,571 @@
打人
打人
拆迁
拆迁
纠纷
纠纷
盗窃
盗窃
安眠酮
代药物毒品类:血浆
普萘洛尔
呋塞米
西布曲明
testosterone
胰岛素样生长因子
促红细胞生成素
地西泮
尼可刹米
甲睾酮
adrenaline
erythropoietin
地奈德
莫达非尼
氯噻嗪
苯巴比妥
促性腺激素
泼尼松
麻黄草
雄烯二醇
地塞米松
tamoxifen
strychnine
androst
新型毒品
杜冷丁
兴奋剂
mdma
海洛因
海luo因
heroin
diamorphine
diacetylmorphine
鸦片
阿芙蓉
咖啡因
cocain
三唑仑
美沙酮
麻古
k粉
凯他敏
ketamine
冰毒
苯丙胺
cannabis
大麻
爱他死
氯胺酮
benzodiazepines
甲基安非他明
安非他命
吗啡
morphine
摇头丸
迷药
乖乖粉
narcotic
麻醉药
精神药品
专业代理
帮忙点一下
帮忙点下
请点击进入
详情请进入
私人侦探
私家侦探
针孔摄象
调查婚外情
信用卡提现
无抵押贷款
广告代理
原音铃声
借腹生子
找个妈妈
找个爸爸
代孕妈妈
代生孩子
代开发票
腾讯客服电话
销售热线
免费订购热线
低价出售
款到发货
回复可见
连锁加盟
加盟连锁
免费二级域名
免费使用
免费索取
蚁力神
婴儿汤
售肾
刻章办
买小车
套牌车
玛雅网
电脑传讯
视频来源
下载速度
高清在线
全集在线
在线播放
txt下载
六位qq
6位qq
位的qq
个qb
送qb
用刀横向切腹
完全自杀手册
四海帮
足球投注
地下钱庄
中国复兴党
阿波罗网
曾道人
六合彩
改卷内幕
替考试
隐形耳机
出售答案
考中答案
答an
da案
资金周转
救市
股市圈钱
崩盘
资金短缺
证监会
质押贷款
小额贷款
周小川
刘明康
尚福林
孔丹
汉芯造假
杨树宽
中印边界谈判结果
喂奶门
摸nai门
酒瓶门
脱裤门
75事件
乌鲁木齐
新疆骚乱
针刺
打针
食堂涨价
饭菜涨价
h1n1
瘟疫爆发
yangjia
y佳
yang佳
杨佳
杨j
袭警
杀警
武侯祠
川b26931
贺立旗
周正毅
px项目
骂四川
家l福
家le福
加了服
麦当劳被砸
豆腐渣
这不是天灾
龙小霞
震其国土
yuce
提前预测
地震预测
隐瞒地震
李四光预测
蟾蜍迁徙
地震来得更猛烈
八级地震毫无预报
踩踏事故
聂树斌
万里大造林
陈相贵
张丹红
尹方明
李树菲
王奉友
零八奥运艰
惨奥
奥晕
凹晕
懊运
懊孕
奥孕
奥你妈的运
反奥
628事件
weng安
wengan
翁安
瓮安事件
化工厂爆炸
讨回工资
代办发票
代办各
代办文
代办学
代办制
代辦
代表烦
代开发票
代開
代考
代理发票
代理票据
代您考
代讨债
代写毕
代写论文
代孕
代追债
考后付款
考机构
考考邓
考联盟
考前答案
考前付
考前密卷
考前预测
考试,答案
考试,作弊器
考试包过
考试保
考试答案
考试机构
考试联盟
考试枪
考试作弊
考试作弊器
考研考中
考中答案
透视功能
透视镜
透视扑
透视器
透视眼睛
透视眼镜
透视药
透视仪
打死经过
打死人
打砸办公
打砸抢
安眠酮
代血浆
普萘洛尔
呋塞米
西布曲明
testosterone
胰岛素样生长因子
促红细胞生成素
地西泮
尼可刹米
甲睾酮
adrenaline
erythropoietin
地奈德
莫达非尼
氯噻嗪
苯巴比妥
促性腺激素
泼尼松
麻黄草
雄烯二醇
地塞米松
tamoxifen
strychnine
androst
新型毒品
杜冷丁
兴奋剂
mdma
海洛因
海luo因
heroin
diamorphine
diacetylmorphine
鸦片
阿芙蓉
咖啡因
cocain
三唑仑
美沙酮
麻古
k粉
凯他敏
ketamine
冰毒
苯丙胺
cannabis
大麻
爱他死
氯胺酮
benzodiazepines
甲基安非他明
安非他命
吗啡
KC短信
KC嘉年华
短信广告
短信群发
短信群发器
小6灵通
短信商务广告
段录定
无界浏览
无界浏览器
无界
无网界
无网界浏览
无帮国
KC提示
KC网站
UP8新势力
白皮书
UP新势力
移民
易达网络卡
安魂网
罢工
罢课
纽崔莱七折
手机复制
手机铃声
网关
神通加持法
全1球通
如6意通
清仓
灵动卡
答案卫星接收机
高薪养廉
考后付款
佳静安定片
航空母舰
航空售票
号码百事通
考前发放
成本价
诚信通手机商城
高利贷
联4通
黑庄
黑手党
黑车
联通贵宾卡
联总
联总这声传单
联总之声传单
高息贷款
高干子弟
恭喜你的号码
恭喜您的号码
高干子女
各个银行全称
各种发票
高官
高官互调
高官子女
喝一送一
卡号
复制
监听王
传单
旦科
钓鱼岛
钓鱼台
当官靠后台
党校安插亲信
传九促三
客户端非法字符
刻章
大麻树脂
大麻油
大法
大法弟子
dpp大法
fa lun
falu
发抡
发抡功
洗脑
下法轮
发轮
发伦
发伦功
发仑
发沦
发纶
发论
发论功
发论公
发正念
发囵
发愣
发瞟
罚抡
罚伦
罚仑
罚沦
罚纶
罚囵
筏抡
筏轮
筏伦
筏仑
筏沦
筏纶
筏论
筏囵
伐抡
伐轮
伐伦
伐仑
伐沦
伐论
伐囵
乏抡
乏轮
乏伦
乏仑
乏沦
乏纶
乏论
乏囵
阀抡
阀伦
阀仑
阀沦
阀纶
阀论
阀囵
法 轮 功
法*功
法.轮.功
法L功
法lun功
法功
法会
法抡
法抡功
法轮
法轮大法
法轮佛法
法轮功
法伦
法仑
法沦
法纶
法论
法十轮十功
法西斯
法院
法正
法谪
法谪功
法輪
法囵
法愣
珐.輪功
珐抡
珐轮
珐伦
珐仑
珐沦
五不
五不争鸣论坛
五出三进
五套功法
邝锦文
垡抡
垡轮
垡伦
垡仑
垡沦
垡纶
垡论
垡囵
茳澤民
荭志
闳志
闵维方
氵去
氵去车仑工力
转法轮
砝抡
砝轮
砝伦
砝仑
砝沦
砝纶
真、善、忍
真理教
真善美
真善忍
砝论
砝囵
泓志
屙民
珐纶
珐论
珐囵
falun
Falundafa
fa轮
Flg
弟子
地下教会
炼功
梦网洪志
轮大
抡功
轮功
伦功
摩门教
三水法轮
三唑仑
天皇
天怒
天葬
车臣
达赖
功法
讲法
基督
基督教
护法
回教
教徒
功友
大师
达赖喇嘛
虹志
鸿志
洪传
贯通两极法
光祖
洪吟
洪哲胜
洪志
宏法
观世音
宏志
弘志
古兰经
红志
车库
经文
车仑

View File

@@ -0,0 +1,929 @@
爱女人
爱液
按摩棒
拔出来
爆草
包二奶
暴干
暴奸
暴乳
爆乳
暴淫
被插
被操
被干
逼奸
仓井空
插暴
操逼
操黑
操烂
肏你
肏死
操死
操我
厕奴
插比
插b
插逼
插进
插你
插我
插阴
潮吹
潮喷
成人dv
成人电影
成人论坛
成人小说
成人电
成人电影
成人卡通
成人聊
成人片
成人视
成人图
成人文
成人小
成人电影
成人论坛
成人色情
成人网站
成人文学
成人小说
艳情小说
成人游戏
吃精
赤裸
抽插
扌由插
抽一插
春药
大波
大力抽送
大乳
荡妇
荡女
盗撮
多人轮
发浪
放尿
肥逼
粉穴
封面女郎
风月大陆
干死你
干穴
肛交
肛门
龟头
裹本
国产av
好嫩
豪乳
黑逼
后庭
后穴
虎骑
花花公子
换妻俱乐部
黄片
几吧
鸡吧
鸡巴
鸡奸
寂寞男
寂寞女
妓女
激情
集体淫
奸情
叫床
脚交
金鳞岂是池中物
金麟岂是池中物
精液
就去日
巨屌
菊花洞
菊门
巨奶
巨乳
菊穴
开苞
口爆
口活
口交
口射
口淫
裤袜
狂操
狂插
浪逼
浪妇
浪叫
浪女
狼友
聊性
流淫
铃木麻
凌辱
漏乳
露b
乱交
乱伦
轮暴
轮操
轮奸
裸陪
买春
美逼
美少妇
美乳
美腿
美穴
美幼
秘唇
迷奸
密穴
蜜穴
蜜液
摸奶
摸胸
母奸
奈美
奶子
男奴
内射
嫩逼
嫩女
嫩穴
捏弄
女优
炮友
砲友
喷精
屁眼
品香堂
前凸后翘
强jian
强暴
强奸处女
情趣用品
情色
拳交
全裸
群交
惹火身材
人妻
人兽
日逼
日烂
肉棒
肉逼
肉唇
肉洞
肉缝
肉棍
肉茎
肉具
揉乳
肉穴
肉欲
乳爆
乳房
乳沟
乳交
乳头
三级片
骚逼
骚比
骚女
骚水
骚穴
色逼
色界
色猫
色盟
色情网站
色区
色色
色诱
色欲
色b
少年阿宾
少修正
射爽
射颜
食精
释欲
兽奸
兽交
手淫
兽欲
熟妇
熟母
熟女
爽片
爽死我了
双臀
死逼
丝袜
丝诱
松岛枫
酥痒
汤加丽
套弄
体奸
体位
舔脚
舔阴
调教
偷欢
偷拍
推油
脱内裤
文做
我就色
无码
舞女
无修正
吸精
夏川纯
相奸
小逼
校鸡
小穴
小xue
写真
性感妖娆
性感诱惑
性虎
性饥渴
性技巧
性交
性奴
性虐
性息
性欲
胸推
穴口
学生妹
穴图
亚情
颜射
阳具
杨思敏
要射了
夜勤病栋
一本道
一夜欢
一夜情
一ye情
阴部
淫虫
阴唇
淫荡
阴道
淫电影
阴阜
淫妇
淫河
阴核
阴户
淫贱
淫叫
淫教师
阴茎
阴精
淫浪
淫媚
淫糜
淫魔
淫母
淫女
淫虐
淫妻
淫情
淫色
淫声浪语
淫兽学园
淫书
淫术炼金士
淫水
淫娃
淫威
淫亵
淫样
淫液
淫照
阴b
应召
幼交
幼男
幼女
欲火
欲女
玉女心经
玉蒲团
玉乳
欲仙欲死
玉穴
援交
原味内衣
援助交际
张筱雨
招鸡
招妓
中年美妇
抓胸
自拍
自慰
作爱
18禁
99bb
a4u
a4y
adult
amateur
anal
a片
fuck
gay片
g点
g片
hardcore
h动画
h动漫
incest
porn
secom
sexinsex
sm女王
xiao77
xing伴侣
tokyohot
yin荡
贱人
装b
大sb
傻逼
傻b
煞逼
煞笔
刹笔
傻比
沙比
欠干
婊子养的
我日你
我操
我草
卧艹
卧槽
爆你菊
艹你
cao你
你他妈
真他妈
别他吗
草你吗
草你丫
操你妈
擦你妈
操你娘
操他妈
日你妈
干你妈
干你娘
娘西皮
狗操
狗草
狗杂种
狗日的
操你祖宗
操你全家
操你大爷
妈逼
你麻痹
麻痹的
妈了个逼
马勒
狗娘养
贱比
贱b
下贱
死全家
全家死光
全家不得好死
全家死绝
白痴
无耻
sb
杀b
你吗b
你妈的
婊子
贱货
人渣
混蛋
媚外
和弦
兼职
限量
铃声
性伴侣
男公关
火辣
精子
射精
诱奸
强奸
做爱
性爱
发生关系
按摩
快感
处男
猛男
少妇
屁股
下体
a片
内裤
浑圆
咪咪
发情
刺激
白嫩
粉嫩
兽性
风骚
呻吟
sm
阉割
高潮
裸露
不穿
一丝不挂
脱光
干你
干死
我干
裙中性运动
乱奸
乱伦
乱伦类
乱伦小
伦理大
伦理电影
伦理毛
伦理片
裸聊
裸聊网
裸体写真
裸舞视
裸照
美女裸体
美女写真
美女上门
美艳少妇
妹按摩
妹上门
迷幻药
迷幻藥
迷昏口
迷昏药
迷昏藥
迷魂香
迷魂药
迷魂藥
迷奸粉
迷奸药
迷情粉
迷情水
迷情药
迷药
迷藥
谜奸药
骚妇
骚货
骚浪
骚女
骚嘴
色电影
色妹妹
色情表演
色情电影
色情服务
色情图片
色情小说
色情影片
色情表演
色情电影
色情服务
色情片
色视频
色小说
性伴侣
性服务
性福情
性感少
性伙伴
性交
性交视频
性交图片
性奴
性奴集中营
性虐
阴唇
阴道
阴蒂
阴户
阴间来电
阴茎
阴茎增大
阴茎助勃
阴毛
陰唇
陰道
陰戶
淫荡
淫荡美女
淫荡视频
淫荡照片
淫乱
淫靡
淫魔
淫魔舞
淫女
淫情女
淫肉
淫騷妹
淫兽
淫兽学
淫水
淫穴
morphine
摇头丸
迷药
乖乖粉
narcotic
麻醉药
精神药品
爱女人
爱液
按摩棒
拔出来
爆草
包二奶
暴干
暴奸
暴乳
爆乳
暴淫
被操
被插
被干
逼奸
仓井空
插暴
操逼
操黑
操烂
肏你
肏死
操死
操我
厕奴
插比
插b
插逼
插进
插你
插我
插阴
潮吹
潮喷
成人电影
成人论坛
成人色情
成人网站
成人文学
成人小说
艳情小说
成人游戏
吃精
赤裸
抽插
扌由插
抽一插
春药
大波
大力抽送
大乳
荡妇
荡女
盗撮
多人轮
发浪
放尿
肥逼
粉穴
封面女郎
风月大陆
干死你
干穴
肛交
肛门
龟头
裹本
国产av
好嫩
豪乳
黑逼
后庭
后穴
虎骑
花花公子
换妻俱乐部
黄片
几吧
鸡吧
鸡巴
鸡奸
寂寞男
寂寞女
妓女
激情
集体淫
奸情
叫床
脚交
金鳞岂是池中物
金麟岂是池中物
精液
就去日
巨屌
菊花洞
菊门
巨奶
巨乳
菊穴
开苞
口爆
口活
口交
口射
口淫
裤袜
狂操
狂插
浪逼
浪妇
浪叫
浪女
狼友
聊性
流淫
铃木麻
凌辱
漏乳
露b
乱交
乱伦
轮暴
轮操
轮奸
裸陪
买春
美逼
美少妇
美乳
美腿
美穴
美幼
秘唇
迷奸
密穴
蜜穴
蜜液
摸奶
摸胸
母奸
奈美
奶子
男奴
内射
嫩逼
嫩女
嫩穴
捏弄
女优
炮友
砲友
喷精
屁眼
品香堂
前凸后翘
强jian
强暴
强奸处女
情趣用品
情色
拳交
全裸
群交
惹火身材
人妻
人兽
日逼
日烂
肉棒
肉逼
肉唇
肉洞
肉缝
肉棍
肉茎
肉具
揉乳
肉穴
肉欲
乳爆
乳房
乳沟
乳交
乳头
三级片
骚逼
骚比
骚女
骚水
骚穴
色逼
色界
色猫
色盟
色情网站
色区
色色
色诱
色欲
色b
少年阿宾
少修正
射爽
射颜
食精
释欲
兽奸
兽交
手淫
兽欲
熟妇
熟母
熟女
爽片
爽死我了
双臀
死逼
丝袜
丝诱
松岛枫
酥痒
汤加丽
套弄
体奸
体位
舔脚
舔阴
调教
偷欢
偷拍
推油
脱内裤
文做
我就色
无码
舞女
无修正
吸精
夏川纯
相奸
小逼
校鸡
小穴
小xue
写真
性感妖娆
性感诱惑
性虎
性饥渴
性技巧
性交
性奴
性虐
性息
性欲
胸推
穴口
学生妹
穴图
亚情
颜射
阳具
杨思敏
要射了
夜勤病栋
一本道
一夜欢
一夜情
一ye情
阴部
淫虫
阴唇
淫荡
阴道
淫电影
阴阜
淫妇
淫河
阴核
阴户
淫贱
淫叫
淫教师
阴茎
阴精
淫浪
淫媚
淫糜
淫魔
淫母
淫女
淫虐
淫妻
淫情
淫色
淫声浪语
淫兽学园
淫书
淫术炼金士
淫水
淫娃
淫威
淫亵
淫样
淫液
淫照
阴b
应召
幼交
幼男
幼女
欲火
欲女
玉女心经
玉蒲团
玉乳
欲仙欲死
玉穴
援交
原味内衣
援助交际
张筱雨
招鸡
招妓
中年美妇
抓胸
自拍
自慰
作爱
18禁
99bb
a4u
a4y
adult
amateur
anal
a片
fuck
gay片
g点
g片
hardcore
h动画
h动漫
incest
porn
secom
sexinsex
sm女王
xiao77
xing伴侣
tokyohot
yin荡

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,244 @@
腐败
贪污
gcd
共贪党
gongchandang
阿共
共一产一党
产党共
公产党
工产党
共c党
共x党
供产
共铲
共惨
供铲党
供铲谠
供铲裆
共残党
共残主义
共产主义的幽灵
拱铲
老共
中珙
中gong
gc党
贡挡
gong党
g产
狗产蛋
共残裆
恶党
邪党
共产专制
共产王朝
裆中央
土共
土g
共狗
g匪
共匪
仇共
共产党腐败
共产党专制
共产党的报应
共产党的末日
共产党专制
communistparty
症腐
政腐
政付
正府
政俯
政f
zhengfu
政zhi
挡中央
档中央
中国zf
中央zf
国wu院
中华帝国
gong和
大陆官方
北京政权
刘志军
张曙
刘志军
买别墅
玩女人
贪20亿
许宗衡
贪财物
李启红
贪腐财富
落马
高官名单
陈希同
贪污
玩忽职守
有期徒刑
陈良宇
受贿罪
滥用职权
有期徒刑
没收个人财产
成克杰
死刑
程维高
严重违纪
开除党籍
撤销职务
刘方仁
无期徒刑
倪献策
徇私舞弊
梁湘
以权谋私
撤职。
李嘉廷
死刑缓期
张国光
韩桂芝
宋平顺
自杀
黄瑶
双规
陈绍基
判处死刑
剥夺政治权利终身
没收个人全部财产
石兆彬
侯伍杰
王昭耀
剥夺政治权利
杜世成
沈图
叛逃美国
罗云光
起诉
张辛泰
李效时
边少斌
徐鹏航
违纪
收受股票
王乐毅
李纪周
郑光迪
田凤山。
邱晓华
郑筱萸
孙鹤龄
蓝田造假案
于幼军
留党察看
何洪达
朱志刚
杨汇泉
官僚主义
徐炳松
托乎提沙比尔
王宝森
经济犯罪
畏罪自杀。
陈水文
孟庆平
胡长清
朱川
许运鸿
丘广钟
刘知炳
丛福奎
王怀忠
巨额财产
来源不明罪
李达昌
刘长贵
王钟麓
阿曼哈吉
付晓光
自动辞
刘克田
吕德彬
刘维明
双开
刘志华
孙瑜
李堂堂
韩福才 青海
欧阳德 广东
韦泽芳 海南
铁英 北京
辛业江 海南
于飞 广东
姜殿武 河北
秦昌典 重庆
范广举 黑龙江
张凯广东
王厚宏海南
陈维席安徽
王有杰河南
王武龙江苏
米凤君吉林
宋勇辽宁
张家盟浙江
马烈孙宁夏
黄纪诚北京
常征贵州
王式惠重庆
周文吉
王庆录广西
潘广田山东
朱作勇甘肃
孙善武河南
宋晨光江西
梁春禄广西政协
鲁家善 中国交通
金德琴 中信
李大强 神华
吴文英 纺织
查克明 华能
朱小华光大
高严 国家电力
王雪冰
林孔兴
刘金宝
张恩照
陈同海
康日新
王益
张春江
洪清源
平义杰
李恩潮
孙小虹
陈忠
慕绥新
田凤岐
麦崇楷
柴王群
吴振汉
张秋阳
徐衍东
徐发 黑龙江
张宗海
丁鑫发
徐国健
李宝金
单平
段义和
荆福生
陈少勇
黄松有
皮黔生
王华元
王守业
刘连昆
孙晋美
邵松高
肖怀枢
刘广智 空军
姬胜德 总参
廖伯年 北京

File diff suppressed because it is too large Load Diff