...
|
...
|
@@ -120,13 +120,16 @@ class Cars extends Api |
|
|
->alias('c')
|
|
|
->join('goods g','c.g_id = g.id','LEFT')
|
|
|
->where(['c.uid'=>$this->uid])
|
|
|
->field('c.id,c.g_id goods_id,c.price,c.goods_number,c.style,g.name,g.image,g.stock,g.introduce')
|
|
|
->field('c.id,c.g_id goods_id,c.price,c.goods_number,c.style,g.name,g.image,g.style g_style,g.stock,g.introduce')
|
|
|
->useSoftDelete('g.deletetime')
|
|
|
->select();
|
|
|
$total_price = 0;
|
|
|
foreach ($res as &$value){
|
|
|
$value['image'] = $this->auth->absolutionUrlOne($value['image']);
|
|
|
$total_price += $value['price'] * $value['goods_number'];
|
|
|
//查看规格所属索引
|
|
|
$s_index = array_search($value['style'],Common::salePrice($value['g_style']));
|
|
|
$value['stock'] = Common::salePrice($value['stock'][$s_index]);
|
|
|
if(($value['stock'] <=> $value['goods_number']) == -1){
|
|
|
//购物车数量大于库存
|
|
|
$value['goods_number'] = $value['stock'];
|
...
|
...
|
|