更新发布管理转售商品列表

This commit is contained in:
yaooo 2023-08-18 09:25:12 +08:00
parent b55658764c
commit f641935623

View File

@ -499,7 +499,11 @@ class Community extends BaseController
$queryBuilder->where('c.status', 1);
}
$count = $queryBuilder->count();
$list = $queryBuilder->setOption('field', [])->field(['c.community_id', 'c.title', 'c.image', 'c.resale_type', 'SUM(`r`.`number` * `r`.`price`) AS total_price'])->group('c.community_id')->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(false)->select();
$list = $queryBuilder->setOption('field', [])->field(['c.community_id', 'c.title', 'c.image', 'c.resale_type', 'SUM(`r`.`number` * `r`.`price`) AS total_price', 'SUM(`r`.`number` * `r`.`price` * (100 - `r`.`float_rate`) / 100) AS discount_price'])->group('c.community_id')->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(false)->select();
if ($list) $list = $list->toArray();
foreach($list as $k=>&$v) {
$list[$k]['discount_price'] = round($v['discount_price'], 2);
}
return app('json')->success(compact('count', 'list'));
}
@ -539,7 +543,10 @@ class Community extends BaseController
*/
public function checkResale($id)
{
$communityInfo = Db::name('community')->where('uid', $this->request->uid())->where('community_id', $id)->find();
if (!$communityInfo) {
app('json')->fail('转售商品不存在');
}
}
}