feat : city
This commit is contained in:
@@ -18,6 +18,7 @@ use App\Extend\SystemUtil;
|
||||
use App\Lib\Crypto\CryptoFactory;
|
||||
use App\Model\AdminUser;
|
||||
use App\Service\Admin\BaseService;
|
||||
use App\Service\ServiceTrait\Admin\GetUserInfoTrait;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -25,6 +26,7 @@ use function Hyperf\Config\config;
|
||||
|
||||
class LoginService extends BaseService
|
||||
{
|
||||
use GetUserInfoTrait;
|
||||
|
||||
/**
|
||||
* 注入管理员模型
|
||||
@@ -71,10 +73,12 @@ class LoginService extends BaseService
|
||||
|
||||
if (!$userInfo->save()) throw new AdminException('登录失败');
|
||||
|
||||
$cityId = $this->getCityById($userInfo->id);
|
||||
//生成 token
|
||||
$token = $this->cryptoFactory->cryptoClass('admin-jwt',json_encode([
|
||||
'id' => $userInfo->id,
|
||||
'role' => $userInfo->role_id,
|
||||
'city_id' => $cityId
|
||||
]))->encrypt();
|
||||
|
||||
//单点登录
|
||||
@@ -87,6 +91,7 @@ class LoginService extends BaseService
|
||||
'avatar' => $userInfo->avatar,
|
||||
'name' => $userInfo->chinese_name,
|
||||
'role_id' => $userInfo->role_id,
|
||||
'city_id' => $cityId
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user