|
|
@@ -32,16 +32,17 @@ class OrderService extends BaseService
|
|
|
$shopId = $data['shopId'] ?? 0;
|
|
|
$userId = $data['userId'] ?? 0;
|
|
|
$mainId = $data['mainId'] ?? 0;
|
|
|
-
|
|
|
$shop = ShopClass::getById($shopId, true);
|
|
|
if (empty($shop)) {
|
|
|
util::fail('没有找到门店');
|
|
|
}
|
|
|
- $custom = [];
|
|
|
$customId = 0;
|
|
|
$hdId = 0;
|
|
|
if (!empty($userId)) {
|
|
|
$custom = CustomClass::getByCondition(['shopId' => $shopId, 'userId' => $userId], true);
|
|
|
+ if (empty($custom)) {
|
|
|
+ util::fail('没有找到客户');
|
|
|
+ }
|
|
|
$customId = $custom->id ?? 0;
|
|
|
} else {
|
|
|
$defaultCustomId = $shop->defaultCustomId ?? 0;
|
|
|
@@ -242,20 +243,16 @@ class OrderService extends BaseService
|
|
|
}
|
|
|
|
|
|
//支付前验证订单 ssh 2019.12.6
|
|
|
- public static function checkBeforePay($order, $userId)
|
|
|
+ public static function checkBeforePay($order)
|
|
|
{
|
|
|
$now = time();
|
|
|
- OrderClass::setExpire($order);
|
|
|
if (empty($order)) {
|
|
|
util::fail('订单无效');
|
|
|
}
|
|
|
- if (isset($order['userId']) && $order['userId'] != $userId) {
|
|
|
- util::fail('非法访问');
|
|
|
- }
|
|
|
if ($order['status'] != 1) {
|
|
|
util::fail('订单不是待付款状态');
|
|
|
}
|
|
|
- if (!empty($order['deadline']) && $now > $order['deadline']) {
|
|
|
+ if ($order['deadline'] <= ($now - 60)) {
|
|
|
util::fail('订单已过期');
|
|
|
}
|
|
|
if (ceil($order['actPrice']) <= 0) {
|