cssendmsglogic.go 792 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package logic
  2. import (
  3. "context"
  4. "ylink/comm/ctxdata"
  5. "ylink/core/cmd/rpc/cmd"
  6. "ylink/bff/cmdbff/api/internal/svc"
  7. "ylink/bff/cmdbff/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type CsSendMsgLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewCsSendMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CsSendMsgLogic {
  16. return &CsSendMsgLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *CsSendMsgLogic) CsSendMsg(req *types.CsSendMsgReq) error {
  23. csId := ctxdata.GetCsIdFromCtx(l.ctx)
  24. _, err := l.svcCtx.CmdRpc.CsSendMsg(l.ctx, &cmd.CsSendMsgReq{
  25. CsId: csId,
  26. PlayerId: req.PlayerId,
  27. GameId: req.GameId,
  28. Content: req.Content,
  29. Pic: req.Pic,
  30. })
  31. return err
  32. }