|
|
@@ -10,35 +10,37 @@ use Yii;
|
|
|
|
|
|
class StaffController extends BaseController
|
|
|
{
|
|
|
-
|
|
|
- public function actionLogin()
|
|
|
- {
|
|
|
- //登陆并拿到token ssh 2019.11.23
|
|
|
- $get = Yii::$app->request->get();
|
|
|
- $mobile = isset($get['mobile']) ? $get['mobile'] : 0;
|
|
|
- if (stringUtil::isMobile($mobile) == false) {
|
|
|
- util::fail('请填写正常的手机号');
|
|
|
- }
|
|
|
- $password = isset($get['password']) && !empty($get['password']) ? $get['password'] : '';
|
|
|
- if (empty($password)) {
|
|
|
- util::fail('请输入密码');
|
|
|
- }
|
|
|
-
|
|
|
- $staff = StaffService::getByCondition(['mobile' => $mobile]);
|
|
|
- if (password_verify($password, $staff['password']) == false) {
|
|
|
- util::fail('密码错误');
|
|
|
- }
|
|
|
- $staffId = $staff['id'];
|
|
|
- //获取token
|
|
|
- $token = jwt::getNewToken($staffId);
|
|
|
- util::success(['token' => $token]);
|
|
|
- }
|
|
|
-
|
|
|
- //登陆员工的详情 ssh 2019.12.26
|
|
|
- public function actionLoginDetail()
|
|
|
- {
|
|
|
- $detail = StaffService::getDetail($this->staffId);
|
|
|
- util::success($detail);
|
|
|
- }
|
|
|
+
|
|
|
+ public $guestAccessAction = ['login'];
|
|
|
+
|
|
|
+ public function actionLogin()
|
|
|
+ {
|
|
|
+ //登陆并拿到token ssh 2019.11.23
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $mobile = isset($get['mobile']) ? $get['mobile'] : 0;
|
|
|
+ if (stringUtil::isMobile($mobile) == false) {
|
|
|
+ util::fail('请填写正常的手机号');
|
|
|
+ }
|
|
|
+ $password = isset($get['password']) && !empty($get['password']) ? $get['password'] : '';
|
|
|
+ if (empty($password)) {
|
|
|
+ util::fail('请输入密码');
|
|
|
+ }
|
|
|
+
|
|
|
+ $staff = StaffService::getByCondition(['mobile' => $mobile]);
|
|
|
+ if (password_verify($password, $staff['password']) == false) {
|
|
|
+ util::fail('密码错误');
|
|
|
+ }
|
|
|
+ $staffId = $staff['id'];
|
|
|
+ //获取token
|
|
|
+ $token = jwt::getNewToken($staffId);
|
|
|
+ util::success(['token' => $token]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //登陆员工的详情 ssh 2019.12.26
|
|
|
+ public function actionLoginDetail()
|
|
|
+ {
|
|
|
+ $detail = StaffService::getDetail($this->staffId);
|
|
|
+ util::success($detail);
|
|
|
+ }
|
|
|
|
|
|
}
|