csfetchhistorychatlogic.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package logic
  2. import (
  3. "context"
  4. "github.com/pkg/errors"
  5. "google.golang.org/protobuf/types/known/structpb"
  6. "ylink/comm/result"
  7. "ylink/core/cmd/rpc/internal/svc"
  8. "ylink/core/cmd/rpc/pb"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type CsFetchHistoryChatLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewCsFetchHistoryChatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CsFetchHistoryChatLogic {
  17. return &CsFetchHistoryChatLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. func (l *CsFetchHistoryChatLogic) CsFetchHistoryChat(in *pb.CsFetchHistoryChatReq) (*pb.CsFetchHistoryChatResp, error) {
  24. list, err := structpb.NewList([]interface{}{
  25. map[string]interface{}{
  26. "player_id": "test1231",
  27. "player_name": "一条大菜狗",
  28. "player_avatar_url": "https://www.baidu.com",
  29. "game_id": "game1231",
  30. "game_name": "青云诀2",
  31. "update_time": "2022-04-27 17:01:40",
  32. },
  33. map[string]interface{}{
  34. "player_id": "test1111",
  35. "player_name": "高手",
  36. "player_avatar_url": "https://www.baidu.com",
  37. "game_id": "game1231",
  38. "game_name": "青云诀2",
  39. "update_time": "2022-04-27 17:01:40",
  40. },
  41. })
  42. if err != nil {
  43. return nil, errors.Wrap(result.NewErrMsg("fetch cs chat list error"), "")
  44. }
  45. return &pb.CsFetchHistoryChatResp{
  46. TotalPage: 1,
  47. CurrentPage: 1,
  48. List: list,
  49. }, nil
  50. }