package controller import ( v1 "aiChat/api/v1" "aiChat/internal/model" "context" "fmt" "github.com/gogf/gf/v2/frame/g" ) var ( GuessQuestion = cGuessQuestion{} ) type cGuessQuestion struct{} func (c *cGuessQuestion) Method(ctx context.Context, req *v1.GuessQuestionReq) (res *v1.QuestionRes, err error) { session := model.SessionCtx.Get(ctx).JSession if session.AccountId <= 0 { return nil, fmt.Errorf("无用户身份") } var list []string list, err = model.Question.GetGuessQuestion(ctx, g.Config().MustGet(ctx, "chat.usuallyProblem", 5).Int()) return &v1.QuestionRes{Data: list}, nil }