playerfetchhistorymsglogic.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 PlayerFetchHistoryMsgLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewPlayerFetchHistoryMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PlayerFetchHistoryMsgLogic {
  17. return &PlayerFetchHistoryMsgLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. func (l *PlayerFetchHistoryMsgLogic) PlayerFetchHistoryMsg(in *pb.PlayerFetchHistoryMsgReq) (*pb.PlayerFetchHistoryMsgResp, error) {
  24. // todo 查询db下自己对应客服下的信息
  25. list, err := structpb.NewList([]interface{}{
  26. map[string]interface{}{
  27. "content": "你好呀,我是玩家",
  28. "pic": "https://www.baidu.com",
  29. "send_id": "test1231",
  30. "receiver_id": "cs1231",
  31. "create_time": "2022-04-27 14:47:50",
  32. },
  33. map[string]interface{}{
  34. "content": "你好呀,我是客服",
  35. "pic": "",
  36. "send_id": "cs1231",
  37. "receiver_id": "test1231",
  38. "create_time": "2022-04-27 14:47:50",
  39. },
  40. })
  41. if err != nil {
  42. return nil, errors.Wrap(result.NewErrMsg("fetch history message list error"), "")
  43. }
  44. return &pb.PlayerFetchHistoryMsgResp{
  45. TotalPage: in.Page,
  46. CurrentPage: in.Page,
  47. List: list,
  48. }, nil
  49. }