LinkinStars commented on code in PR #1070:
URL: https://github.com/apache/incubator-answer/pull/1070#discussion_r1741361032


##########
internal/service/content/question_service.go:
##########
@@ -1348,6 +1356,47 @@ func (qs *QuestionService) GetQuestionPage(ctx 
context.Context, req *schema.Ques
        return questions, total, nil
 }
 
+// GetRecommendQuestionPage retrieves recommended question page based on 
following tags and questions.
+func (qs *QuestionService) GetRecommendQuestionPage(ctx context.Context, req 
*schema.QuestionPageReq) (
+       questions []*schema.QuestionPageResp, total int64, err error) {
+       followingTagsResp, err := qs.tagService.GetFollowingTags(ctx, 
req.LoginUserID)

Review Comment:
   When the user is not logged in, that the LoginUserID is empty, empty data 
can be returned directly. Otherwise, in the scenario of using pg, an error will 
occur when the user directly accesses the page `/questions?order=recommend`.
   
   ```go
   2024-09-03 10:25:48.627 ERROR   handler/handler.go:53   code: 500, reason: 
base.database_error, message: , error: pq: invalid input syntax for type 
bigint: ""
   incubator-answer/internal/repo/activity_common/activity_repo.go:118 
github.com/apache/incubator-answer/internal/repo/activity_common.(*ActivityRepo).GetUserActivitysByActivityType
   incubator-answer/internal/service/content/question_service.go:1375 
github.com/apache/incubator-answer/internal/service/content.(*QuestionService).GetRecommendQuestionPage
   incubator-answer/internal/controller/question_controller.go:350 
github.com/apache/incubator-answer/internal/controller.(*QuestionController).QuestionRecommendPage
   go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 
github.com/gin-gonic/gin.(*Context).Next
   incubator-answer/internal/base/middleware/auth.go:88 
github.com/apache/incubator-answer/internal/base/server.NewHTTPServer.(*AuthUserMiddleware).EjectUserBySiteInfo.func9
   go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 
github.com/gin-gonic/gin.(*Context).Next
   incubator-answer/internal/base/middleware/auth.go:64 
github.com/apache/incubator-answer/internal/base/server.NewHTTPServer.(*AuthUserMiddleware).Auth.func8
   go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 
github.com/gin-gonic/gin.(*Context).Next
   
go/pkg/mod/github.com/anargu/[email protected]/gin_brotli.go:71
 
github.com/apache/incubator-answer/internal/base/server.NewHTTPServer.Brotli.func3
   go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 
github.com/gin-gonic/gin.(*Context).Next
   go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
   go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 
github.com/gin-gonic/gin.(*Engine).ServeHTTP
   /usr/local/go/src/net/http/server.go:3137 net/http.serverHandler.ServeHTTP
   /usr/local/go/src/net/http/server.go:2039 net/http.(*conn).serve
   /usr/local/go/src/runtime/asm_arm64.s:1222 runtime.goexit
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to