diff --git a/app/controller/api/community/Community.php b/app/controller/api/community/Community.php index fca126df..ecf31dda 100644 --- a/app/controller/api/community/Community.php +++ b/app/controller/api/community/Community.php @@ -794,6 +794,27 @@ class Community extends BaseController return app('json')->success(compact('count', 'list')); } + /** + * 委托商品详情 + * @return mixed + */ + public function entrustDetail($id) + { + $communityInfo = Db::name('community')->where('community_id', $id)->where('is_del', 0)->find(); + 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(); + $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; + return app('json')->success($communityInfo); + } + /** * 供应链商家申请结束商品委托 * @return mixed diff --git a/route/api.php b/route/api.php index 0aac57be..b2aef48a 100644 --- a/route/api.php +++ b/route/api.php @@ -382,6 +382,7 @@ Route::group('api/', function () { Route::get('/supplychain/list', 'Community/supplychainList'); Route::post('/entrust', 'Community/entrust'); Route::get('/entrust/list', 'Community/entrustList'); + Route::get('/entrust/:id', 'Community/entrustDetail'); Route::post('/entrust/check/:id', 'Community/checkEntrust'); Route::post('/entrust/addEntrustCart', 'Community/addEntrustCart'); Route::post('/entrust/apply/finish/:id', 'Community/applyFinishEntrust');