更新
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\adminapi\controller\tcm;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\logic\tcm\AssistantServiceLogic as Logic;
|
||||
use app\adminapi\validate\tcm\AssistantServiceValidate as Validate;
|
||||
use app\common\service\assistantservice\AssistantServiceAccess as Access;
|
||||
use DomainException;
|
||||
|
||||
final class AssistantServiceController extends BaseAdminController
|
||||
{
|
||||
public function capabilities() { return $this->handle(__FUNCTION__); }
|
||||
public function patients() { return $this->handle(__FUNCTION__); }
|
||||
public function staff() { return $this->handle(__FUNCTION__); }
|
||||
public function teamOverview() { return $this->handle(__FUNCTION__); }
|
||||
public function staffOverview() { return $this->handle(__FUNCTION__); }
|
||||
public function staffCases() { return $this->handle(__FUNCTION__); }
|
||||
public function staffIssues() { return $this->handle(__FUNCTION__); }
|
||||
public function staffDailyContacts() { return $this->handle(__FUNCTION__); }
|
||||
public function alerts() { return $this->handle(__FUNCTION__); }
|
||||
public function wecomDirectory() { return $this->handle(__FUNCTION__); }
|
||||
public function wecomChats() { return $this->handle(__FUNCTION__); }
|
||||
public function wecomMessages() { return $this->handle(__FUNCTION__); }
|
||||
public function analyzeStaff() { return $this->handle(__FUNCTION__, true); }
|
||||
public function context() { return $this->handle(__FUNCTION__); }
|
||||
public function job() { return $this->handle(__FUNCTION__); }
|
||||
public function jobs() { return $this->handle(__FUNCTION__); }
|
||||
public function actions() { return $this->handle(__FUNCTION__); }
|
||||
public function knowledge() { return $this->handle(__FUNCTION__); }
|
||||
public function record() { return $this->handle(__FUNCTION__, true); }
|
||||
public function analyze() { return $this->handle(__FUNCTION__, true); }
|
||||
public function draftReply() { return $this->handle(__FUNCTION__, true); }
|
||||
public function reviewQuality() { return $this->handle(__FUNCTION__, true); }
|
||||
public function reviewAlert() { return $this->handle(__FUNCTION__, true); }
|
||||
public function adoptAction() { return $this->handle(__FUNCTION__, true); }
|
||||
public function completeAction() { return $this->handle(__FUNCTION__, true); }
|
||||
public function saveKnowledge() { return $this->handle(__FUNCTION__, true); }
|
||||
public function publishKnowledge() { return $this->handle(__FUNCTION__, true); }
|
||||
|
||||
private function handle(string $action, bool $post = false)
|
||||
{
|
||||
if ($post ? !$this->request->isPost() : !$this->request->isGet()) {
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
try {
|
||||
Access::actor($this->adminId, Access::permissionForAction($action));
|
||||
// 禁止全局 trim 将 JSON boolean 转为字符串;验证器独立处理每个字段。
|
||||
$input = $post ? $this->request->post('', null, null) : $this->request->get();
|
||||
return $this->data(Logic::$action(Validate::parameters($action, $input), $this->adminId));
|
||||
} catch (DomainException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
} catch (\Throwable $e) {
|
||||
// 不把 SQL、模型凭据、患者原文或第三方响应带给浏览器。
|
||||
return $this->fail('医助服务暂不可用,请联系管理员检查部署或稍后重试');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user