feat(phone-image): 增加翻页预览与无封面图排版样式

- 为手机截图生成器添加翻页功能,支持在生成前预览各页内容
- 增加无封面图时的排版样式,使用装饰线条和居中布局
- 改进图片处理逻辑,清除内联样式并展平嵌套包装元素
- 修复 models.dev 同步接口,支持 GET 请求获取缓存数据
- 优化网络请求,添加直连失败后的本地代理重试机制
This commit is contained in:
augushong
2026-05-01 16:31:26 +08:00
parent eab8cee8a8
commit 34fe255829
11 changed files with 334 additions and 27 deletions

View File

@@ -118,6 +118,46 @@ class ModelsDevSync
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
]);
// 尝试直连,失败后使用本地代理
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_errno($ch);
curl_close($ch);
if ($curlError !== 0 || $httpCode !== 200) {
// 直连失败,尝试通过本地代理
$response = $this->fetchViaProxy();
if ($response !== false) {
return $response;
}
return false;
}
return $response;
}
/**
* 通过本地代理获取数据.
*
* @return string|false
*/
protected function fetchViaProxy()
{
$proxyUrl = 'http://127.0.0.1:7005';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->apiUrl);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_PROXY, $proxyUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
]);