package main import ( "app.yhyue.com/moapp/jybase/common" "app.yhyue.com/moapp/jybase/go-xweb/xweb" "app.yhyue.com/moapp/jybase/log" "app.yhyue.com/moapp/jybase/mail" "app.yhyue.com/moapp/jybase/redis" "cmplatform/client" _ "cmplatform/filter" "cmplatform/front" "cmplatform/history" "cmplatform/push" "cmplatform/service" "cmplatform/util" "fmt" "time" ) func init() { common.ReadConfig(&util.Sysconfig) //初始化配置 util.InitMgoPool() //初始化连接 util.InitOther() //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.AddAction(&service.Rule{}) xweb.AddAction(&service.Feedback{}) xweb.AddAction(&service.Private{}) xweb.AddAction(&service.Customer{}) xweb.AddAction(&service.SecondPush{}) xweb.AddAction(&service.EntData{}) xweb.AddAction(&history.HistoryData{}) xweb.AddAction(&client.Client{}) xweb.AddAction(&client.OwnTag{}) xweb.AddAction(&client.CustomerRule{}) xweb.AddAction(&service.DataStatistics{}) xweb.AddAction(&push.Push{}) xweb.AddAction(&service.Groups{}) xweb.RootApp().AppConfig.SessionTimeout = 24 * time.Hour xweb.RootApp().Logger.SetOutputLevel(1) go history.SaveMgo() go history.SaveUsermailMgo() mails, _ := util.Sysconfig["mail"].([]interface{}) if len(mails) > 0 { history.Gmails = make([]*mail.GmailAuth, len(mails)) for k, v1 := range mails { v, _ := v1.(map[string]interface{}) history.Gmails[k] = &mail.GmailAuth{ SmtpHost: common.ObjToString(v["addr"]), SmtpPort: common.IntAll(v["port"]), User: common.ObjToString(v["user"]), Pwd: common.ObjToString(v["pwd"]), } } } initOther() redis.Del("datag", "jyqyfw_es_query") } func initOther() { for _, v := range util.Sysconfig["project_appid"].([]interface{}) { history.ProjectAppidMap[v.(string)] = true } for _, s := range util.Sysconfig["filetext_appid"].([]interface{}) { history.FileTextAppidMap[s.(string)] = true } for _, s := range util.Sysconfig["checkbidopen_appid"].([]interface{}) { history.CheckBidOpenAppidMap[s.(string)] = true } for _, v := range util.Sysconfig["checkbidhref_ruleid"].([]interface{}) { history.CheckBidHrefRuleIdMap[v.(string)] = true } for _, v := range util.Sysconfig["dis_package_appid"].([]interface{}) { history.DisPackageAppidMap[v.(string)] = true } for _, v := range util.Sysconfig["need_projectid_appid"].([]interface{}) { history.NeedProjectidAppidMap[v.(string)] = true } for _, v := range util.Sysconfig["filter_filehref_appid"].([]interface{}) { history.FilterFilehrefAppidMap[v.(string)] = true } for _, v := range util.Sysconfig["need_filehref_appid"].([]interface{}) { history.NeedFilehrefAppidMap[v.(string)] = true } for _, v := range util.Sysconfig["Henan_mobile_winbid"].([]interface{}) { history.HenanMobileWinbidMap[v.(string)] = true } for _, v := range util.Sysconfig["Henan_mobile_bidtype"].([]interface{}) { history.HenanMobileBidtypeMap[v.(string)] = true } for _, v := range util.Sysconfig["filter_file_and_detail"].([]interface{}) { history.FilterFileAndDetailMap[v.(string)] = true } for _, v := range util.Sysconfig["filter_owner_appid"].([]interface{}) { history.FilterOwnerMap[v.(string)] = true } } func main() { log.Debug("port:" + fmt.Sprint(util.Sysconfig["port"])) xweb.Run(":" + common.ObjToString(util.Sysconfig["port"])) }