From bd8f3a5725450f20d2d5b39bafb22ec66ad69381 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 26 Oct 2023 15:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A7=94=E6=89=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/community/Community.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controller/api/community/Community.php b/app/controller/api/community/Community.php index 11c91363..548cd5ba 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -800,13 +800,17 @@ class Community extends BaseController if (!$communityInfo) { return app('json')->fail('委托商品不存在'); } - $uid = $this->request->uid(); - $communityInfo['mer_info'] = Db::name('merchant')->where('uid', $uid)->where('is_del', 0)->field(['mer_id', 'mer_name', 'mer_address', 'mer_avatar', 'settle_cycle', 'interest_rate'])->find(); + // $uid = $this->request->uid(); + $entrust = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->find(); + if (!$entrust) { + return app('json')->fail('委托商品不存在'); + } + $entrustDay=$entrust['entrust_day']; + $communityInfo['mer_info'] = Db::name('merchant')->where('mer_id', $entrust['mer_id'])->where('is_del', 0)->field(['mer_id', 'mer_name', 'mer_address', 'mer_avatar', 'settle_cycle', 'interest_rate'])->find(); $communityInfo['entrust_mer_info'] = Db::name('merchant')->where('mer_id', $communityInfo['entrust_mer_id'])->where('is_del', 0)->field(['mer_id', 'mer_name', 'mer_address', 'mer_avatar'])->find(); if (empty($communityInfo['mer_info']) || empty($communityInfo['entrust_mer_info'])) { return app('json')->fail('无权限查看委托商品'); } - $entrustDay = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->value('entrust_day'); $communityInfo['entrust_day'] = $entrustDay; $communityInfo['product_list'] = Db::name('entrust')->alias('e')->leftJoin('store_product sp','e.product_id = sp.product_id')->leftJoin('store_product_attr_value spav','spav.unique = e.product_attr_unique')->where('e.community_id', $id)->where('sp.is_del', 0)->setOption('field', [])->field(['e.product_id, e.product_attr_unique, e.number, e.price, e.status, spav.price as old_price, sp.store_name, sp.image'])->select(); if ($communityInfo['product_list']) $communityInfo['product_list'] = $communityInfo['product_list']->toArray();