管理员列表支持解除电子签署身份,处理同一实名绑定冲突
e签宝 对同一证件只签发一个签署账号,同一实名在另一后台账号认证时会绑定冲突。 - 新增 auth.admin/esignUnbind:清除目标账号在当前 e签宝 应用下的签署账号绑定、 在途认证与快捷签授权;有在途操作时拒绝;不注销 e签宝 账号,已签处方不受影响 - 该接口加入 AuthMiddleware 强制鉴权列表,菜单未登记时也不放行; 迁移 2026_11_27_admin_esign_unbind_menu.sql 登记按钮权限,默认仅超级管理员可用 - 管理员列表显示「签署身份」并提供「解除签署」按钮 - 绑定冲突提示指明占用的后台账号(名称 + ID) - 医师认证失败日志把字段写进消息正文(ThinkPHP 不落盘 context) Co-Authored-By: Claude Opus 5 (1M context) <[EMAIL]>
This commit is contained in:
co-authored by
Claude Opus 5 (1M context)
parent
e4d788ed32
commit
2019f9dca1
@@ -22,6 +22,7 @@ use app\adminapi\logic\LoginLogic;
|
||||
use app\adminapi\validate\auth\editSelfValidate;
|
||||
use app\common\cache\AdminTokenCache;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\service\esign\DoctorEsignIdentityService;
|
||||
|
||||
/**
|
||||
* 管理员控制器
|
||||
@@ -211,4 +212,20 @@ class AdminController extends BaseAdminController
|
||||
return $this->success('解绑成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 解除管理员的电子签署身份(同一实名改绑到其他后台账号时使用)
|
||||
*/
|
||||
public function esignUnbind()
|
||||
{
|
||||
if (!$this->request->isPost()) {
|
||||
return $this->fail('请使用 POST 请求');
|
||||
}
|
||||
try {
|
||||
DoctorEsignIdentityService::unbind((int) $this->request->post('id', 0));
|
||||
} catch (\DomainException $error) {
|
||||
return $this->fail($error->getMessage());
|
||||
}
|
||||
return $this->success('已解除签署身份', [], 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -356,13 +356,16 @@ class PrescriptionController extends BaseAdminController
|
||||
return $this->data($data)->header(['Cache-Control' => 'private, no-store']);
|
||||
} catch (\Throwable $error) {
|
||||
// 只记录异常类型与位置,不记录手机号、证件号或 e签宝原始响应。
|
||||
\think\facade\Log::warning('Doctor esign ' . $operation . ' failed', [
|
||||
'admin_id' => (int) $this->adminId,
|
||||
'exception' => get_class($error),
|
||||
'provider_code' => $error instanceof \app\common\service\esign\EsignProviderException
|
||||
? $error->operation . ':' . $error->providerCode . ':' . ($error->reason ?? '') : '',
|
||||
'at' => basename($error->getFile()) . ':' . $error->getLine(),
|
||||
]);
|
||||
// ThinkPHP 的 context 只用于占位符替换,不会写入日志,因此字段直接拼进消息。
|
||||
\think\facade\Log::warning(sprintf(
|
||||
'Doctor esign %s failed admin_id=%d exception=%s provider=%s at=%s',
|
||||
$operation,
|
||||
(int) $this->adminId,
|
||||
get_class($error),
|
||||
$error instanceof \app\common\service\esign\EsignProviderException
|
||||
? $error->operation . ':' . $error->providerCode . ':' . ($error->reason ?? '') : '-',
|
||||
basename($error->getFile()) . ':' . $error->getLine()
|
||||
));
|
||||
return $this->fail($error instanceof \DomainException || $error instanceof \app\common\service\esign\EsignProviderException
|
||||
? mb_substr($error->getMessage(), 0, 240) : '医师认证暂不可用,请稍后重试');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user