request->get(); $mobile = isset($get['mobile']) ? $get['mobile'] : 0; if (stringUtil::isMobieNumber($mobile) == false) { util::fail('请填写正常的手机号'); } $password = isset($get['password']) && !empty($get['password']) ? $get['password'] : ''; if (empty($password)) { util::fail('请输入密码'); } $admin = AdminService::getByCondition(['mobile' => $mobile]); if ($admin['password'] != md5($password)) { util::fail('密码错误'); } $adminId = $admin['id']; //来源 $sourceId = WxOpenService::getSourceId(); //获取token $token = jwt::get($sourceId, $adminId); util::success(['token' => $token]); } public function actionLogout() { xhAdminService::logout(); echo 'ok'; } }