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