...
|
...
|
@@ -2,11 +2,10 @@ package message |
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
|
|
|
)
|
|
|
|
|
|
type MiniSystemLogic struct {
|
...
|
...
|
@@ -23,8 +22,37 @@ func NewMiniSystemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniSy |
|
|
}
|
|
|
}
|
|
|
|
|
|
func (l *MiniSystemLogic) MiniSystem(req *types.MessageSystemRequest) (resp *types.MessageBusinessResponse, err error) {
|
|
|
// todo: add your logic here and delete this line
|
|
|
func (l *MiniSystemLogic) MiniSystem(req *types.MessageSystemRequest) (resp *types.MessageSystemResponse, err error) {
|
|
|
queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size)
|
|
|
total, list, err := l.svcCtx.MessageSystemRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), queryOptions)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
resp = &types.MessageSystemResponse{}
|
|
|
resp.Total = total
|
|
|
resp.List = make([]types.MessageSystemItem, 0)
|
|
|
for _, item := range list {
|
|
|
to := types.MessageSystemItem{
|
|
|
Id: item.Id,
|
|
|
Type: item.Type,
|
|
|
Title: item.Title,
|
|
|
Content: item.Content,
|
|
|
CreatedAt: item.CreatedAt,
|
|
|
}
|
|
|
resp.List = append(resp.List, to)
|
|
|
}
|
|
|
return resp, nil
|
|
|
}
|
|
|
|
|
|
return
|
|
|
func (l *MiniSystemLogic) CreateMessage(dm *domain.MessageSystem) error {
|
|
|
_, err := l.svcCtx.MessageSystemRepository.Insert(l.ctx, l.svcCtx.DefaultDBConn(), dm)
|
|
|
l.Debugf("")
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
//// CreateSystemMessage 生成一条信息
|
|
|
//func CreateSystemMessage(ctx context.Context, svcCtx *svc.ServiceContext, dm *domain.MessageSystem) error {
|
|
|
// l := NewMiniSystemLogic(ctx, svcCtx)
|
|
|
// err := l.CreateMessage(dm)
|
|
|
// return err
|
|
|
//} |
...
|
...
|
|