feat(services): 新建软件开发、APP与小程序定制、智能体开发三大专属独立页面并在新窗口中打开
这个提交包含在:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* 三大服务独立页改版与内容规范测试 (PHP TDD 模式)
|
||||
* 验证:软件开发、APP与小程序定制、智能体开发三大专属独立页的完整性
|
||||
*/
|
||||
|
||||
class DedicatedServicePagesTest
|
||||
{
|
||||
private $passed = 0;
|
||||
private $failed = 0;
|
||||
|
||||
public function run()
|
||||
{
|
||||
echo "=== 开始执行三大核心服务独立页设计规范测试 (TDD) ===\n";
|
||||
|
||||
$baseDir = dirname(__DIR__);
|
||||
$softwareFile = $baseDir . '/addons/official/view/web/official_product/service_software.html';
|
||||
$appFile = $baseDir . '/addons/official/view/web/official_product/service_app.html';
|
||||
$agentFile = $baseDir . '/addons/official/view/web/official_product/service_agent.html';
|
||||
$navFile = $baseDir . '/addons/official/view/web/official_common/pc/nav.html';
|
||||
|
||||
$this->assert(file_exists($softwareFile), "软件开发独立页文件必须存在");
|
||||
$this->assert(file_exists($appFile), "APP与小程序定制独立页文件必须存在");
|
||||
$this->assert(file_exists($agentFile), "智能体开发独立页文件必须存在");
|
||||
|
||||
if (file_exists($softwareFile)) {
|
||||
$softwareContent = file_get_contents($softwareFile);
|
||||
$this->assert(strpos($softwareContent, '纳海川') !== false, "软件开发独立页包含品牌【纳海川】");
|
||||
$this->assert(strpos($softwareContent, '微服务') !== false && strpos($softwareContent, '中台') !== false, "软件开发独立页包含微服务与中台");
|
||||
}
|
||||
|
||||
if (file_exists($appFile)) {
|
||||
$appContent = file_get_contents($appFile);
|
||||
$this->assert(strpos($appContent, '纳海川') !== false, "APP小程序独立页包含品牌【纳海川】");
|
||||
$this->assert(strpos($appContent, '60fps') !== false || strpos($appContent, '蓝牙') !== false, "APP小程序独立页包含真实移动工程指标");
|
||||
}
|
||||
|
||||
if (file_exists($agentFile)) {
|
||||
$agentContent = file_get_contents($agentFile);
|
||||
$this->assert(strpos($agentContent, '纳海川') !== false, "智能体独立页包含品牌【纳海川】");
|
||||
$this->assert(strpos($agentContent, 'RAG') !== false || strpos($agentContent, '物理隔离') !== false, "智能体独立页包含RAG与物理隔离保障");
|
||||
}
|
||||
|
||||
if (file_exists($navFile)) {
|
||||
$navContent = file_get_contents($navFile);
|
||||
$this->assert(strpos($navContent, 'service_software') !== false || strpos($navContent, 'service=software') !== false, "导航卡片支持跳转软件开发独立页");
|
||||
$this->assert(strpos($navContent, 'service_app') !== false || strpos($navContent, 'service=app') !== false, "导航卡片支持跳转APP小程序独立页");
|
||||
$this->assert(strpos($navContent, 'service_agent') !== false || strpos($navContent, 'service=agent') !== false, "导航卡片支持跳转智能体独立页");
|
||||
}
|
||||
|
||||
echo "\n测试结果: {$this->passed} 通过, {$this->failed} 失败\n";
|
||||
return $this->failed === 0;
|
||||
}
|
||||
|
||||
private function assert($condition, $message)
|
||||
{
|
||||
if ($condition) {
|
||||
echo " [PASS] {$message}\n";
|
||||
$this->passed++;
|
||||
} else {
|
||||
echo " [FAIL] {$message}\n";
|
||||
$this->failed++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,6 +270,15 @@ def test_journalism_and_articles_suite():
|
||||
res.assert_true(test_result.wasSuccessful(), f"新闻资讯与文章深度断言全部通过 (共 {test_result.testsRun} 项)")
|
||||
return res.summary()
|
||||
|
||||
def test_dedicated_service_pages_suite():
|
||||
res = TestResult("三大服务独立页专项测试 (DedicatedServicePages)")
|
||||
from tests.test_dedicated_service_pages import DedicatedServicePagesTest
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(DedicatedServicePagesTest)
|
||||
runner = unittest.TextTestRunner(verbosity=0)
|
||||
test_result = runner.run(suite)
|
||||
res.assert_true(test_result.wasSuccessful(), f"三大服务独立页断言全部通过 (共 {test_result.testsRun} 项)")
|
||||
return res.summary()
|
||||
|
||||
def main():
|
||||
import unittest
|
||||
results = [
|
||||
@@ -284,7 +293,8 @@ def main():
|
||||
test_ad_law_compliance_suite(),
|
||||
test_natural_copywriting_suite(),
|
||||
test_homepage_button_links_suite(),
|
||||
test_journalism_and_articles_suite()
|
||||
test_journalism_and_articles_suite(),
|
||||
test_dedicated_service_pages_suite()
|
||||
]
|
||||
sys.exit(0 if all(results) else 1)
|
||||
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
三大核心服务独立页面 (Dedicated Service Pages) TDD 验证
|
||||
覆盖:软件开发独立页、APP与小程序定制独立页、智能体开发独立页
|
||||
验证必备板块:分类、能力、流程、交付、FAQ、CTA、设计规范、去AI味道与禁止项,以及导航卡片联动
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import unittest
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
class DedicatedServicePagesTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.software_page = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_product', 'service_software.html')
|
||||
self.app_page = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_product', 'service_app.html')
|
||||
self.agent_page = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_product', 'service_agent.html')
|
||||
self.nav_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_common', 'pc', 'nav.html')
|
||||
self.home_path = os.path.join(BASE_DIR, 'addons', 'official', 'view', 'web', 'official_home', 'index.html')
|
||||
self.controller_path = os.path.join(BASE_DIR, 'addons', 'official', 'controller', 'web', 'OfficialProduct.php')
|
||||
|
||||
def test_01_files_exist(self):
|
||||
"""三个独立服务页面模板文件必须全部存在"""
|
||||
self.assertTrue(os.path.exists(self.software_page), "软件开发独立页模板 (service_software.html) 必须存在")
|
||||
self.assertTrue(os.path.exists(self.app_page), "APP与小程序定制独立页模板 (service_app.html) 必须存在")
|
||||
self.assertTrue(os.path.exists(self.agent_page), "智能体开发独立页模板 (service_agent.html) 必须存在")
|
||||
|
||||
def test_02_software_service_page_content(self):
|
||||
"""软件开发独立页必须包含完备板块与专业工程实践"""
|
||||
if not os.path.exists(self.software_page):
|
||||
self.fail("service_software.html 不存在")
|
||||
with open(self.software_page, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
self.assertIn("纳海川", content, "必须包含品牌名【纳海川】")
|
||||
self.assertFalse(re.search(r'纳川(?!海)', content), "严禁简称为【纳川】")
|
||||
self.assertIn("软件开发", content, "核心标题必须体现软件开发")
|
||||
# 必备板块:分类、能力、流程、交付、FAQ
|
||||
self.assertTrue("nhc-services-categories" in content or "分类" in content or "业务场景" in content, "必须包含业务分类或场景板块")
|
||||
self.assertTrue("nhc-tech-capabilities" in content or "能力" in content or "技术底座" in content, "必须包含核心技术能力板块")
|
||||
self.assertTrue("nhc-delivery-process" in content or "流程" in content or "研发流程" in content, "必须包含工程化流程板块")
|
||||
self.assertTrue("nhc-deliverables" in content or "交付" in content or "交付标准" in content, "必须包含交付物清单板块")
|
||||
self.assertTrue("nhc-faq" in content or "FAQ" in content or "常见问答" in content, "必须包含常见问题解答板块")
|
||||
|
||||
# 真实工程栈与去AI化
|
||||
self.assertTrue("微服务" in content and "中台" in content, "必须体现企业级微服务与中台定制能力")
|
||||
self.assertTrue("源码" in content, "必须承诺交付完整源代码")
|
||||
self.assertFalse(re.search(r'[\U0001F600-\U0001F64F\U0001F300-\U0001F5FF\U0001F680-\U0001F6FF\u2600-\u26FF\u2700-\u27BF]', content), "严禁使用 emoji")
|
||||
|
||||
def test_03_app_service_page_content(self):
|
||||
"""APP与小程序定制独立页必须包含移动生态全覆盖与真实指标"""
|
||||
if not os.path.exists(self.app_page):
|
||||
self.fail("service_app.html 不存在")
|
||||
with open(self.app_page, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
self.assertIn("纳海川", content, "必须包含品牌名【纳海川】")
|
||||
self.assertFalse(re.search(r'纳川(?!海)', content), "严禁简称为【纳川】")
|
||||
self.assertTrue("APP" in content and "小程序" in content, "核心标题必须体现 APP 与小程序定制")
|
||||
# 必备板块
|
||||
self.assertTrue("分类" in content or "业务场景" in content or "终端覆盖" in content, "必须包含多端覆盖分类板块")
|
||||
self.assertTrue("能力" in content or "技术" in content or "性能规格" in content, "必须包含移动核心能力板块")
|
||||
self.assertTrue("流程" in content or "研发流程" in content, "必须包含端到端交付流程板块")
|
||||
self.assertTrue("交付" in content or "交付物" in content or "交付标准" in content, "必须包含交付清单板块")
|
||||
self.assertTrue("FAQ" in content or "问答" in content, "必须包含常见问题解答板块")
|
||||
|
||||
# 移动特色真实能力
|
||||
self.assertTrue("iOS" in content and "Android" in content and "微信" in content, "必须覆盖 iOS / Android 与微信生态")
|
||||
self.assertTrue("60fps" in content or "蓝牙" in content or "离线" in content, "必须体现真实移动工程指标")
|
||||
self.assertFalse(re.search(r'[\U0001F600-\U0001F64F\U0001F300-\U0001F5FF\U0001F680-\U0001F6FF\u2600-\u26FF\u2700-\u27BF]', content), "严禁使用 emoji")
|
||||
|
||||
def test_04_agent_service_page_content(self):
|
||||
"""智能体开发独立页必须包含企业级私域合规与知识工程落地"""
|
||||
if not os.path.exists(self.agent_page):
|
||||
self.fail("service_agent.html 不存在")
|
||||
with open(self.agent_page, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
self.assertIn("纳海川", content, "必须包含品牌名【纳海川】")
|
||||
self.assertFalse(re.search(r'纳川(?!海)', content), "严禁简称为【纳川】")
|
||||
self.assertTrue("智能体" in content, "核心标题必须体现智能体开发")
|
||||
# 必备板块
|
||||
self.assertTrue("分类" in content or "业务场景" in content or "应用矩阵" in content, "必须包含智能体分类与场景板块")
|
||||
self.assertTrue("能力" in content or "技术" in content or "技术底座" in content, "必须包含核心技术底座板块")
|
||||
self.assertTrue("流程" in content or "实施流程" in content, "必须包含工程化实施流程板块")
|
||||
self.assertTrue("交付" in content or "交付物" in content or "交付标准" in content, "必须包含交付物清单板块")
|
||||
self.assertTrue("FAQ" in content or "问答" in content, "必须包含常见技术问答板块")
|
||||
|
||||
# 私有合规与 RAG 真实特征
|
||||
self.assertTrue("RAG" in content or "向量" in content, "必须包含企业级 RAG 向量工程")
|
||||
self.assertTrue("物理隔离" in content or "私有化" in content or "0 外泄" in content or "0外泄" in content, "必须体现内网物理隔离与数据安全保障")
|
||||
self.assertFalse(re.search(r'[\U0001F600-\U0001F64F\U0001F300-\U0001F5FF\U0001F680-\U0001F6FF\u2600-\u26FF\u2700-\u27BF]', content), "严禁使用 emoji")
|
||||
|
||||
def test_05_nav_mega_menu_links_to_dedicated_pages(self):
|
||||
"""顶部导航服务矩阵中的三个卡片必须分别指向独立的页面"""
|
||||
with open(self.nav_path, 'r', encoding='utf-8') as f:
|
||||
nav_html = f.read()
|
||||
|
||||
# 提取服务下拉菜单中的三个卡片链接
|
||||
self.assertTrue(
|
||||
"service_software" in nav_html or "service=software" in nav_html,
|
||||
"导航【软件开发】卡片必须链接到专属独立页面"
|
||||
)
|
||||
self.assertTrue(
|
||||
"service_app" in nav_html or "service=app" in nav_html,
|
||||
"导航【APP与小程序定制】卡片必须链接到专属独立页面"
|
||||
)
|
||||
self.assertTrue(
|
||||
"service_agent" in nav_html or "service=agent" in nav_html,
|
||||
"导航【智能体开发】卡片必须链接到专属独立页面"
|
||||
)
|
||||
|
||||
def test_06_controller_supports_dedicated_pages(self):
|
||||
"""OfficialProduct 控制器必须具备独立页面分发逻辑或独立动作"""
|
||||
with open(self.controller_path, 'r', encoding='utf-8') as f:
|
||||
code = f.read()
|
||||
|
||||
has_software_route = "service_software" in code or "software" in code
|
||||
has_app_route = "service_app" in code or "app" in code
|
||||
has_agent_route = "service_agent" in code or "agent" in code
|
||||
self.assertTrue(has_software_route and has_app_route and has_agent_route, "控制器必须支持软件开发、APP小程序、智能体独立页面")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
在新工单中引用
屏蔽一个用户