diff --git a/app/common/repositories/community/CommunityRepository.php b/app/common/repositories/community/CommunityRepository.php index a232c808..309ff518 100644 --- a/app/common/repositories/community/CommunityRepository.php +++ b/app/common/repositories/community/CommunityRepository.php @@ -644,7 +644,7 @@ class CommunityRepository extends BaseRepository * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function addCart($uid, $id) + public function addCart($uid, $id, $resaleType=1) { $where = [ $this->dao->getPk() => $id, @@ -666,7 +666,7 @@ class CommunityRepository extends BaseRepository $data = [ 'uid' => $uid, 'mer_id' => $item['mer_id'], - 'product_type' => 98, + 'product_type' => $resaleType == 1 ? 98 : 99, '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 598cd7da..25b668a6 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -457,7 +457,8 @@ class Community extends BaseController public function addCart() { $communityId = $this->request->param('community_id'); - $cartIds = $this->repository->addCart($this->request->uid(), $communityId); + $resaleType = $this->request->param('resale_type', 1); + $cartIds = $this->repository->addCart($this->request->uid(), $communityId, $resaleType); return app('json')->success(['cart_id' => $cartIds]); }