修复委托

This commit is contained in:
mkm 2023-10-26 15:35:54 +08:00
parent 4e636821d4
commit bd8f3a5725

View File

@ -800,13 +800,17 @@ class Community extends BaseController
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();
// $uid = $this->request->uid();
$entrust = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->find();
if (!$entrust) {
return app('json')->fail('委托商品不存在');
}
$entrustDay=$entrust['entrust_day'];
$communityInfo['mer_info'] = Db::name('merchant')->where('mer_id', $entrust['mer_id'])->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;
$communityInfo['product_list'] = Db::name('entrust')->alias('e')->leftJoin('store_product sp','e.product_id = sp.product_id')->leftJoin('store_product_attr_value spav','spav.unique = e.product_attr_unique')->where('e.community_id', $id)->where('sp.is_del', 0)->setOption('field', [])->field(['e.product_id, e.product_attr_unique, e.number, e.price, e.status, spav.price as old_price, sp.store_name, sp.image'])->select();
if ($communityInfo['product_list']) $communityInfo['product_list'] = $communityInfo['product_list']->toArray();