payment.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package main
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/redis"
  5. "bet24.com/servers/monitor"
  6. "bet24.com/servers/payment/config"
  7. _ "bet24.com/servers/payment/crons"
  8. "bet24.com/servers/payment/db"
  9. "bet24.com/servers/payment/liu"
  10. "bet24.com/servers/payment/router"
  11. "bet24.com/utils"
  12. "fmt"
  13. "time"
  14. coreservice "bet24.com/servers/coreservice/client"
  15. )
  16. func main() {
  17. //defer log.PanicHandler("payment")
  18. config.Run()
  19. redis.InitPool(config.Server.ChannelUrl, config.Server.ChannelPassword, config.Server.RedisDB)
  20. coreservice.SetServiceAddr(config.Server.ServiceAddr)
  21. db.Run()
  22. // liu.Run()
  23. go waitInput()
  24. //监控
  25. monitor.Run(config.Server.MonitorPort, config.Server.LogPath)
  26. //定时器
  27. //go crons.Run()
  28. log.Release("Server started %v", time.Now())
  29. utils.SetConsoleTitle(fmt.Sprintf("payment port:%d monitor:%d", config.Server.TlsPort, config.Server.MonitorPort))
  30. //gin 路由
  31. router.Run()
  32. }
  33. func waitInput() {
  34. for {
  35. var cmd string
  36. var param1 string
  37. var param2 string
  38. fmt.Scanf("%s %s %s", &cmd, &param1, &param2)
  39. switch cmd {
  40. case "":
  41. case "queue":
  42. liu.Dump(param1, param2)
  43. case "exit":
  44. return
  45. default:
  46. log.Release("unknown command1")
  47. }
  48. }
  49. }