2023-06-07 11:47:45 +00:00
|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2023-06-12 09:00:37 +00:00
|
|
|
"fusenapi/model/gmodel"
|
2023-06-08 03:03:20 +00:00
|
|
|
svc2 "fusenapi/server/data-transfer/internal/svc"
|
|
|
|
types2 "fusenapi/server/data-transfer/internal/types"
|
2023-06-12 09:00:37 +00:00
|
|
|
"fusenapi/utils/auth"
|
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-12 09:00:37 +00:00
|
|
|
func (l *GetStandardLogoListLogic) GetStandardLogoList(loginInfo *auth.UserInfo) (resp *types2.Response) {
|
|
|
|
standardLogoModel := gmodel.NewFsStandardLogoModel(l.svcCtx.MysqlConn)
|
2023-06-07 11:47:45 +00:00
|
|
|
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,
|
2023-06-12 09:00:37 +00:00
|
|
|
Name: *v.Name,
|
|
|
|
Url: *v.Image,
|
2023-06-07 11:47:45 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)
|
|
|
|
}
|