运行时目录优化

This commit is contained in:
技术老胡 2024-09-05 11:18:01 +08:00
parent 99967b65db
commit ce65756874
3 changed files with 6 additions and 2 deletions

View File

@ -14,4 +14,8 @@ class IndexController
} }
return View::fetch(); return View::fetch();
} }
public function test()
{
return runtime_path();
}
} }

View File

@ -280,7 +280,7 @@ class PayController
return '参数错误'; return '参数错误';
} }
$is_user = User::checkUser($pid, $sign); $is_user = User::checkUser($pid, $sign);
$path = '../runtime/order.json'; $path = runtime_path() . 'order.json';
if ($is_user) { if ($is_user) {
$orders = Order::scope('activeOrder')->field('id,pid,aid,cid,patt')->select(); $orders = Order::scope('activeOrder')->field('id,pid,aid,cid,patt')->select();
if (!file_exists($path)) { if (!file_exists($path)) {

View File

@ -17,7 +17,7 @@ class ShouQianBa
$this->username = $config['username']; $this->username = $config['username'];
$this->password = $config['password']; $this->password = $config['password'];
// 检查token目录 // 检查token目录
$dir_path = '../runtime/token/shouqianba'; $dir_path = runtime_path() . 'token/shouqianba';
if (!is_dir($dir_path)) { if (!is_dir($dir_path)) {
if (!mkdir($dir_path, 755, true)) { if (!mkdir($dir_path, 755, true)) {
echo '目录创建失败'; echo '目录创建失败';