fusenapi/server/data-transfer/internal/logic/getstandardlogolistlogic.go

45 lines
1.2 KiB
Go
Raw Normal View History

2023-06-07 11:47:45 +00:00
package logic
import (
"context"
"fusenapi/model"
2023-06-08 03:03:20 +00:00
svc2 "fusenapi/server/data-transfer/internal/svc"
types2 "fusenapi/server/data-transfer/internal/types"
2023-06-07 11:47:45 +00:00
"fusenapi/utils/basic"
"github.com/zeromicro/go-zero/core/logx"
)
type GetStandardLogoListLogic struct {
logx.Logger
ctx context.Context
2023-06-08 03:03:20 +00:00
svcCtx *svc2.ServiceContext
2023-06-07 11:47:45 +00:00
}
2023-06-08 03:03:20 +00:00
func NewGetStandardLogoListLogic(ctx context.Context, svcCtx *svc2.ServiceContext) *GetStandardLogoListLogic {
2023-06-07 11:47:45 +00:00
return &GetStandardLogoListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 获取标准logo列表
2023-06-08 03:03:20 +00:00
func (l *GetStandardLogoListLogic) GetStandardLogoList() (resp *types2.Response) {
2023-06-07 11:47:45 +00:00
standardLogoModel := model.NewFsStandardLogoModel(l.svcCtx.MysqlConn)
logoList, err := standardLogoModel.GetAll(l.ctx)
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get standard logo list")
}
2023-06-08 03:03:20 +00:00
list := make([]types2.GetStandardLogoListRsp, 0, len(logoList))
2023-06-07 11:47:45 +00:00
for _, v := range logoList {
2023-06-08 03:03:20 +00:00
list = append(list, types2.GetStandardLogoListRsp{
2023-06-07 11:47:45 +00:00
Id: v.Id,
Name: v.Name,
Url: v.Image,
})
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)
}