2023-05-31 10:33:02 +00:00
|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2023-06-20 09:29:02 +00:00
|
|
|
"errors"
|
2023-05-31 10:33:02 +00:00
|
|
|
|
2023-06-08 02:51:56 +00:00
|
|
|
"fusenapi/server/home-user-auth/internal/svc"
|
|
|
|
"fusenapi/server/home-user-auth/internal/types"
|
2023-06-12 07:17:42 +00:00
|
|
|
"fusenapi/utils/auth"
|
2023-06-05 09:56:55 +00:00
|
|
|
"fusenapi/utils/basic"
|
2023-05-31 10:33:02 +00:00
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
2023-06-15 08:08:43 +00:00
|
|
|
"gorm.io/gorm"
|
2023-05-31 10:33:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type UserFontsLogic struct {
|
|
|
|
logx.Logger
|
|
|
|
ctx context.Context
|
|
|
|
svcCtx *svc.ServiceContext
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewUserFontsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserFontsLogic {
|
|
|
|
return &UserFontsLogic{
|
|
|
|
Logger: logx.WithContext(ctx),
|
|
|
|
ctx: ctx,
|
|
|
|
svcCtx: svcCtx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-12 09:28:49 +00:00
|
|
|
func (l *UserFontsLogic) UserFonts(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
2023-06-21 06:26:29 +00:00
|
|
|
data, err := l.svcCtx.AllModels.FsFont.FindAllOrderSortByDesc(l.ctx)
|
2023-06-20 09:29:02 +00:00
|
|
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
2023-06-01 04:15:36 +00:00
|
|
|
logx.Error(err)
|
2023-06-19 07:52:14 +00:00
|
|
|
return resp.SetStatus(basic.CodeOK)
|
2023-06-01 04:15:36 +00:00
|
|
|
}
|
2023-06-19 07:52:14 +00:00
|
|
|
return resp.SetStatus(basic.CodeOK, data)
|
2023-05-31 10:33:02 +00:00
|
|
|
}
|