...
|
...
|
@@ -203,6 +203,36 @@ class Cart extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 购物车-选中取消
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="cart_ids", type="string", required=true, description="购物车ID集合")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
|
|
* @ApiReturnParams (name="data", type="object", description="扩展数据返回")
|
|
|
* @ApiReturn ({
|
|
|
'code':'1',
|
|
|
'msg':'返回成功'
|
|
|
})
|
|
|
*/
|
|
|
public function select($cart_ids)
|
|
|
{
|
|
|
$list = $this->model
|
|
|
->where('user_id',$this->user['id'])
|
|
|
->where('id','in',$cart_ids)
|
|
|
->select();
|
|
|
$total_num = 0;
|
|
|
$total_price = 0;
|
|
|
foreach ($list as $key => $cart) {
|
|
|
// 商品总数
|
|
|
$total_num += $cart['goods_num'];
|
|
|
// 商品总价
|
|
|
$total_price += bcmul($cart['goods_price'], $cart['goods_num'], 2);
|
|
|
}
|
|
|
$this->success(__('成功'),compact('total_num','total_price'));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 结算和支付(结算用GET,支付用POST)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
...
|
...
|
|