12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 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() {
- 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/about.html")
- } else {
- this.SetTpl("new_main/about.html")
- }
- }
-
- func (this *IndexController) Help() {
- this.SetTpl("new_main/help.html")
- }
|