diff --git a/app/controller/api/community/Community.php b/app/controller/api/community/Community.php index 9c339f94..64f9ddcf 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -461,6 +461,20 @@ class Community extends BaseController return app('json')->success(['cart_id' => $cartIds]); } + /** + * 委托商品加购 + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function addEntrustCart() + { + $communityId = $this->request->param('community_id'); + $cartIds = $this->repository->addEntrustCart($this->request->uid(), $communityId); + return app('json')->success(['cart_id' => $cartIds]); + } + /** * 转售商品列表 * @return mixed @@ -716,7 +730,6 @@ class Community extends BaseController $list = $queryBuilder->setOption('field', [])->field(['c.community_id', 'c.uid', 'c.title', 'c.image', 'c.entrust_mer_id', 'm.credit_buy', 'm.settle_cycle', 'm.interest_rate', 'm.mer_name', 'm.mer_avatar', 'c.mer_status'])->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(false)->select(); if ($list) $list = $list->toArray(); foreach($list as $k => $v) { - $list[$k]['mer_name'] = 0; // type:1发起的委托 2收到的委托 if ($type == 2) { $merchantInfo = Db::name('merchant')->where('uid', $v['uid'])->find(); diff --git a/route/api.php b/route/api.php index 67af7fcb..a0121ade 100644 --- a/route/api.php +++ b/route/api.php @@ -381,6 +381,7 @@ Route::group('api/', function () { Route::post('/entrust', 'Community/entrust'); Route::get('/entrust/list', 'Community/entrustList'); Route::post('/entrust/check/:id', 'Community/checkEntrust'); + Route::post('/entrust/addEntrustCart', 'Community/addEntrustCart'); })->prefix('api.community.');