sso

index_controller.go 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. }