server.go 934 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package core
  2. import (
  3. "fmt"
  4. "time"
  5. "github.com/flipped-aurora/gin-vue-admin/server/global"
  6. "github.com/flipped-aurora/gin-vue-admin/server/initialize"
  7. "go.uber.org/zap"
  8. )
  9. type server interface {
  10. ListenAndServe() error
  11. }
  12. func RunWindowsServer() {
  13. if global.GVA_CONFIG.System.UseMultipoint {
  14. // 初始化redis服务
  15. initialize.Redis()
  16. }
  17. Router := initialize.Routers()
  18. //初始化微信公众号服务
  19. initialize.Wechat()
  20. Router.Static("/form-generator", "./resource/page")
  21. address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
  22. s := initServer(address, Router)
  23. // 保证文本顺序输出
  24. // In order to ensure that the text order output can be deleted
  25. time.Sleep(10 * time.Microsecond)
  26. global.GVA_LOG.Info("server run success on ", zap.String("address", address))
  27. fmt.Printf(`
  28. 欢迎使用 cc
  29. 当前版本:V2.4.5 alpha
  30. 微信号:zk1006
  31. `)
  32. global.GVA_LOG.Error(s.ListenAndServe().Error())
  33. }