Browse Source

11

undefined
loumengning 4 years ago
parent
commit
39566930c8
2 changed files with 11 additions and 1 deletions
  1. +10
    -0
      addons/unishop/controller/Order.php
  2. +1
    -1
      application/admin/controller/unishop/Order.php

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

@@ -608,6 +608,16 @@ class Order extends Base
if (!$order){
$this->error("订单信息错误");
}
$redis = new Redis();
$flash = $orderModel->alias("o")->
join("unishop_order_product","unishop_order_product.order_id =o.id")
->join("unishop_flash_sale","unishop_order_product.flash_id=unishop_flash_sale.id")
->where(["o.id"=>(int)$order_id])
->field("flash_id,product_id,endtime")->find();
if (!$flash || $flash->endtime < time()){
$this->error("活动已结束,不支持退款");
}
$sold = $redis->handler->hIncrBy('flash_sale_' . $flash->flash_id. '_' . $flash->product_id, 'sold', -1);
$order->status = \addons\unishop\model\Order::STATUS_REFUND;
$order->refund_status = \addons\unishop\model\Order::REFUND_STATUS_AGREE;
$result = $order->save();


+ 1
- 1
application/admin/controller/unishop/Order.php View File

@@ -26,7 +26,7 @@ class Order extends Backend
*/
protected $relationSearch = true;

protected $noNeedLogin=["export","finish"];
protected $noNeedLogin=["export","finish","doRefund"];

/**
* Order模型对象


Loading…
Cancel
Save