|
@@ -21,7 +21,15 @@ class Pay
|
|
|
if (!$goods) {
|
|
|
Dever::alert('错误的商品信息');
|
|
|
}
|
|
|
+ # 验证库存
|
|
|
+ if ($goods['num'] < $num) {
|
|
|
+ Dever::alert('已售空');
|
|
|
+ }
|
|
|
+
|
|
|
$shop = Dever::db('goods/shop')->one($goods['shop_id']);
|
|
|
+ if (!$shop) {
|
|
|
+ Dever::alert('店铺不存在');
|
|
|
+ }
|
|
|
|
|
|
if ($parent_uid) {
|
|
|
$order_data['parent_uid'] = $parent_uid;
|
|
@@ -109,7 +117,7 @@ class Pay
|
|
|
$msg = $send['pay_msg'];
|
|
|
|
|
|
$order = Dever::db('goods/order')->one(array('order_id' => $order_id, 'time' => time()));
|
|
|
- if ($order && $order['status'] == 1) {
|
|
|
+ if ($order && $order['pay_status'] == 1) {
|
|
|
|
|
|
if ($status == 2) {
|
|
|
# 减少库存 增加销量
|
|
@@ -138,7 +146,8 @@ class Pay
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $update['status'] = $status;
|
|
|
+ $update['pay_status'] = $status;
|
|
|
+ $update['status'] = 2;
|
|
|
$update['where_id'] = $order['id'];
|
|
|
$update['pay_time'] = time();
|
|
|
Dever::db('goods/order')->update($update);
|