MainController.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. namespace pt\controllers;
  3. use common\components\util;
  4. use Yii;
  5. use common\services\xhWxOpenAdminService;
  6. class MainController extends PlatformController
  7. {
  8. public $guestAccess = ['login', 'logout', 'check-login', 'index'];
  9. public function actionIndex()
  10. {
  11. $host = Yii::$app->request->getHostInfo();
  12. $name = '花掌柜';
  13. $bei = '闽ICP备15017325号-1';
  14. if (strstr($host, 'hzghd') !== false) {
  15. $name = '花掌柜';
  16. $bei = '闽ICP备15017325号-1';
  17. }
  18. if (strstr($host, 'theflorist') !== false) {
  19. $name = '花掌柜';
  20. $bei = '闽ICP备15017325号-2';
  21. }
  22. if (strstr($host, 'huaml') !== false) {
  23. $name = '花美利';
  24. $bei = '闽ICP备15017325号-3';
  25. }
  26. if (strstr($host, 'zhhinc') !== false) {
  27. $name = '中花汇';
  28. $bei = '闽ICP备15017325号-4';
  29. }
  30. if (strstr($host, 'huahb.com') !== false) {
  31. $name = '花掌柜';
  32. $bei = '闽ICP备15017325号-5';
  33. }
  34. if (strstr($host, 'huahb.cn') !== false) {
  35. $name = '花掌柜';
  36. $bei = '闽ICP备15017325号-6';
  37. }
  38. if (strstr($host, 'zhiguanhua.cn') !== false) {
  39. $name = '花掌柜';
  40. $bei = '闽ICP备15017325号-7';
  41. }
  42. if (strstr($host, 'huadianbao.net') !== false) {
  43. $name = '花掌柜';
  44. $bei = '闽ICP备15017325号-8';
  45. }
  46. if (strstr($host, 'wixhb.com') !== false) {
  47. $name = '销花宝';
  48. $bei = '闽ICP备15017325号-9';
  49. }
  50. if (strstr($host, 'wixhb.cn') !== false) {
  51. $name = '花掌柜';
  52. $bei = '闽ICP备15017325号-10';
  53. }
  54. $this->layout = false;
  55. return $this->render('index', ['name' => $name, 'bei' => $bei]);
  56. }
  57. public function actionLogout()
  58. {
  59. xhWxOpenAdminService::logout();//不注销所有的 用户会话数据
  60. $this->redirect(['main/login']);
  61. }
  62. public function actionCheckLogin()
  63. {
  64. $request = Yii::$app->request;
  65. $mobile = $request->post('mobile');
  66. $password = $request->post('password');
  67. $return = xhWxOpenAdminService::loginByMobile($mobile, $password, true);//true 自动登陆
  68. if ($return) {
  69. util::complete('success');
  70. }
  71. util::fail('帐号或密码错误');
  72. }
  73. public function actionRunning()
  74. {
  75. return $this->render('running');
  76. }
  77. public function actionBook()
  78. {
  79. return $this->render('book');
  80. }
  81. }