MainController.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace saas\controllers;
  3. use common\components\configDict;
  4. use common\components\util;
  5. use Yii;
  6. use yii\web\Controller;
  7. use yii\filters\AccessControl;
  8. use common\services\xhWxOpenAdminService;
  9. class MainController extends PlatformController
  10. {
  11. public $withoutLogin = ['login', 'logout', 'check-login'];
  12. public function actionIndex()
  13. {
  14. return $this->render('index');
  15. }
  16. public function actionLogin()
  17. {
  18. Yii::$app->end();
  19. }
  20. public function actionRelogin()
  21. {
  22. }
  23. public function actionLogout()
  24. {
  25. xhWxOpenAdminService::logout();//不注销所有的 用户会话数据
  26. $this->redirect(['main/login']);
  27. }
  28. public function actionCheckLogin()
  29. {
  30. $request = Yii::$app->request;
  31. $mobile = $request->post('mobile');
  32. $password = $request->post('password');
  33. $return = xhWxOpenAdminService::loginByMobile($mobile, $password, true);//true 自动登陆
  34. if ($return) {
  35. util::complete('success');
  36. }
  37. util::fail('帐号或密码错误');
  38. }
  39. public function actionRunning()
  40. {
  41. return $this->render('running');
  42. }
  43. public function actionBook()
  44. {
  45. return $this->render('book');
  46. }
  47. }