From f2affda15757a6dc22a921188a8f7e3ee85808ca Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Mon, 29 Jun 2020 20:02:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/wechat/controller/Upload.php | 59 ++++++++++++++++++++++++++++++ catch/wechat/route.php | 5 +++ 2 files changed, 64 insertions(+) create mode 100644 catch/wechat/controller/Upload.php diff --git a/catch/wechat/controller/Upload.php b/catch/wechat/controller/Upload.php new file mode 100644 index 0000000..0852c9e --- /dev/null +++ b/catch/wechat/controller/Upload.php @@ -0,0 +1,59 @@ +attachment = $attachment; + } + + /** + * image upload + * + * @time 2020年01月25日 + * @param CatchRequest $request + * @param CatchUpload $upload + * @return \think\response\Json + * @throws \Exception + */ + public function image(CatchRequest $request, CatchUpload $upload): \think\response\Json + { + $images = $request->file(); + + return CatchResponse::success($upload->setDriver(CatchUpload::LOCAL)->checkImages($images)->multiUpload($images['image'])); + } + + /** + * file upload + * + * @time 2020年01月25日 + * @param CatchRequest $request + * @param CatchUpload $upload + * @return \think\response\Json + * @throws \Exception + */ + public function file(CatchRequest $request, CatchUpload $upload): \think\response\Json + { + $files = $request->file(); + + return CatchResponse::success($upload->setDriver(CatchUpload::LOCAL)->checkFiles($files)->multiUpload($files['file'])); + } +} \ No newline at end of file diff --git a/catch/wechat/route.php b/catch/wechat/route.php index e937788..e3e61ad 100644 --- a/catch/wechat/route.php +++ b/catch/wechat/route.php @@ -36,6 +36,11 @@ $router->group('wechat', function () use ($router){ $router->group('official/reply', function () use ($router){ $router->resource('', '\catchAdmin\wechat\controller\Reply'); }); + // 微信回复管理 + $router->group('official/upload', function () use ($router){ + $router->post('/image', '\catchAdmin\wechat\controller\Upload@image'); + $router->post('/file', '\catchAdmin\wechat\controller\Upload@file'); + }); })->middleware('auth'); // 消息