package logic import ( "context" "fusenapi/data-transfer/internal/svc" "fusenapi/data-transfer/internal/types" "fusenapi/model" "fusenapi/utils/basic" "github.com/zeromicro/go-zero/core/logx" ) type GetStandardLogoListLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewGetStandardLogoListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStandardLogoListLogic { return &GetStandardLogoListLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } // 获取标准logo列表 func (l *GetStandardLogoListLogic) GetStandardLogoList() (resp *types.Response) { 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") } list := make([]types.GetStandardLogoListRsp, 0, len(logoList)) for _, v := range logoList { list = append(list, types.GetStandardLogoListRsp{ Id: v.Id, Name: v.Name, Url: v.Image, }) } return resp.SetStatusWithMessage(basic.CodeOK, "success", list) }