广告涉及的mq都放这里
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 1 месец
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package main
  2. import (
  3. "applet/app/cfg"
  4. "applet/app/utils"
  5. "applet/app/utils/logx"
  6. "applet/consume"
  7. db "code.fnuoos.com/zhimeng/model.git/src"
  8. "os"
  9. "os/signal"
  10. "syscall"
  11. )
  12. // 系统初始化
  13. func init() {
  14. cfg.InitCfg() //配置初始化
  15. cfg.InitMq() //配置
  16. cfg.InitLog() //日志初始化
  17. cfg.InitCache() //缓存初始化
  18. if cfg.Debug { //判断是否是debug
  19. if err := db.InitDB(cfg.DB); err != nil { //主数据库初始化
  20. panic(err)
  21. }
  22. channel := make(chan int, 0) //开辟管道,缓冲为
  23. go db.InitDBs(channel)
  24. <-channel
  25. }
  26. }
  27. func main() {
  28. if cfg.CurlDebug {
  29. utils.CurlDebug = true
  30. }
  31. go func() {
  32. // 初始化
  33. consume.Init()
  34. consume.Run()
  35. }()
  36. quit := make(chan os.Signal)
  37. signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
  38. <-quit
  39. _ = logx.Info("Server exiting...")
  40. }