server_keyword.go 595 B

123456789101112131415161718192021222324
  1. package service
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/coreservice/client"
  5. "bet24.com/servers/coreservice/keyword"
  6. "context"
  7. "encoding/json"
  8. "errors"
  9. )
  10. func (s *Server) ParseKeyword(ctx context.Context, args *client.Request, reply *client.Reply) error {
  11. var req client.KeyWord_req
  12. if err := json.Unmarshal([]byte(args.Data), &req); err != nil {
  13. log.Debug("Server.ParseKeyword unmarshal fail %v", err)
  14. return errors.New("unmarshal error")
  15. }
  16. req.Out = keyword.ParseKeyword(req.In)
  17. reply.Resp.RetCode = 1
  18. d, _ := json.Marshal(req)
  19. reply.Resp.Data = string(d)
  20. return nil
  21. }