MainController.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace platform\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. if($this->isLogin){
  19. $this->redirect(['main/index']);
  20. Yii::$app->end();
  21. }
  22. return $this->renderPartial('login');
  23. }
  24. /**
  25. * 重复登陆,记录登陆名
  26. */
  27. public function actionRelogin()
  28. {
  29. return $this->renderPartial('relogin');
  30. }
  31. public function actionLogout()
  32. {
  33. xhWxOpenAdminService::logout();//不注销所有的 用户会话数据
  34. $this->redirect(['main/login']);
  35. }
  36. public function actionCheckLogin()
  37. {
  38. $request = Yii::$app->request;
  39. $mobile = $request->post('mobile');
  40. $password = $request->post('password');
  41. $return = xhWxOpenAdminService::loginByMobile($mobile, $password,true);//true 自动登陆
  42. if($return){
  43. util::successInfo('success');
  44. }
  45. util::failInfo('帐号或密码错误');
  46. }
  47. public function actionRunning()
  48. {
  49. return $this->render('running');
  50. }
  51. public function actionBook()
  52. {
  53. return $this->render('book');
  54. }
  55. }