sso

index_controller.go 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. if isFromMobile {
  25. this.SetTpl("mobile_site/index.html")
  26. } else {
  27. this.SetTpl("new_main/index.html")
  28. }
  29. }
  30. // /scrm [get]
  31. func (this *IndexController) SCRMIndex() {
  32. this.Data["module_url"] = beego.AppConfig.String("submodule_domain_patient_manage")
  33. this.SetTpl("new_main/scrm_index.html")
  34. }
  35. // /mmall [get]
  36. func (this *IndexController) MircoMallIndex() {
  37. this.Data["module_url"] = beego.AppConfig.String("submodule_domain_mall_manage")
  38. this.SetTpl("new_main/mircomall_index.html")
  39. }
  40. // /xt [get]
  41. func (this *IndexController) XTIndex() {
  42. this.Data["module_url"] = beego.AppConfig.String("submodule_domain_dialysis_manage")
  43. this.SetTpl("new_main/xt_index.html")
  44. }
  45. // /cdm [get]
  46. func (this *IndexController) CDMIndex() {
  47. this.Data["module_url"] = beego.AppConfig.String("submodule_domain_cdm_manage")
  48. this.SetTpl("new_main/cdm_index.html")
  49. }
  50. // /about [get]
  51. func (this *IndexController) AboutUs() {
  52. mobileAgents := []string{"Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser"}
  53. isFromMobile := false
  54. userAgent := this.Ctx.Request.Header.Get("User-Agent")
  55. if !strings.Contains(userAgent, "Windows NT") || (strings.Contains(userAgent, "Windows NT") && strings.Contains(userAgent, "compatible; MSIE 9.0;")) {
  56. if !strings.Contains(userAgent, "Windows NT") && !strings.Contains(userAgent, "Macintosh") {
  57. for _, mobileAgent := range mobileAgents {
  58. if strings.Contains(userAgent, mobileAgent) {
  59. isFromMobile = true
  60. break
  61. }
  62. }
  63. }
  64. }
  65. if isFromMobile {
  66. this.SetTpl("mobile_site/about.html")
  67. } else {
  68. this.SetTpl("new_main/about.html")
  69. }
  70. }
  71. func (this *IndexController) Help() {
  72. this.SetTpl("new_main/help.html")
  73. }