sso

index_controller.go 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. this.SetTpl("new_main/about.html")
  53. }
  54. func (this *IndexController) Help() {
  55. this.SetTpl("new_main/help.html")
  56. }