package main

import (
	_ "filter"
	qu "qfw/util"
	"time"

	"front"
	. "util"

	"github.com/go-xweb/xweb"
)

func init() {
	qu.ReadConfig(&Sysconfig) //初始化config
	qu.ReadConfig("./web/qua_res/qua_config.json", &Quaconfig)
	InitConfig() //初始化连接
	InitOss()
	//xweb框架配置
	xweb.Config.RecoverPanic = true
	xweb.Config.Profiler = true
	xweb.RootApp().AppConfig.TemplateDir = "web/templates"
	xweb.RootApp().AppConfig.StaticDir = "web/res"
	xweb.RootApp().AppConfig.StaticFileVersion = false
	xweb.RootApp().AppConfig.CheckXsrf = false
	xweb.RootApp().AppConfig.ReloadTemplates = true
	xweb.RootApp().AppConfig.EnableHttpCache = false
	xweb.RootApp().AppConfig.Mode = xweb.Product
	xweb.RootApp().AppConfig.CacheTemplates = false
	xweb.AddAction(&front.Front{})
	xweb.RootApp().AppConfig.SessionTimeout = 1 * time.Hour
	xweb.RootApp().Logger.SetOutputLevel(4)
	//xweb.AddTmplVar("add", func(a, b int) int { return a + b })
}

func main() {
	//qu.Debug(SE.EncodeString("60b99c2d72c25c51c492af6a"))
	//return
	//go front.QuaFieldScore([]string{"buyer"},"zktest_data") //临时测试-质量
	//Mgo.UpdateById("test11", "61a9975a180a78e6edf8285d", map[string]interface{}{
	//	"$inc": map[string]interface{}{
	//		"count": -555,
	//	},
	//})
	//success := false
	//msg := ""
	//successNum := int64(0)
	//s_departname, s_entname, s_rulename, importDataNum := front.ImportDataByColl("test", "615278a07f395572067fc599", &success, &msg, &successNum)
	//qu.Debug(s_departname, s_entname, s_rulename, importDataNum)
	//qu.Debug(success, msg, successNum)
	xweb.Run(":" + qu.ObjToString(Sysconfig["port"]))
}
