36dc8e789688a53f3e6cb8eedd2c58532fadd9a5.svn-base 918 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package service
  2. import (
  3. "context"
  4. "log"
  5. )
  6. type CommentListVO struct {
  7. Id string
  8. CommentList []CommentVo
  9. }
  10. type CommentVo struct {
  11. Id string
  12. Desc string
  13. Score float32
  14. ReplyId string
  15. }
  16. type Service interface {
  17. GetCommentsList(ctx context.Context, id string) (CommentListVO, error)
  18. HealthCheck() string
  19. }
  20. func NewGoodsServiceImpl() Service {
  21. return &CommentsServiceImpl{}
  22. }
  23. type CommentsServiceImpl struct{}
  24. func (service *CommentsServiceImpl) GetCommentsList(ctx context.Context, id string) (CommentListVO, error) {
  25. comment1 := CommentVo{Id: "1", Desc: "comments", Score: 1.0, ReplyId: "0"}
  26. comment2 := CommentVo{Id: "2", Desc: "comments", Score: 1.0, ReplyId: "1"}
  27. list := []CommentVo{comment1, comment2}
  28. detail := CommentListVO{Id: id, CommentList: list}
  29. log.Printf(detail.Id)
  30. return detail, nil
  31. }
  32. func (service *CommentsServiceImpl) HealthCheck() string {
  33. return "OK"
  34. }