package logic import ( "context" "errors" "fusenapi/model/gmodel" "fusenapi/server/home-user-auth/internal/svc" "fusenapi/server/home-user-auth/internal/types" "fusenapi/utils/auth" "fusenapi/utils/basic" "github.com/zeromicro/go-zero/core/logx" "gorm.io/gorm" ) 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, } } func (l *UserFontsLogic) UserFonts(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) { data, err := gmodel.NewFsFontModel(l.svcCtx.MysqlConn).FindAllOrderSortByDesc(l.ctx) if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { logx.Error(err) return resp.SetStatus(basic.CodeOK) } return resp.SetStatus(basic.CodeOK, data) }