作者 lihan
1 个管道 的构建 通过 耗费 0 秒

修改bug阶段

... ... @@ -66,11 +66,19 @@ class GoodsController extends HomeBaseController
public function detail()
{
$id = request()->param('id');
$data = Db::name('zj_goods')->field('thumb,name,intro,price,content,more')->where(['id' => $id])->find();
$data = Db::name('zj_goods')->alias('g')
->field('thumb,name,intro,price,content,more,cid as caid')
->join('zj_category c', 'c.id=g.cid')
->where(['id' => $id])->find();
$data['more'] = json_decode($data['more'], true);
foreach ($data['more'] as $k => $v) {
$data['photo'][$k]['photo'] = cmf_get_image_url($v['url']);
}
if ($data['caid'] == 2) {
$data['integral'] = '购买可获得' . $data['price'] * 2 . '积分';
} else {
$data['integral'] = '该商品无积分奖励';
}
$data['content'] = html_entity_decode($data['content']);
$total = Db::name('zj_cart')->field('sum(num) as total')->where(['uid' => session('user.id')])->select();
if ($total[0]['total'] == '') {
... ... @@ -88,7 +96,7 @@ class GoodsController extends HomeBaseController
private function getCategory($cid)
{
return Db::name('zj_category')->field('id,name')->where(['cid' => $cid,'delete_time'=>['eq', 0]])->select()->toArray();
return Db::name('zj_category')->field('id,name')->where(['cid' => $cid, 'delete_time' => ['eq', 0]])->select()->toArray();
}
public function getGoodsComment($gid)
... ...
... ... @@ -53,7 +53,7 @@
</p>
<div class="people">
<p class="people_weight">
{$data.integral}
</p>
<p class="people_money">
¥{$data.price}
... ...