refactor(kefu): remove BaseAuth dependencies from unused kefu module

Made-with: Cursor
This commit is contained in:
apple
2026-04-29 17:24:10 +08:00
parent 0f67fae4c6
commit d6b9d1d0e3
5 changed files with 46 additions and 25 deletions

View File

@@ -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']);
}