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