MainController.php 1.3 KB

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