|
|
@@ -12,6 +12,7 @@ namespace addons\unishop\controller; |
|
|
|
use addons\nzf\AliPay; |
|
|
|
use addons\nzf\PayService; |
|
|
|
use addons\unishop\extend\Hashids; |
|
|
|
use addons\unishop\extend\Redis; |
|
|
|
use addons\unishop\model\Area; |
|
|
|
use addons\unishop\model\Config; |
|
|
|
use addons\unishop\model\Evaluate; |
|
|
@@ -221,6 +222,14 @@ class Order extends Base |
|
|
|
if ($order['have_paid'] != \addons\unishop\model\Order::PAID_NO) { |
|
|
|
$this->error('此订单已支付,无法取消'); |
|
|
|
} |
|
|
|
$redis = new Redis(); |
|
|
|
$flash = $this->model->alias("o")-> |
|
|
|
join("unishop_order_product","unishop_order_product.order_id =o.id") |
|
|
|
->where(["o.id"=>(int)$order_id]) |
|
|
|
->field("flash_id,product_id")->find(); |
|
|
|
if ($flash){ |
|
|
|
$redis->handler->hIncrBy('flash_sale_' . $flash->flash_id. '_' . $flash->product_id, 'sold', -1); |
|
|
|
} |
|
|
|
|
|
|
|
if ($order['status'] == \addons\unishop\model\Order::STATUS_NORMAL && $order['have_paid'] == \addons\unishop\model\Order::PAID_NO) { |
|
|
|
$order->status = \addons\unishop\model\Order::STATUS_CANCEL; |
|
|
|