money.go 768 B

1234567891011121314151617181920212223242526272829303132333435
  1. package main
  2. import (
  3. "fmt"
  4. "bet24.com/redis"
  5. "bet24.com/servers/micros/common"
  6. "bet24.com/servers/micros/money/config"
  7. "bet24.com/servers/micros/money/handler"
  8. pb "bet24.com/servers/micros/money/proto"
  9. )
  10. func main() {
  11. config.Run(pb.ServiceName)
  12. //go waitInput()
  13. redis.InitPool(config.Server.ChannelUrl, config.Server.ChannelPassword, config.Server.RedisDB)
  14. common.RunService(pb.ServiceName, handler.GetInstance(), fmt.Sprintf("localhost:%d", config.Server.ConsulPort))
  15. }
  16. func waitInput() {
  17. for {
  18. var cmd string
  19. var param1 string
  20. var param2 string
  21. fmt.Scanf("%s %s %s", &cmd, &param1, &param2)
  22. switch cmd {
  23. case "":
  24. break
  25. case "exit":
  26. common.DeregisterService(pb.ServiceName)
  27. default:
  28. handler.Dump(cmd, param1, param2)
  29. }
  30. }
  31. }