package logic import ( "context" "lone-services/pkg/modelbase" "lone-services/pkg/utils" "lone-services/services/chore/internal/dao" "lone-services/services/chore/internal/model" "strconv" "lone-services/rpc/chore/pb" "lone-services/services/chore/internal/svc" "github.com/zeromicro/go-zero/core/logx" ) type ApiSystemItemsLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger BaseLogic } func NewApiSystemItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiSystemItemsLogic { return &ApiSystemItemsLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } func (l *ApiSystemItemsLogic) ApiSystemItems(in *chore.ApiSystemReq) (*chore.Response, error) { var info []dao.ApiSystemInfo w := modelbase.Params{} if in.Type > utils.NumberZero { w.Eq = make(map[string]string) w.Eq["type"] = strconv.Itoa(int(in.Type)) } err := model.SystemModel{}.Init().Items(w, &info) if err != nil { return l.fail(utils.ErrorNotFund) } return l.ok(info) }