...
|
...
|
@@ -21,7 +21,7 @@ use Yansongda\Pay\Pay; |
|
|
*/
|
|
|
class Order extends Api
|
|
|
{
|
|
|
protected $noNeedLogin = ['friendPay','commentOrderDetail','pay'];
|
|
|
protected $noNeedLogin = ['friendPay','commentOrderDetail','pay','cancelOrderAction'];
|
|
|
protected $noNeedRight = ['*'];
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -534,6 +534,9 @@ class Order extends Api |
|
|
->delete();
|
|
|
// 如果使用了优惠券,就把优惠券状态变为已使用
|
|
|
UserCoupon::where('id',$coupon_id)->update(['status'=>'1']);
|
|
|
// 待支付自动关闭
|
|
|
$close_minue = 15;
|
|
|
\think\Queue::later(($close_minue * 60), '\app\api\job\OrderAutoOper@autoClose', ['order_id' => $ordermodel->id], 'temporaryfood');
|
|
|
Db::commit();
|
|
|
}catch (PDOException $e){
|
|
|
Db::rollback();
|
...
|
...
|
@@ -651,10 +654,25 @@ class Order extends Api |
|
|
{
|
|
|
$order_id = $this->request->post('id');
|
|
|
if (!is_numeric($order_id)) $this->error('参数不合法');
|
|
|
|
|
|
$model = new \app\api\model\Order();
|
|
|
$order = $model->where('id',$order_id)->find();
|
|
|
if ($order['freight_status'] == 20) $this->error('订单已发货无法取消');
|
|
|
empty($order) && $this->error('订单不存在');
|
|
|
|
|
|
$res = $this->cancelOrderAction($order);
|
|
|
$res['code'] == 0 && $this->error($res['msg']);
|
|
|
|
|
|
$this->success('取消成功');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 取消订单操作
|
|
|
* @ApiInternal
|
|
|
*/
|
|
|
public function cancelOrderAction($order)
|
|
|
{
|
|
|
if($order['freight_status'] == '20'){
|
|
|
return ['code' => 0,'msg' => '订单已发货无法取消'];
|
|
|
}
|
|
|
$goodsmodel = new \app\api\model\OrderGoods();
|
|
|
$skumodel = new \app\api\model\GoodsSpec();
|
|
|
|
...
|
...
|
@@ -704,9 +722,9 @@ class Order extends Api |
|
|
Db::commit();
|
|
|
}catch (PDOException $e){
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
return ['code' => 0,'msg' => $e->getMessage()];
|
|
|
}
|
|
|
$this->success('取消成功');
|
|
|
return ['code' => 1,'msg' => '取消成功'];
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|