|
@@ -150,7 +150,15 @@ class Sell
|
|
if ($info['time'] >= $m) {
|
|
if ($info['time'] >= $m) {
|
|
# 已过期,自动取消
|
|
# 已过期,自动取消
|
|
$info['time'] = -1;
|
|
$info['time'] = -1;
|
|
- Dever::db($this->table)->update(array('where_id' => $info['id'], 'status' => 11));
|
|
|
|
|
|
+ //Dever::db($this->table)->update(array('where_id' => $info['id'], 'status' => 11));
|
|
|
|
+ # 还原库存
|
|
|
|
+ if ($this->type == 1) {
|
|
|
|
+ $this->cancel($info['uid'], $info['id'], 11);
|
|
|
|
+ } else {
|
|
|
|
+ $this->type = 2;
|
|
|
|
+ $this->cancel($info['shop_id'], $info['id'], 11);
|
|
|
|
+ }
|
|
|
|
+
|
|
$info['status'] = 11;
|
|
$info['status'] = 11;
|
|
} else {
|
|
} else {
|
|
$info['time'] = $m - $info['time'];
|
|
$info['time'] = $m - $info['time'];
|
|
@@ -360,11 +368,11 @@ class Sell
|
|
}
|
|
}
|
|
|
|
|
|
# 取消订单
|
|
# 取消订单
|
|
- public function cancel($id, $order_id)
|
|
|
|
|
|
+ public function cancel($id, $order_id, $status = 7)
|
|
{
|
|
{
|
|
$data = $this->getView($id, $order_id, false);
|
|
$data = $this->getView($id, $order_id, false);
|
|
if ($data['status'] == 1) {
|
|
if ($data['status'] == 1) {
|
|
- $state = Dever::db('shop/sell_order')->update(array('where_id' => $data['id'], 'status' => 7, 'operdate' => time()));
|
|
|
|
|
|
+ $state = Dever::db('shop/sell_order')->update(array('where_id' => $data['id'], 'status' => $status, 'operdate' => time()));
|
|
if ($state) {
|
|
if ($state) {
|
|
if ($data['user_coupon_id']) {
|
|
if ($data['user_coupon_id']) {
|
|
# 还原优惠券
|
|
# 还原优惠券
|