main.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package main
  2. import (
  3. _ "filter"
  4. qu "qfw/util"
  5. "time"
  6. "front"
  7. . "util"
  8. "github.com/go-xweb/xweb"
  9. )
  10. func init() {
  11. qu.ReadConfig(&Sysconfig) //初始化config
  12. qu.ReadConfig("./web/qua_res/qua_config.json", &Quaconfig)
  13. InitConfig() //初始化连接
  14. InitOss()
  15. //xweb框架配置
  16. xweb.Config.RecoverPanic = true
  17. xweb.Config.Profiler = true
  18. xweb.RootApp().AppConfig.TemplateDir = "web/templates"
  19. xweb.RootApp().AppConfig.StaticDir = "web/res"
  20. xweb.RootApp().AppConfig.StaticFileVersion = false
  21. xweb.RootApp().AppConfig.CheckXsrf = false
  22. xweb.RootApp().AppConfig.ReloadTemplates = true
  23. xweb.RootApp().AppConfig.EnableHttpCache = false
  24. xweb.RootApp().AppConfig.Mode = xweb.Product
  25. xweb.RootApp().AppConfig.CacheTemplates = false
  26. xweb.AddAction(&front.Front{})
  27. xweb.RootApp().AppConfig.SessionTimeout = 1 * time.Hour
  28. xweb.RootApp().Logger.SetOutputLevel(4)
  29. //xweb.AddTmplVar("add", func(a, b int) int { return a + b })
  30. }
  31. func main() {
  32. //qu.Debug(SE.EncodeString("5c0a207ca5cb26b9b76ce197"))
  33. //return
  34. //go front.QuaFieldScore([]string{"buyer"},"zktest_data") //临时测试-质量
  35. //Mgo.UpdateById("test11", "61a9975a180a78e6edf8285d", map[string]interface{}{
  36. // "$inc": map[string]interface{}{
  37. // "count": -555,
  38. // },
  39. //})
  40. //success := false
  41. //msg := ""
  42. //successNum := int64(0)
  43. //s_departname, s_entname, s_rulename, importDataNum := front.ImportDataByColl("test", "615278a07f395572067fc599", &success, &msg, &successNum)
  44. //qu.Debug(s_departname, s_entname, s_rulename, importDataNum)
  45. //qu.Debug(success, msg, successNum)
  46. xweb.Run(":" + qu.ObjToString(Sysconfig["port"]))
  47. }