From f1d7babbdb4f62ae6189ba62c135fa398fd14133 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Thu, 17 Aug 2023 17:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=91=E5=B8=83=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/community/Community.php | 42 ++++++++++++++++++++++ route/api.php | 6 ++++ 2 files changed, 48 insertions(+) diff --git a/app/controller/api/community/Community.php b/app/controller/api/community/Community.php index 598cd7da..e00a01b1 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -28,6 +28,7 @@ use crmeb\services\MiniProgramService; use think\App; use app\common\repositories\community\CommunityRepository as repository; use think\exception\ValidateException; +use think\facade\Db; use think\facade\Log; class Community extends BaseController @@ -461,4 +462,45 @@ class Community extends BaseController return app('json')->success(['cart_id' => $cartIds]); } + /** + * 转售商品列表 + * @return mixed + */ + public function resaleList() + { + [$page, $limit] = $this->getPage(); + $status = $this->request->param('status'); + $queryBuilder = Db::name('community')->alias('c')->leftJoin('resale r','c.community_id = r.community_id')->where('c.uid', $this->request->uid()); + // 在售商品 + if ($status == 1) { + $queryBuilder->where('c.status', 1)->where('c.is_show', 1)->where(function ($query) { + $query->where(function ($conn) { + $conn->where('c.resale_type', 1)->where('r.status', 0); + }); + $query->whereOr(function ($conn) { + $conn->where('c.resale_type', 2)->where('c.mer_status', 1)->where('r.status', 0); + }); + }); + } + // 已售出商品 + if ($status == 2) { + $queryBuilder->where('c.status', 1)->where('r.status', 1); + } + // 待审核 + if ($status == 3) { + $queryBuilder->where('c.status', 0); + } + // 审核未通过 + if ($status == 4) { + $queryBuilder->where('c.status', -1); + } + // 审核通过 + if ($status == 5) { + $queryBuilder->where('c.status', 1); + } + $count = $queryBuilder->count(); + $list = $queryBuilder->field('c.community_id, c.title, c.image')->group('c.community_id')->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(true)->select(); + return app('json')->success(compact('count','list')); + } + } diff --git a/route/api.php b/route/api.php index 1465d1cf..b64b2039 100644 --- a/route/api.php +++ b/route/api.php @@ -365,6 +365,12 @@ Route::group('api/', function () { Route::get('order/:id', 'Community/getSpuByOrder'); Route::get('qrcode/:id', 'Community/qrcode'); + Route::get('resale/lst', 'Community/resaleList'); + Route::get('resale/:id', 'Community/resaleDetail'); + Route::post('resale/edit/:id', 'Community/editResale'); + Route::post('resale/delete/:id', 'Community/deleteResale'); + Route::post('resale/check/:id', 'Community/checkesale'); + })->prefix('api.community.'); Route::group('svip', function () {