优化订单状态逻辑

This commit is contained in:
技术老胡 2024-08-29 15:21:25 +08:00
parent 2447ebd52d
commit 7a7f690e6e
2 changed files with 10 additions and 2 deletions

View File

@ -218,6 +218,9 @@ class PayController
$path = '../runtime/order.json';
if ($is_user) {
$orders = Order::scope('activeOrder')->field('id,pid,aid,cid')->select();
if (!file_exists($path)) {
file_put_contents($path, '[]');
}
$old_info = file_get_contents($path);
$num = count($orders);
if ($num > 0) {

View File

@ -1,4 +1,9 @@
<?php
header('content-type: application/json; charset=utf-8');
$order = file_get_contents('../runtime/order.json');
echo $order;
$path = '../runtime/order.json';
if (!file_exists($path)) {
exit('{"code":3,"msg":"文件不存在"}');
} else {
exit(file_get_contents($path));
}