MainController.php 2.7 KB

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