更新创建购物车类型

This commit is contained in:
yaooo 2023-08-16 11:45:14 +08:00
parent e64f991811
commit 153d4d7406
2 changed files with 4 additions and 3 deletions

View File

@ -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'],

View File

@ -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]);
}