cardlibrary.go 745 B

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