sso

index_controller.go 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package controllers
  2. import (
  3. "strings"
  4. "github.com/astaxie/beego"
  5. )
  6. type IndexController struct {
  7. BaseController
  8. }
  9. // / [get]
  10. func (this *IndexController) Index() {
  11. mobileAgents := []string{"Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser"}
  12. isFromMobile := false
  13. userAgent := this.Ctx.Request.Header.Get("User-Agent")
  14. if !strings.Contains(userAgent, "Windows NT") || (strings.Contains(userAgent, "Windows NT") && strings.Contains(userAgent, "compatible; MSIE 9.0;")) {
  15. if !strings.Contains(userAgent, "Windows NT") && !strings.Contains(userAgent, "Macintosh") {
  16. for _, mobileAgent := range mobileAgents {
  17. if strings.Contains(userAgent, mobileAgent) {
  18. isFromMobile = true
  19. break
  20. }
  21. }
  22. }
  23. }
  24. isFromMobile = true
  25. if isFromMobile {
  26. this.SetTpl("mobile_site/index.html")
  27. } else {
  28. this.SetTpl("new_main/index.html")
  29. }
  30. }
  31. // /scrm [get]
  32. func (this *IndexController) SCRMIndex() {
  33. this.Data["module_url"] = beego.AppConfig.String("submodule_domain_patient_manage")
  34. this.SetTpl("new_main/scrm_index.html")
  35. }
  36. // /mmall [get]
  37. func (this *IndexController) MircoMallIndex() {
  38. this.Data["module_url"] = beego.AppConfig.String("submodule_domain_mall_manage")
  39. this.SetTpl("new_main/mircomall_index.html")
  40. }
  41. // /xt [get]
  42. func (this *IndexController) XTIndex() {
  43. this.Data["module_url"] = beego.AppConfig.String("submodule_domain_dialysis_manage")
  44. this.SetTpl("new_main/xt_index.html")
  45. }
  46. // /cdm [get]
  47. func (this *IndexController) CDMIndex() {
  48. this.Data["module_url"] = beego.AppConfig.String("submodule_domain_cdm_manage")
  49. this.SetTpl("new_main/cdm_index.html")
  50. }
  51. // /about [get]
  52. func (this *IndexController) AboutUs() {
  53. this.SetTpl("new_main/about.html")
  54. }