main.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. set := map[string]interface{}{
  33. "$set": map[string]interface{}{
  34. "test.aa": "aa",
  35. },
  36. "$unset": map[string]interface{}{
  37. "test.cc": "",
  38. },
  39. }
  40. Mgo.UpdateById("test", "60f0e69c1a75b8f446056be1", set)
  41. //qu.Debug(SE.EncodeString("60b99c2d72c25c51c492af6a"))
  42. //return
  43. //go front.QuaFieldScore([]string{"buyer"},"zktest_data") //临时测试-质量
  44. //Mgo.UpdateById("test11", "61a9975a180a78e6edf8285d", map[string]interface{}{
  45. // "$inc": map[string]interface{}{
  46. // "count": -555,
  47. // },
  48. //})
  49. //success := false
  50. //msg := ""
  51. //successNum := int64(0)
  52. //s_departname, s_entname, s_rulename, importDataNum := front.ImportDataByColl("test", "615278a07f395572067fc599", &success, &msg, &successNum)
  53. //qu.Debug(s_departname, s_entname, s_rulename, importDataNum)
  54. //qu.Debug(success, msg, successNum)
  55. xweb.Run(":" + qu.ObjToString(Sysconfig["port"]))
  56. }