diff --git a/app/common/repositories/community/CommunityRepository.php b/app/common/repositories/community/CommunityRepository.php index 309ff518..28409da2 100644 --- a/app/common/repositories/community/CommunityRepository.php +++ b/app/common/repositories/community/CommunityRepository.php @@ -222,7 +222,7 @@ class CommunityRepository extends BaseRepository ]; $config = systemConfig("community_app_switch"); if ($config) $where['is_type'] = $config; - return $this->dao->getSearch($where)->with([ + $info = $this->dao->getSearch($where)->with([ 'author' => function($query) { $query->field('uid,real_name,status,avatar,nickname,count_start'); }, @@ -230,6 +230,12 @@ class CommunityRepository extends BaseRepository 'category', 'relevance.spu' ])->find(); + if ($info){ + $merInfo = Db::name('StoreService')->alias('ss')->leftJoin('Merchant m','ss.mer_id = M.mer_id')->where('ss.uid', $info['uid'])->field('m.mer_avatar, m.mer_name')->find(); + $info['mer_name'] = $merInfo['mer_name'] ?? ''; + $info['mer_avatar'] = $merInfo['mer_avatar'] ?? ''; + } + return $info; } /** @@ -644,7 +650,7 @@ class CommunityRepository extends BaseRepository * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function addCart($uid, $id, $resaleType=1) + public function addCart($uid, $id) { $where = [ $this->dao->getPk() => $id, @@ -666,7 +672,7 @@ class CommunityRepository extends BaseRepository $data = [ 'uid' => $uid, 'mer_id' => $item['mer_id'], - 'product_type' => $resaleType == 1 ? 98 : 99, + 'product_type' => 98, 'product_id' => $item['product_id'], 'product_attr_unique' => $item['product_attr_unique'], 'cart_num' => $item['number'], diff --git a/app/controller/api/community/Community.php b/app/controller/api/community/Community.php index 25b668a6..598cd7da 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -457,8 +457,7 @@ class Community extends BaseController public function addCart() { $communityId = $this->request->param('community_id'); - $resaleType = $this->request->param('resale_type', 1); - $cartIds = $this->repository->addCart($this->request->uid(), $communityId, $resaleType); + $cartIds = $this->repository->addCart($this->request->uid(), $communityId); return app('json')->success(['cart_id' => $cartIds]); }