|
|
@@ -2347,97 +2347,83 @@ class DeepSeekService
|
|
|
h2 { font-size: 16px; margin-top: 20px; margin-bottom: 10px; border-bottom: 1px solid #ccc; }
|
|
|
h3 { font-size: 14px; margin-top: 15px; margin-bottom: 8px; }
|
|
|
.info { margin-bottom: 8px; }
|
|
|
- .episode { margin-bottom: 20px; page-break-inside: avoid; }
|
|
|
+ .group { margin-bottom: 30px; page-break-inside: avoid; }
|
|
|
+ .group-header { text-align: center; font-weight: bold; font-size: 16px; margin-bottom: 20px; border-bottom: 1px solid #333; padding: 10px; }
|
|
|
.segment { margin-bottom: 10px; margin-left: 20px; }
|
|
|
+ .episode-content { white-space: pre-wrap; }
|
|
|
</style>';
|
|
|
|
|
|
// 标题
|
|
|
$html .= '<h1>' . htmlspecialchars($script['script_name']) . '</h1>';
|
|
|
|
|
|
- // 剧本简介
|
|
|
- if (!empty($script['intro'])) {
|
|
|
- $html .= '<h2>剧本简介</h2>';
|
|
|
- $html .= '<p>' . nl2br(htmlspecialchars($script['intro'])) . '</p>';
|
|
|
- }
|
|
|
-
|
|
|
- // 亮点
|
|
|
- if (!empty($script['highlights'])) {
|
|
|
- $html .= '<h2>亮点</h2>';
|
|
|
- $html .= '<p>' . nl2br(htmlspecialchars($script['highlights'])) . '</p>';
|
|
|
- }
|
|
|
-
|
|
|
- // 核心矛盾
|
|
|
- if (!empty($script['core_contradiction'])) {
|
|
|
- $html .= '<h2>核心矛盾</h2>';
|
|
|
- $html .= '<p>' . nl2br(htmlspecialchars($script['core_contradiction'])) . '</p>';
|
|
|
- }
|
|
|
-
|
|
|
- // 艺术风格
|
|
|
- if (!empty($script['art_style'])) {
|
|
|
- $html .= '<h2>艺术风格</h2>';
|
|
|
- $html .= '<p>' . nl2br(htmlspecialchars($script['art_style'])) . '</p>';
|
|
|
- }
|
|
|
-
|
|
|
- // 角色列表
|
|
|
- if (!empty($script['roles']) && is_array($script['roles'])) {
|
|
|
- $html .= '<h2>角色列表</h2>';
|
|
|
- $html .= '<ul>';
|
|
|
- foreach ($script['roles'] as $role) {
|
|
|
- if (is_array($role) || is_object($role)) {
|
|
|
- $html .= '<li>' . htmlspecialchars(getProp($role, 'role', '')) . ':' . htmlspecialchars(getProp($role, 'description', '')) . '</li>';
|
|
|
- } else {
|
|
|
- $html .= '<li>' . htmlspecialchars($role) . '</li>';
|
|
|
+ // 处理分组数据
|
|
|
+ if (!empty($script['group']) && is_array($script['group'])) {
|
|
|
+ $groups = (array)$script['group'];
|
|
|
+
|
|
|
+ foreach ($groups as $group) {
|
|
|
+ $html .= '<div class="group">';
|
|
|
+
|
|
|
+ // 分组标题
|
|
|
+ $groupTitle = '第' . $group['start_episode_number'] . '-' . $group['end_episode_number'] . '集';
|
|
|
+ $html .= '<div class="group-header">' . htmlspecialchars($groupTitle) . '</div>';
|
|
|
+
|
|
|
+ // 故事梗概
|
|
|
+ if (!empty($group['intro'])) {
|
|
|
+ $html .= '<h3>故事梗概</h3>';
|
|
|
+ $html .= '<p>' . nl2br(htmlspecialchars($group['intro'])) . '</p>';
|
|
|
}
|
|
|
- }
|
|
|
- $html .= '</ul>';
|
|
|
- }
|
|
|
-
|
|
|
- // 角色关系
|
|
|
- if (!empty($script['role_relationship'])) {
|
|
|
- $html .= '<h2>角色关系</h2>';
|
|
|
- $html .= '<p>' . nl2br(htmlspecialchars($script['role_relationship'])) . '</p>';
|
|
|
- }
|
|
|
-
|
|
|
- // 场景列表
|
|
|
- if (!empty($script['scenes']) && is_array($script['scenes'])) {
|
|
|
- $html .= '<h2>场景列表</h2>';
|
|
|
- $html .= '<ul>';
|
|
|
- foreach ($script['scenes'] as $scene) {
|
|
|
- if (is_array($scene) || is_object($scene)) {
|
|
|
- $html .= '<li>' . htmlspecialchars(getProp($scene, 'scene', '')) . ':' . htmlspecialchars(getProp($scene, 'description', '')) . '</li>';
|
|
|
- } else {
|
|
|
- $html .= '<li>' . htmlspecialchars($scene) . '</li>';
|
|
|
+
|
|
|
+ // 剧本亮点
|
|
|
+ if (!empty($group['highlights'])) {
|
|
|
+ $html .= '<h3>剧本亮点</h3>';
|
|
|
+ $html .= '<p>' . nl2br(htmlspecialchars($group['highlights'])) . '</p>';
|
|
|
}
|
|
|
- }
|
|
|
- $html .= '</ul>';
|
|
|
- }
|
|
|
-
|
|
|
- // 分集内容
|
|
|
- if (!empty($script['episodes']) && is_array($script['episodes'])) {
|
|
|
- $html .= '<h2>分集内容</h2>';
|
|
|
-
|
|
|
- foreach ($script['episodes'] as $episode) {
|
|
|
- $html .= '<div class="episode">';
|
|
|
- $html .= '<h3>第' . htmlspecialchars($episode['episode_number']) . '集';
|
|
|
- if (!empty($episode['episode_name'])) {
|
|
|
- $html .= ':' . htmlspecialchars($episode['episode_name']);
|
|
|
+
|
|
|
+ // 人物关系
|
|
|
+ if (!empty($group['role_relationship'])) {
|
|
|
+ $html .= '<h3>人物关系</h3>';
|
|
|
+ $html .= '<p>' . nl2br(htmlspecialchars($group['role_relationship'])) . '</p>';
|
|
|
}
|
|
|
- $html .= '</h3>';
|
|
|
-
|
|
|
- // 处理分集内容
|
|
|
- if (!empty($episode['episode_content'])) {
|
|
|
- $html .= '<div class="segment">';
|
|
|
- // 去掉第一行(标题行)
|
|
|
- $content = $episode['episode_content'];
|
|
|
- $lines = explode("\n", $content);
|
|
|
- if (count($lines) > 1) {
|
|
|
- array_shift($lines); // 移除第一行
|
|
|
- $content = implode("\n", $lines);
|
|
|
- } else {
|
|
|
- $content = ''; // 如果只有一行,则清空
|
|
|
+
|
|
|
+ // 核心矛盾
|
|
|
+ if (!empty($group['core_contradiction'])) {
|
|
|
+ $html .= '<h3>核心矛盾</h3>';
|
|
|
+ $html .= '<p>' . nl2br(htmlspecialchars($group['core_contradiction'])) . '</p>';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 主体列表
|
|
|
+ if (!empty($group['roles']) && is_array($group['roles'])) {
|
|
|
+ $html .= '<h3>主体列表</h3>';
|
|
|
+ $html .= '<ul>';
|
|
|
+ foreach ($group['roles'] as $role) {
|
|
|
+ $html .= '<li>' . htmlspecialchars(getProp($role, 'role')) . ':' . htmlspecialchars(getProp($role, 'description')) . '</li>';
|
|
|
}
|
|
|
- $html .= nl2br(htmlspecialchars($content));
|
|
|
- $html .= '</div>';
|
|
|
+ $html .= '</ul>';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 美术风格
|
|
|
+ if (!empty($group['art_style'])) {
|
|
|
+ $html .= '<h3>美术风格</h3>';
|
|
|
+ $html .= '<p>' . nl2br(htmlspecialchars($group['art_style'])) . '</p>';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 场景列表
|
|
|
+ if (!empty($group['scenes']) && is_array($group['scenes'])) {
|
|
|
+ $html .= '<h3>场景列表</h3>';
|
|
|
+ $html .= '<ul>';
|
|
|
+ foreach ($group['scenes'] as $scene) {
|
|
|
+ $html .= '<li>' . htmlspecialchars(getProp($scene, 'scene')) . ':' . htmlspecialchars(getProp($scene, 'description')) . '</li>';
|
|
|
+ }
|
|
|
+ $html .= '</ul>';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分集剧本
|
|
|
+ if (!empty($group['episode_content'])) {
|
|
|
+ $html .= '<h3>分集剧本</h3>';
|
|
|
+ // 去除零宽字符和其他不可见字符
|
|
|
+ $cleanContent = preg_replace('/[\x{200B}-\x{200D}\x{FEFF}]/u', '', $group['episode_content']);
|
|
|
+ $cleanContent = preg_replace('/[\x{00}-\x{08}\x{0B}\x{0C}\x{0E}-\x{1F}\x{7F}]/u', '', $cleanContent);
|
|
|
+ $html .= '<div class="episode-content">' . nl2br(htmlspecialchars($cleanContent)) . '</div>';
|
|
|
}
|
|
|
|
|
|
$html .= '</div>';
|