|
|
@@ -18,22 +18,15 @@ class PurchaseClearController extends BaseController
|
|
|
public function actionCreateOrder()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- $current = time();
|
|
|
$ghsId = $post['ghsId'] ?? 0;
|
|
|
$ghs = GhsClass::getById($ghsId, true);
|
|
|
GhsClass::valid($ghs, $this->shopId);
|
|
|
- //查找有没结帐订单还没有过期
|
|
|
+ //老的没有清的结账单直接过期掉
|
|
|
$list = PurchaseClearClass::getAllByCondition(['ghsId' => $ghsId, 'status' => PurchaseClearClass::STATUS_AWAIT_PAY], null, '*', null, true);
|
|
|
if (!empty($list)) {
|
|
|
foreach ($list as $item) {
|
|
|
- $deadline = $item->deadline;
|
|
|
- $deadTime = strtotime($deadline);
|
|
|
- if ($current > $deadTime) {
|
|
|
- $item->status = PurchaseClearClass::STATUS_EXPIRE;
|
|
|
- $item->save();
|
|
|
- } else {
|
|
|
- util::success(['hasUnComplete' => 1], '还有待完成结账单');
|
|
|
- }
|
|
|
+ $item->status = PurchaseClearClass::STATUS_EXPIRE;
|
|
|
+ $item->save();
|
|
|
}
|
|
|
}
|
|
|
$post['ghsShopId'] = $ghs->shopId ?? 0;
|