|
@@ -55,9 +55,7 @@ class Pricing extends Api
|
|
|
* @ApiParams (name="deploy_type",description="部署方式0自己部署 1授权部署")
|
|
|
* @ApiParams (name="deploy",description="授权部署信息(授权部署时传)")
|
|
|
* @ApiParams (name="type",description="1页面下单,2是购物车下单")
|
|
|
- * @ApiParams (name="cart_id",description="购物车id(购物车下单时传)")
|
|
|
* @ApiParams (name="goods_id",description="商品id")
|
|
|
- * @ApiParams (name="amount_real",description="订单金额")
|
|
|
*/
|
|
|
public function place_order(){
|
|
|
if(input('deploy_type')==1 && empty(input('deploy'))){
|
|
@@ -69,11 +67,11 @@ class Pricing extends Api
|
|
|
'goods_id' => input('goods_id'),
|
|
|
'goods_name' => Goods::where('id',input('goods_id'))->value('name'),
|
|
|
'order_no' => pay_no($this->auth->id),
|
|
|
- 'amount_real' => input('amount_real'),
|
|
|
- 'discount_id' => input('discount_id'),
|
|
|
- 'discount' => DiscountCoupon::where('id',input('discount_id'))->value('price'),
|
|
|
+ 'amount_real' => Goods::where('id',input('goods_id'))->value('price'),
|
|
|
+// 'discount_id' => input('discount_id'),
|
|
|
+// 'discount' => DiscountCoupon::where('id',input('discount_id'))->value('price'),
|
|
|
// 'payment_type' => input('payment_type'),
|
|
|
- 'number_goods' => 1,
|
|
|
+// 'number_goods' => 1,
|
|
|
'deploy_type' => input('deploy_type'),
|
|
|
'deploy' => input('deploy'),
|
|
|
];
|
|
@@ -81,11 +79,13 @@ class Pricing extends Api
|
|
|
try {
|
|
|
$id = Order::insertGetId($data);
|
|
|
if(input('type')==2){
|
|
|
- Cart::where('id',input('cart_id'))->delete();
|
|
|
+ if(!Cart::where(['user_id'=>$this->auth->id,'goods_id'=>input('goods_id')])->delete()){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
}
|
|
|
- $this->success('下单成功',$id);
|
|
|
// $this->pay_order($data['amount_real'],$data['order_no'],$data['payment_type'],$data['goods_name'],'scan');
|
|
|
Db::commit();
|
|
|
+ $this->success('下单成功',$id);
|
|
|
}catch (Exception $exception){
|
|
|
Db::rollback();
|
|
|
$this->error($exception);
|