123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\admin\logic\wechat;
-
- use app\common\basics\Logic;
- use app\common\server\ConfigServer;
-
- class PcLogic extends Logic
- {
-
-
-
- public static function getConfig()
- {
- $config = [
- 'is_open' => ConfigServer::get('pc', 'is_open', 1),
- 'page' => ConfigServer::get('pc', 'page', 1),
- 'page_url' => ConfigServer::get('pc', 'page_url', ''),
- 'pc_url' => request()->domain() . '/pc'
- ];
-
- return $config;
- }
-
-
-
- public static function set($params)
- {
- ConfigServer::set('pc', 'is_open', $params['is_open']);
- ConfigServer::set('pc', 'page', $params['page']);
- ConfigServer::set('pc', 'page_url', $params['page_url']);
-
-
-
- if(file_exists('./pc/index_lock.html')) {
-
- unlink('./pc/index.html');
-
- rename('./pc/index_lock.html', './pc/index.html');
-
-
- array_map('unlink', glob('../runtime/index/temp/'.'*.php'));
- }
-
-
- if($params['is_open'] == 0 && $params['page'] == 1) {
-
- rename('./pc/index.html', './pc/index_lock.html');
-
- $newfile = fopen('./pc/index.html', 'w');
- fclose($newfile);
- }
-
-
- if($params['is_open'] == 0 && $params['page'] == 2 && !empty($params['page_url'])) {
-
- rename('./pc/index.html', './pc/index_lock.html');
-
- $newfile = fopen('./pc/index.html', 'w');
- $content = '<script>window.location.href = "' . $params['page_url'] . '";</script>';
- fwrite($newfile, $content);
- fclose($newfile);
- }
- }
- }
|