智慧食堂-队列消费项目
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.

2 maanden geleden
2 maanden geleden
2 maanden geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package main
  2. import (
  3. "applet/app/cfg"
  4. "applet/app/db"
  5. "applet/app/utils"
  6. "applet/app/utils/logx"
  7. "applet/consume"
  8. "fmt"
  9. "os"
  10. "os/signal"
  11. "syscall"
  12. )
  13. // 系统初始化
  14. func init() {
  15. cfg.InitCfg() //配置初始化
  16. cfg.InitLog() //日志初始化
  17. cfg.InitCache() //缓存初始化
  18. cfg.InitMq() //队列初始化
  19. if cfg.Debug { //判断是否是debug
  20. if err := db.InitDB(cfg.DB); err != nil { //主数据库初始化
  21. panic(err)
  22. }
  23. }
  24. fmt.Println("init success")
  25. }
  26. func main() {
  27. if cfg.CurlDebug {
  28. utils.CurlDebug = true
  29. }
  30. go func() {
  31. // 初始化
  32. consume.Init()
  33. consume.Run()
  34. }()
  35. quit := make(chan os.Signal)
  36. signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
  37. <-quit
  38. _ = logx.Info("Server exiting...")
  39. }