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