ConfigService::get('h5', 'status',1), 'page_status' => ConfigService::get('h5', 'page_status',1), 'page_url' => ConfigService::get('h5', 'page_url',''), ]; return $config; } /** * @notes H5设置 * @param $params * @author ljj * @date 2022/9/23 10:02 上午 */ public static function setConfig($params) { $params['close_url'] = $params['close_url'] ?? ''; ConfigService::set('h5', 'status', $params['status']); ConfigService::set('h5', 'page_status', $params['page_status'] ?? 0); ConfigService::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'); } // H5商城关闭 且 显示空白页 if($params['status'] == 0 && $params['page_status'] == 1) { // 变更文件名 rename('./mobile/index.html', './mobile/index_lock.html'); // 创建新空白文件 $newfile = fopen('./mobile/index.html', 'w'); fclose($newfile); } // H5商城关闭 且 跳转指定页 if($params['status'] == 0 && $params['page_status'] == 2 && !empty($params['close_url'])) { // 变更文件名 rename('./mobile/index.html', './mobile/index_lock.html'); // 创建重定向文件 $newfile = fopen('./mobile/index.html', 'w'); $content = ''; fwrite($newfile, $content); fclose($newfile); } } }