Browse Source

checkredis

undefined
娄梦宁 4 years ago
parent
commit
72ccd5c5bf
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      addons/unishop/controller/Order.php

+ 9
- 0
addons/unishop/controller/Order.php View File

@@ -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;


Loading…
Cancel
Save