2023-05-31 10:33:02 +00:00
|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-06-01 03:27:34 +00:00
|
|
|
"fusenapi/home-user-auth/internal/svc"
|
|
|
|
"fusenapi/home-user-auth/internal/types"
|
2023-06-05 09:56:55 +00:00
|
|
|
"fusenapi/model"
|
|
|
|
"fusenapi/utils/basic"
|
2023-05-31 10:33:02 +00:00
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
|
)
|
|
|
|
|
|
|
|
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-05 09:56:55 +00:00
|
|
|
func (l *UserFontsLogic) UserFonts(req *types.Request) (resp *types.Response) {
|
|
|
|
// 必须返回response, 前端需要的是内部约定的Code码, 处理相关的逻辑. 例子(eg): resp.Set(501, "error")
|
|
|
|
resp = &types.Response{}
|
|
|
|
|
|
|
|
data, err := model.NewFsFontModel(l.svcCtx.MysqlConn).FindAllOrderSortByDesc(l.ctx)
|
2023-06-01 04:15:36 +00:00
|
|
|
if err != nil {
|
|
|
|
// panic(err)
|
|
|
|
logx.Error(err)
|
2023-06-05 09:56:55 +00:00
|
|
|
resp.SetStatus(basic.StatusOK, data)
|
|
|
|
return resp
|
2023-06-01 04:15:36 +00:00
|
|
|
}
|
2023-06-05 09:56:55 +00:00
|
|
|
|
|
|
|
resp.SetStatus(basic.StatusOK)
|
|
|
|
return resp
|
2023-05-31 10:33:02 +00:00
|
|
|
}
|