refactor(kefu): remove BaseAuth dependencies from unused kefu module
Made-with: Cursor
This commit is contained in:
@@ -6,13 +6,11 @@
|
||||
namespace app\services\kefu;
|
||||
|
||||
|
||||
use crmeb\basic\BaseAuth;
|
||||
use app\services\auth\AccessTokenService;
|
||||
use app\services\BaseServices;
|
||||
use crmeb\exceptions\AuthException;
|
||||
use crmeb\services\CacheService;
|
||||
use app\dao\message\service\StoreServiceDao;
|
||||
use crmeb\services\wechat\OfficialAccount;
|
||||
use crmeb\utils\ApiErrorCode;
|
||||
use think\annotation\Inject;
|
||||
use think\exception\ValidateException;
|
||||
use app\services\wechat\WechatUserServices;
|
||||
@@ -77,14 +75,15 @@ class LoginServices extends BaseServices
|
||||
*/
|
||||
public function parseToken(string $token)
|
||||
{
|
||||
/** @var BaseAuth $services */
|
||||
$services = app()->make(BaseAuth::class);
|
||||
$adminInfo = $services->parseToken($token, function ($id) {
|
||||
return $this->dao->get($id);
|
||||
});
|
||||
if (isset($adminInfo->auth) && $adminInfo->auth !== md5($adminInfo->password)) {
|
||||
throw new AuthException(ApiErrorCode::ERR_LOGIN_INVALID);
|
||||
}
|
||||
/** @var AccessTokenService $services */
|
||||
$services = app()->make(AccessTokenService::class);
|
||||
$adminInfo = $services->parseToken(
|
||||
$token,
|
||||
'kefu',
|
||||
fn($id) => $this->dao->get($id),
|
||||
fn($adminInfo) => md5($adminInfo->password)
|
||||
);
|
||||
|
||||
return $adminInfo->hidden(['password', 'ip', 'status']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user