MainController.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. namespace pt\controllers;
  3. use biz\pt\classes\AgreementClass;
  4. use common\components\util;
  5. use Yii;
  6. use common\services\xhWxOpenAdminService;
  7. class MainController extends PlatformController
  8. {
  9. public $guestAccess = ['login', 'logout', 'check-login', 'index', 'app', 'xhb-privacy', 'xhb-register', 'xhb-user-privacy','hzg-privacy', 'hzg-register'];
  10. public function actionApp()
  11. {
  12. return $this->renderPartial('app');
  13. }
  14. public function actionIndex()
  15. {
  16. $host = Yii::$app->request->getHostInfo();
  17. $name = '花掌柜';
  18. $bei = '闽ICP备15017325号-1';
  19. if (strstr($host, 'hzghd') !== false) {
  20. $name = '花惠宝';
  21. $bei = '闽ICP备15017325号-1';
  22. }
  23. if (strstr($host, 'theflorist') !== false) {
  24. $name = '花掌柜';
  25. $bei = '闽ICP备15017325号-2';
  26. }
  27. if (strstr($host, 'huaml') !== false) {
  28. $name = '花美丽';
  29. $bei = '闽ICP备15017325号-3';
  30. }
  31. if (strstr($host, 'zhhinc') !== false) {
  32. $name = '中花汇';
  33. $bei = '闽ICP备15017325号-4';
  34. }
  35. if (strstr($host, 'huahb.com') !== false) {
  36. $name = '花掌柜';
  37. $bei = '闽ICP备15017325号-5';
  38. }
  39. if (strstr($host, 'huahb.cn') !== false) {
  40. $name = '花掌柜';
  41. $bei = '闽ICP备15017325号-6';
  42. }
  43. if (strstr($host, 'zhiguanhua.cn') !== false) {
  44. $name = '花掌柜';
  45. $bei = '闽ICP备15017325号-7';
  46. }
  47. if (strstr($host, 'huadianbao.net') !== false) {
  48. $name = '花掌柜';
  49. $bei = '闽ICP备15017325号-8';
  50. }
  51. if (strstr($host, 'wixhb.com') !== false) {
  52. $name = '销花宝';
  53. $bei = '闽ICP备15017325号-9';
  54. }
  55. if (strstr($host, 'wixhb.cn') !== false) {
  56. $name = '花掌柜';
  57. $bei = '闽ICP备15017325号-10';
  58. }
  59. $this->layout = false;
  60. return $this->render('index', ['name' => $name, 'bei' => $bei]);
  61. }
  62. public function actionLogout()
  63. {
  64. xhWxOpenAdminService::logout();//不注销所有的 用户会话数据
  65. $this->redirect(['main/login']);
  66. }
  67. public function actionCheckLogin()
  68. {
  69. $request = Yii::$app->request;
  70. $mobile = $request->post('mobile');
  71. $password = $request->post('password');
  72. $return = xhWxOpenAdminService::loginByMobile($mobile, $password, true);//true 自动登陆
  73. if ($return) {
  74. util::complete('success');
  75. }
  76. util::fail('帐号或密码错误');
  77. }
  78. public function actionRunning()
  79. {
  80. return $this->render('running');
  81. }
  82. public function actionBook()
  83. {
  84. return $this->render('book');
  85. }
  86. //隐私协议
  87. public function actionXhbPrivacy()
  88. {
  89. AgreementClass::xhbPrivacy();
  90. exit();
  91. }
  92. //隐私协议(OPPO隐私协议链接改了之后此方法可删)
  93. public function actionXhbUserPrivacy()
  94. {
  95. AgreementClass::xhbPrivacy();
  96. exit();
  97. }
  98. //服务协议
  99. public function actionXhbRegister()
  100. {
  101. AgreementClass::xhbRegister();
  102. exit();
  103. }
  104. public function actionHzgPrivacy()
  105. {
  106. AgreementClass::hzgPrivacy();
  107. exit();
  108. }
  109. public function actionHzgRegister()
  110. {
  111. AgreementClass::hzgRegister();
  112. exit();
  113. }
  114. }