From 7ec622103b60dd571786b379cba116071960c857 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 Jul 2024 09:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=20=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/AuditController.php | 19 +++++++++++++++++++ app/model/Audit.php | 18 ++++++++++++++++++ app/service/AuditService.php | 2 ++ route/app.php | 2 +- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/app/controller/AuditController.php b/app/controller/AuditController.php index 091c5e2..c640a6d 100644 --- a/app/controller/AuditController.php +++ b/app/controller/AuditController.php @@ -3,6 +3,7 @@ namespace app\controller; use app\model\Audit; +use app\model\Resource; use think\Request; use think\facade\Lang; @@ -25,4 +26,22 @@ class AuditController ->select(); return jsonReturn(0, Lang::get('成功'), $list); } + + /** + * 审批 详情 + */ + public function detail(Request $request) + { + $resource_detail = Audit::with(['launch_user', 'audit_user'])->find($request->param('id')); + switch ($resource_detail->target_type) { + // 1是资源 + case 1: + $resource_detail->target = Resource::with(['user', 'accredit_files', 'files'])->find($resource_detail->target_id); + break; + case 2: + break; + } + + return jsonReturn(0, Lang::get('成功'), $resource_detail); + } } diff --git a/app/model/Audit.php b/app/model/Audit.php index 1a73fd3..a7165ba 100644 --- a/app/model/Audit.php +++ b/app/model/Audit.php @@ -16,4 +16,22 @@ class Audit extends Model '2' => Content::class, ]); } + + /** + * @return \think\model\relation\BelongsTo + * 发起人关联关系 + */ + public function launchUser() + { + return $this->belongsTo(User::class, 'launch_user_id'); + } + + /** + * @return \think\model\relation\BelongsTo + * 审核人关联关系 + */ + public function auditUser() + { + return $this->belongsTo(User::class, 'audit_user_id'); + } } diff --git a/app/service/AuditService.php b/app/service/AuditService.php index 2686c81..be3fa79 100644 --- a/app/service/AuditService.php +++ b/app/service/AuditService.php @@ -31,4 +31,6 @@ class AuditService $audit->saveAll($audit_ary); } + + } diff --git a/route/app.php b/route/app.php index d3c504b..177a338 100644 --- a/route/app.php +++ b/route/app.php @@ -46,7 +46,7 @@ Route::group('resource_dir', function () { //审核-待处理-资源审核 Route::group('audit', function () { Route::get('/index', 'index'); - + Route::get('/detail', 'detail'); })->prefix('audit/'); //后台-流程管理