作者 tangxvhui

更新模型

... ... @@ -2,30 +2,33 @@ package models
import (
"fmt"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
)
type Article struct {
Id int64 // 唯一标识
CompanyId int64 `json:"companyId"`
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
AuthorId int64 `json:"authorId"` // 发布人
Author domain.User `json:"author"` // 发布人
Title string `json:"title"` // 文章标题
Images []domain.Image `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location domain.Location `json:"location"` // 坐标
TargetUser int `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
Tags []int `json:"tags"` // 标签
Show int `json:"showState"` // 评论的展示状态(0显示、1不显示)
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
DeletedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
Version int
AuthorId int64 // 发布人
Author domain.UserSimple // 发布人
Title string // 文章标题
Images []domain.Image // 图片
WhoRead []int64 // 谁可以看
WhoReview []int64 // 评论人
Location domain.Location // 坐标
TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
CountLove int // 点赞数量
CountComment int // 评论数量
Tags []int // 标签
Show int // 评论的展示状态(0显示、1不显示)
}
func (m *Article) TableName() string {
... ... @@ -33,13 +36,13 @@ func (m *Article) TableName() string {
}
func (m *Article) BeforeCreate(tx *gorm.DB) (err error) {
// m.CreatedAt = time.Now().Unix()
// m.UpdatedAt = time.Now().Unix()
m.CreatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
func (m *Article) BeforeUpdate(tx *gorm.DB) (err error) {
// m.UpdatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
... ...
... ... @@ -2,14 +2,30 @@ package models
import (
"fmt"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
)
type ArticleBackup struct {
Id int64 // 唯一标识
Version int
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
DeletedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
Version int
Operator domain.UserSimple // 操作人
Title string // 标题
Section []domain.ArticleSection // 分段内容
Images []domain.Image // 图片
Action string // 操作
WhoRead []int64 // 谁可以看
WhoReview []int64 // 评论人
Tags []int // 标签
TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
}
func (m *ArticleBackup) TableName() string {
... ... @@ -17,13 +33,13 @@ func (m *ArticleBackup) TableName() string {
}
func (m *ArticleBackup) BeforeCreate(tx *gorm.DB) (err error) {
// m.CreatedAt = time.Now().Unix()
// m.UpdatedAt = time.Now().Unix()
m.CreatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
func (m *ArticleBackup) BeforeUpdate(tx *gorm.DB) (err error) {
// m.UpdatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
... ...
... ... @@ -2,14 +2,35 @@ package models
import (
"fmt"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
)
type ArticleComment struct {
Id int64 // 唯一标识
Version int
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
DeletedAt int64
Version int
Pid int64 // 对哪个评论进行回复
TopId int64 // 归属于最上级的哪个评论
ArticleId int64 // 文章id
ArticleSectionId int64 // 文本内容id
SectionContent string // 引用的文章内容文本
FromUserId int64 // 谁填写的评论
FromUser domain.UserSimple // 谁填写的评论
ToUserId int64 // 回复谁的评论
ToUser domain.UserSimple // 回复谁的评论
Content string // 评论内容
CountReply int // 回复数量
CountUserLove int // 用户点赞数量
CountAdminLove int // 运营点赞数量
Show int // 评论的展示状态(0显示、1不显示)
}
func (m *ArticleComment) TableName() string {
... ... @@ -17,13 +38,13 @@ func (m *ArticleComment) TableName() string {
}
func (m *ArticleComment) BeforeCreate(tx *gorm.DB) (err error) {
// m.CreatedAt = time.Now().Unix()
// m.UpdatedAt = time.Now().Unix()
m.CreatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
func (m *ArticleComment) BeforeUpdate(tx *gorm.DB) (err error) {
// m.UpdatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
... ...
... ... @@ -5,11 +5,25 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
)
type ArticleDraft struct {
Id int64 // 唯一标识
Version int
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
DeletedAt int64
Version int
Template int // 填写内容时用的样板0、无 1、演绎式 2、归纳式
Content []string // 文章内容
AuthorId int64 // 发布人
Title string // 文章标题
Images []domain.Image // 图片
WhoRead []int64 // 谁可以看
WhoReview []int64 // 评论人
Location domain.Location // 坐标
}
func (m *ArticleDraft) TableName() string {
... ...
... ... @@ -2,14 +2,25 @@ package models
import (
"fmt"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
)
type ArticleSection struct {
Id int64 // 唯一标识
Version int
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
DeletedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
Version int
ArticleId int64 // 文章id
Content string // 文本内容
SortBy int // 排序
TotalComment int // 评论的数量
}
func (m *ArticleSection) TableName() string {
... ... @@ -17,13 +28,13 @@ func (m *ArticleSection) TableName() string {
}
func (m *ArticleSection) BeforeCreate(tx *gorm.DB) (err error) {
// m.CreatedAt = time.Now().Unix()
// m.UpdatedAt = time.Now().Unix()
m.CreatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
func (m *ArticleSection) BeforeUpdate(tx *gorm.DB) (err error) {
// m.UpdatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
... ...
... ... @@ -2,14 +2,23 @@ package models
import (
"fmt"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
)
type UserLoveFlag struct {
Id int64 // 唯一标识
Version int
Id int64 `gorm:"primaryKey"` // 唯一标识
ArticleId int64 // 点赞文章时,文章id
CommentId int64 // 点赞评论时,填评论id
UserId int64
CreatedAt int64
UpdatedAt int64
DeletedAt int64
Version int
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
}
func (m *UserLoveFlag) TableName() string {
... ... @@ -17,13 +26,13 @@ func (m *UserLoveFlag) TableName() string {
}
func (m *UserLoveFlag) BeforeCreate(tx *gorm.DB) (err error) {
// m.CreatedAt = time.Now().Unix()
// m.UpdatedAt = time.Now().Unix()
m.CreatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
func (m *UserLoveFlag) BeforeUpdate(tx *gorm.DB) (err error) {
// m.UpdatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
... ...
... ... @@ -3,7 +3,6 @@ package repository
import (
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/tiptok/gocomm/pkg/cache"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models"
... ... @@ -142,15 +141,47 @@ func (repository *ArticleBackupRepository) Find(ctx context.Context, conn transa
}
func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.ArticleBackup) (*domain.ArticleBackup, error) {
to := &domain.ArticleBackup{}
err := copier.Copy(to, from)
return to, err
to := &domain.ArticleBackup{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.CreatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Operator: from.Operator,
Title: from.Title,
Section: from.Section,
Images: from.Images,
Action: from.Action,
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Tags: from.Tags,
TargetUser: domain.ArticleTarget(from.TargetUser),
}
// err := copier.Copy(to, from)
return to, nil
}
func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.ArticleBackup) (*models.ArticleBackup, error) {
to := &models.ArticleBackup{}
err := copier.Copy(to, from)
return to, err
to := &models.ArticleBackup{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.CreatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Operator: from.Operator,
Title: from.Title,
Section: from.Section,
Images: from.Images,
Action: from.Action,
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Tags: from.Tags,
TargetUser: int(from.TargetUser),
}
// err := copier.Copy(to, from)
return to, nil
}
func NewArticleBackupRepository(cache *cache.CachedRepository) domain.ArticleBackupRepository {
... ...
... ... @@ -3,7 +3,6 @@ package repository
import (
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/tiptok/gocomm/pkg/cache"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models"
... ... @@ -142,15 +141,57 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans
}
func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.ArticleComment) (*domain.ArticleComment, error) {
to := &domain.ArticleComment{}
err := copier.Copy(to, from)
return to, err
to := &domain.ArticleComment{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
ArticleSectionId: from.ArticleSectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: domain.CommentShow(from.Show),
}
// err := copier.Copy(to, from)
return to, nil
}
func (repository *ArticleCommentRepository) DomainModelToModel(from *domain.ArticleComment) (*models.ArticleComment, error) {
to := &models.ArticleComment{}
err := copier.Copy(to, from)
return to, err
to := &models.ArticleComment{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
ArticleSectionId: from.ArticleSectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: int(from.Show),
}
// err := copier.Copy(to, from)
return to, nil
}
func NewArticleCommentRepository(cache *cache.CachedRepository) domain.ArticleCommentRepository {
... ...
... ... @@ -3,7 +3,6 @@ package repository
import (
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/tiptok/gocomm/pkg/cache"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models"
... ... @@ -142,15 +141,45 @@ func (repository *ArticleDraftRepository) Find(ctx context.Context, conn transac
}
func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.ArticleDraft) (*domain.ArticleDraft, error) {
to := &domain.ArticleDraft{}
err := copier.Copy(to, from)
return to, err
to := &domain.ArticleDraft{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Template: from.Template,
Content: from.Content,
AuthorId: from.AuthorId,
Title: from.Title,
Images: from.Images,
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
}
// err := copier.Copy(to, from)
return to, nil
}
func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.ArticleDraft) (*models.ArticleDraft, error) {
to := &models.ArticleDraft{}
err := copier.Copy(to, from)
return to, err
to := &models.ArticleDraft{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Template: from.Template,
Content: from.Content,
AuthorId: from.AuthorId,
Title: from.Title,
Images: from.Images,
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
}
// err := copier.Copy(to, from)
return to, nil
}
func NewArticleDraftRepository(cache *cache.CachedRepository) domain.ArticleDraftRepository {
... ...
... ... @@ -3,7 +3,6 @@ package repository
import (
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/tiptok/gocomm/pkg/cache"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models"
... ... @@ -142,15 +141,52 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction.
}
func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (*domain.Article, error) {
to := &domain.Article{}
err := copier.Copy(to, from)
return to, err
to := &domain.Article{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
AuthorId: from.AuthorId,
Author: from.Author,
Title: from.Title,
Images: from.Images,
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
TargetUser: domain.ArticleTarget(from.TargetUser),
CountLove: from.CountLove,
CountComment: from.CountComment,
Tags: from.Tags,
Show: domain.ArticleShow(from.Show),
}
return to, nil
}
func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (*models.Article, error) {
to := &models.Article{}
err := copier.Copy(to, from)
return to, err
to := &models.Article{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
AuthorId: from.AuthorId,
Author: from.Author,
Title: from.Title,
Images: from.Images,
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
TargetUser: int(from.TargetUser),
CountLove: from.CountLove,
CountComment: from.CountComment,
Tags: from.Tags,
Show: int(from.Show),
}
// err := copier.Copy(to, from)
return to, nil
}
func NewArticleRepository(cache *cache.CachedRepository) domain.ArticleRepository {
... ...
... ... @@ -3,7 +3,6 @@ package repository
import (
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/tiptok/gocomm/pkg/cache"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models"
... ... @@ -142,15 +141,37 @@ func (repository *ArticleSectionRepository) Find(ctx context.Context, conn trans
}
func (repository *ArticleSectionRepository) ModelToDomainModel(from *models.ArticleSection) (*domain.ArticleSection, error) {
to := &domain.ArticleSection{}
err := copier.Copy(to, from)
return to, err
to := &domain.ArticleSection{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
ArticleId: from.ArticleId,
Content: from.Content,
SortBy: from.SortBy,
TotalComment: from.TotalComment,
}
// err := copier.Copy(to, from)
return to, nil
}
func (repository *ArticleSectionRepository) DomainModelToModel(from *domain.ArticleSection) (*models.ArticleSection, error) {
to := &models.ArticleSection{}
err := copier.Copy(to, from)
return to, err
to := &models.ArticleSection{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
ArticleId: from.ArticleId,
Content: from.Content,
SortBy: from.SortBy,
TotalComment: from.TotalComment,
}
// err := copier.Copy(to, from)
return to, nil
}
func NewArticleSectionRepository(cache *cache.CachedRepository) domain.ArticleSectionRepository {
... ...
... ... @@ -3,7 +3,6 @@ package repository
import (
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"github.com/tiptok/gocomm/pkg/cache"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/models"
... ... @@ -142,15 +141,33 @@ func (repository *UserLoveFlagRepository) Find(ctx context.Context, conn transac
}
func (repository *UserLoveFlagRepository) ModelToDomainModel(from *models.UserLoveFlag) (*domain.UserLoveFlag, error) {
to := &domain.UserLoveFlag{}
err := copier.Copy(to, from)
return to, err
to := &domain.UserLoveFlag{
Id: from.Id,
ArticleId: from.ArticleId,
CommentId: from.CommentId,
UserId: from.UserId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
}
// err := copier.Copy(to, from)
return to, nil
}
func (repository *UserLoveFlagRepository) DomainModelToModel(from *domain.UserLoveFlag) (*models.UserLoveFlag, error) {
to := &models.UserLoveFlag{}
err := copier.Copy(to, from)
return to, err
to := &models.UserLoveFlag{
Id: from.Id,
ArticleId: from.ArticleId,
CommentId: from.CommentId,
UserId: from.UserId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
}
// err := copier.Copy(to, from)
return to, nil
}
func NewUserLoveFlagRepository(cache *cache.CachedRepository) domain.UserLoveFlagRepository {
... ...
... ... @@ -15,7 +15,7 @@ type Article struct {
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
AuthorId int64 `json:"authorId"` // 发布人
Author User `json:"author"` // 发布人
Author UserSimple `json:"author"` // 发布人
Title string `json:"title"` // 文章标题
Images []Image `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
... ...
... ... @@ -8,20 +8,21 @@ import (
// 编辑文章后保存的历史记录
type ArticleBackup struct {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId"`
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
Operator UserSimple `json:"operator"` // 操作人
Title string `json:"title"` // 标题
Section []ArticleSection `json:"section"` // 分段内容
Images []Image `json:"images"` // 图片
Action string `json:"action"` // 操作
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Tags []int `json:"tags"` // 标签
Id int64 `json:"id"`
CompanyId int64 `json:"companyId"`
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
Operator UserSimple `json:"operator"` // 操作人
Title string `json:"title"` // 标题
Section []ArticleSection `json:"section"` // 分段内容
Images []Image `json:"images"` // 图片
Action string `json:"action"` // 操作
TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Tags []int `json:"tags"` // 标签
}
type ArticleBackupRepository interface {
... ...
... ... @@ -20,9 +20,9 @@ type ArticleComment struct {
ArticleSectionId int64 `json:"articleSectionId"` // 文本内容id
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
FromUserId int64 `json:"fromUserId"` // 谁填写的评论
FromUser User `json:"fromUser"` // 谁填写的评论
FromUser UserSimple `json:"fromUser"` // 谁填写的评论
ToUserId int64 `json:"toUserId"` // 回复谁的评论
ToUser User `json:"toUser"` // 回复谁的评论
ToUser UserSimple `json:"toUser"` // 回复谁的评论
Content string `json:"content"` // 评论内容
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
... ...
... ... @@ -29,8 +29,9 @@ type Opinion struct {
}
type UserSimple struct {
Id int64 // 人员id
Name string // 人员的名字
Avatar string // 人员头像URL
Group string // 人员的分组
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar,omitempty"` // 人员头像URL
Group string `json:"group,omitempty"` // 人员的分组
Position string `json:"position,omitempty"` // 职位
}
... ...
... ... @@ -4,13 +4,13 @@ package domain
// 浏览记录
type UserReadArticle struct {
Id int64 `json:"id"`
UserId int64 `json:"userId"`
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
Author User `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
Id int64 `json:"id"`
UserId int64 `json:"userId"`
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
Author UserSimple `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
}
... ...