package controllers import ( "strings" "github.com/astaxie/beego" ) type IndexController struct { BaseController } // / [get] func (this *IndexController) Index() { mobileAgents := []string{"Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser"} isFromMobile := false userAgent := this.Ctx.Request.Header.Get("User-Agent") if !strings.Contains(userAgent, "Windows NT") || (strings.Contains(userAgent, "Windows NT") && strings.Contains(userAgent, "compatible; MSIE 9.0;")) { if !strings.Contains(userAgent, "Windows NT") && !strings.Contains(userAgent, "Macintosh") { for _, mobileAgent := range mobileAgents { if strings.Contains(userAgent, mobileAgent) { isFromMobile = true break } } } } if isFromMobile { this.SetTpl("mobile_site/index.html") } else { this.SetTpl("new_main/index.html") } } // /scrm [get] func (this *IndexController) SCRMIndex() { this.Data["module_url"] = beego.AppConfig.String("submodule_domain_patient_manage") this.SetTpl("new_main/scrm_index.html") } // /mmall [get] func (this *IndexController) MircoMallIndex() { this.Data["module_url"] = beego.AppConfig.String("submodule_domain_mall_manage") this.SetTpl("new_main/mircomall_index.html") } // /xt [get] func (this *IndexController) XTIndex() { this.Data["module_url"] = beego.AppConfig.String("submodule_domain_dialysis_manage") this.SetTpl("new_main/xt_index.html") } // /cdm [get] func (this *IndexController) CDMIndex() { this.Data["module_url"] = beego.AppConfig.String("submodule_domain_cdm_manage") this.SetTpl("new_main/cdm_index.html") } // /about [get] func (this *IndexController) AboutUs() { this.SetTpl("new_main/about.html") }