// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1

package topic

import (
	"context"

	"github.com/zeromicro/go-zero/core/logx"
	"sundynix-micro-go/app/plant/api/internal/svc"
	"sundynix-micro-go/app/plant/rpc/plant"
)

type GetTopicListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 话题列表
func NewGetTopicListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTopicListLogic {
	return &GetTopicListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *GetTopicListLogic) GetTopicList() (interface{}, error) {
	result, err := l.svcCtx.PlantRpc.GetTopicList(l.ctx, &plant.IdReq{})
	if err != nil {
		return nil, err
	}
	return map[string]interface{}{"list": result.List}, nil
}
