diff --git a/app/common.php b/app/common.php index fa1293d..f3ee1c8 100644 --- a/app/common.php +++ b/app/common.php @@ -60,7 +60,7 @@ function findParent($obj, $id, &$path) function getResourceShareInfo() { $code = uniqid(); - $share_link = url('share/index', ['id' => $code])->domain(true); + $share_link = url('share/index', ['code' => $code])->domain(true); $password = str_pad(rand(0, 9999), 4, '0', STR_PAD_LEFT); return [ 'code' => $code, diff --git a/app/controller/ShareController.php b/app/controller/ShareController.php new file mode 100644 index 0000000..5c8d7e8 --- /dev/null +++ b/app/controller/ShareController.php @@ -0,0 +1,25 @@ +param('code'); + + $share = Share::with(['share_item', 'share_item.target']) + ->where('code', $code)->find(); + return jsonReturn(0, Lang::get('成功'), $share); + } +} diff --git a/app/model/Content.php b/app/model/Content.php new file mode 100644 index 0000000..0663d83 --- /dev/null +++ b/app/model/Content.php @@ -0,0 +1,9 @@ +morphTo('target', [ + '1' => Resource::class, + '2' => Content::class, + ]); + } }