csfetchhistorymsglogic.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 CsFetchHistoryMsgLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewCsFetchHistoryMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CsFetchHistoryMsgLogic {
  17. return &CsFetchHistoryMsgLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. func (l *CsFetchHistoryMsgLogic) CsFetchHistoryMsg(in *pb.CsFetchHistoryMsgReq) (*pb.CsFetchHistoryMsgResp, error) {
  24. list, err := structpb.NewList([]interface{}{
  25. map[string]interface{}{
  26. "content": "你好呀,我是玩家",
  27. "pic": "https://www.baidu.com",
  28. "send_id": in.PlayerId,
  29. "receiver_id": in.CsId,
  30. "create_time": "2022-04-27 14:47:50",
  31. },
  32. map[string]interface{}{
  33. "content": "有个问题需要帮忙处理一下",
  34. "pic": "",
  35. "send_id": in.PlayerId,
  36. "receiver_id": in.CsId,
  37. "create_time": "2022-04-27 14:47:50",
  38. },
  39. })
  40. if err != nil {
  41. return nil, errors.Wrap(result.NewErrMsg("fetch cs history message list error"), "")
  42. }
  43. return &pb.CsFetchHistoryMsgResp{
  44. TotalPage: 1,
  45. CurrentPage: 1,
  46. List: list,
  47. }, nil
  48. }