首页
关于
友链
推荐
肥啾解析
百度一下
肥啾GPT
Search
1
宝塔面板登录 phpMyAdmin 提示服务器和客户端上指示的HTTPS之间不匹配
269 阅读
2
Customer complaints evolve with in-car tech
188 阅读
3
JavaScript解析
153 阅读
4
内连接,左连接,右连接作用及区别
111 阅读
5
所谓关系
109 阅读
默认分类
网游架设
手机游戏
python
PHP
Mysql
VBA
C++
JAVASCRIPT
javascript基础
Oracle
生产管理
计划控制
ERP系统开发
APS排产
MES研究
考勤系统
CPA
财管
实务
经济法
战略
审计
税法
藏书架
古典名著
世界名著
编程秘籍
攻防渗透
经管书籍
大佬传经
风雅读物
考试相关
心情格言
拾玉良言
外文报刊
外刊随选
Facebook
Twitter
China Daily
软考
登录
Search
标签搜索
期刊读物
古文
何瑜明
累计撰写
160
篇文章
累计收到
154
条评论
首页
栏目
默认分类
网游架设
手机游戏
python
PHP
Mysql
VBA
C++
JAVASCRIPT
javascript基础
Oracle
生产管理
计划控制
ERP系统开发
APS排产
MES研究
考勤系统
CPA
财管
实务
经济法
战略
审计
税法
藏书架
古典名著
世界名著
编程秘籍
攻防渗透
经管书籍
大佬传经
风雅读物
考试相关
心情格言
拾玉良言
外文报刊
外刊随选
Facebook
Twitter
China Daily
软考
页面
关于
友链
推荐
肥啾解析
百度一下
肥啾GPT
搜索到
160
篇与
的结果
2025-07-24
php操作Oracle数据库示例
下面是一个完整的 PHP 操作 Oracle 数据库命令指南,涵盖了从连接到基本操作的实用代码示例:1. 连接数据库<?php // 配置连接信息 $db_host = "localhost"; $db_port = "1521"; $db_service = "ORCL"; // 服务名 $db_user = "PLM_TEST"; $db_pass = "your_password"; // 实际密码 // 创建连接 $conn = oci_connect( $db_user, $db_pass, "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$db_host)(PORT=$db_port))(CONNECT_DATA=(SERVICE_NAME=$db_service)))" ); if (!$conn) { $e = oci_error(); die("连接失败: " . $e['message']); } else { echo "Oracle 数据库连接成功!"; } ?>2. 执行查询// 准备SQL语句 $sql = "SELECT employee_id, first_name, last_name FROM employees WHERE department_id = :dept_id"; // 创建语句句柄 $stmt = oci_parse($conn, $sql); // 绑定参数(防止SQL注入) $dept_id = 50; oci_bind_by_name($stmt, ":dept_id", $dept_id); // 执行查询 oci_execute($stmt); // 获取结果 echo "<table border='1'>"; echo "<tr><th>ID</th><th>名字</th><th>姓氏</th></tr>"; while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { echo "<tr>"; echo "<td>" . $row['EMPLOYEE_ID'] . "</td>"; echo "<td>" . $row['FIRST_NAME'] . "</td>"; echo "<td>" . $row['LAST_NAME'] . "</td>"; echo "</tr>"; } echo "</table>"; // 释放资源 oci_free_statement($stmt);3. 插入数据$sql = "INSERT INTO employees (employee_id, first_name, last_name, email, hire_date, job_id) VALUES (employees_seq.nextval, :fname, :lname, :email, SYSDATE, :job_id)"; $stmt = oci_parse($conn, $sql); // 绑定参数 $fname = "张"; $lname = "三"; $email = "zhangsan@example.com"; $job_id = "IT_PROG"; oci_bind_by_name($stmt, ":fname", $fname); oci_bind_by_name($stmt, ":lname", $lname); oci_bind_by_name($stmt, ":email", $email); oci_bind_by_name($stmt, ":job_id", $job_id); // 执行并检查结果 if (oci_execute($stmt)) { echo "新记录插入成功!"; oci_commit($conn); // 提交事务 } else { $e = oci_error($stmt); echo "插入失败: " . $e['message']; } oci_free_statement($stmt);4. 更新数据$sql = "UPDATE employees SET salary = :salary WHERE employee_id = :emp_id"; $stmt = oci_parse($conn, $sql); $salary = 8000; $emp_id = 100; oci_bind_by_name($stmt, ":salary", $salary); oci_bind_by_name($stmt, ":emp_id", $emp_id); if (oci_execute($stmt)) { echo "记录更新成功!"; oci_commit($conn); } else { $e = oci_error($stmt); echo "更新失败: " . $e['message']; } oci_free_statement($stmt);5. 删除数据$sql = "DELETE FROM employees WHERE employee_id = :emp_id"; $stmt = oci_parse($conn, $sql); $emp_id = 207; oci_bind_by_name($stmt, ":emp_id", $emp_id); if (oci_execute($stmt)) { echo "记录删除成功!"; oci_commit($conn); } else { $e = oci_error($stmt); echo "删除失败: " . $e['message']; } oci_free_statement($stmt);6. 调用存储过程// 假设有存储过程: get_employee_name(emp_id IN NUMBER, emp_name OUT VARCHAR2) $sql = "BEGIN get_employee_name(:emp_id, :emp_name); END;"; $stmt = oci_parse($conn, $sql); $emp_id = 100; $emp_name = ""; // 用于接收输出 oci_bind_by_name($stmt, ":emp_id", $emp_id); oci_bind_by_name($stmt, ":emp_name", $emp_name, 100); // 100是缓冲区大小 oci_execute($stmt); echo "员工姓名: " . $emp_name; oci_free_statement($stmt);7. 事务处理// 关闭自动提交 oci_set_autocommit($conn, false); try { // 执行多个操作... $stmt1 = oci_parse($conn, "UPDATE accounts SET balance = balance - 100 WHERE id = 1"); oci_execute($stmt1); $stmt2 = oci_parse($conn, "UPDATE accounts SET balance = balance + 100 WHERE id = 2"); oci_execute($stmt2); // 提交事务 oci_commit($conn); echo "事务执行成功!"; } catch (Exception $e) { // 回滚事务 oci_rollback($conn); echo "事务失败: " . $e->getMessage(); } oci_free_statement($stmt1); oci_free_statement($stmt2);8. 错误处理最佳实践function execute_query($conn, $sql, $params = []) { $stmt = oci_parse($conn, $sql); if (!$stmt) { $e = oci_error($conn); throw new Exception("SQL解析失败: " . $e['message']); } // 绑定参数 foreach ($params as $key => $value) { oci_bind_by_name($stmt, $key, $params[$key]); } if (!oci_execute($stmt)) { $e = oci_error($stmt); throw new Exception("查询执行失败: " . $e['message']); } return $stmt; } // 使用示例 try { $stmt = execute_query($conn, "SELECT * FROM products WHERE category = :cat", [":cat" => "Electronics"] ); // 处理结果... } catch (Exception $e) { echo "错误: " . $e->getMessage(); }9. 关闭连接// 关闭连接 oci_close($conn);📌 重要注意事项:安全第一:始终使用 oci_bind_by_name() 防止SQL注入不要在代码中硬编码密码(使用环境变量或配置文件)最小权限原则:使用普通用户而非SYSTEM性能优化:// 设置预取行数(提高查询性能) oci_set_prefetch($stmt, 100); // 使用持久连接(高并发场景) $conn = oci_pconnect($user, $pass, $connection_string);数据类型处理:// 处理CLOB类型 $clob = oci_new_descriptor($conn, OCI_D_LOB); oci_bind_by_name($stmt, ":clob_data", $clob, -1, OCI_B_CLOB); // 处理日期 $date = date('d-M-Y'); oci_bind_by_name($stmt, ":hire_date", $date);替代连接方式(PDO):$dbh = new PDO("oci:dbname=//localhost:1521/ORCL;charset=UTF8", $user, $pass); $stmt = $dbh->prepare("SELECT * FROM employees WHERE id = :id"); $stmt->execute([':id' => 100]);这些示例覆盖了PHP操作Oracle数据库的常见场景,建议从简单查询开始练习,逐步掌握事务处理和存储过程调用等高级功能。
2025年07月24日
2 阅读
0 评论
0 点赞
2025-07-23
Oracle和MySQL语法区别
最近需要迁移项目,将数据库由Oracle改为MySQL。由于两者的语法有部分不一样,所以需要把Oracle中能用但MySQL中不能用的函数/类型等改为MySQL中能用的,以下是总结出的部分语法区别:一、数据类型Number类型MySQL中是没有Number类型的,但有int/decimal 类型,Oracle中的Number(5,1)对应MySQL中的decimal(5,1),Number(5) 对应 int(5)。MySQL中的数字型类型比较多,分的也比较细,还有tinyint、smallint、mediumint、bigint等类型Varchar2(n)类型MySQL中对应Oracle Varchar2(n)类型的替代类型是varchar(n)类型。Date 类型MySQL 中的日期时间类型有Date、Time、Datetime等类型,MySQL中Date类型仅表示日期(年-月-日),Time类型仅表示时间(时:分:秒),而Datetime类型表示日期时间(年-月-日 时:分:秒),Oracle中的Date类型和MySQL中的Datetime类型一致。二、函数length(str)函数Oracle中的length(str)是获取字符串长度的函数,MySQL 中对应的函数为char_length(str)。sys_guid()函数Oracle中可通过sys_guid()函数是生成随机序列,MySQL通过UUID()生成随机序列。时间格式化函数将时间转换为字符串型时间 MySQL date_format(NOW(),'%Y-%m-%d') 对应Oracle的 Oracle中的 to_char(sysdate, 'YYYY-MM-DD');将字符串型时间转换为时间类型 MySQL str_to_date('2019-01-01','%Y-%m-%d') 对应Oracle中的 to_date('2019-01-01', 'YYYY-MM-DD');包括时分秒的函数转换:DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'),str_to_date('2019-01-01','%Y-%m-%d %H:%i:%s')。条件函数(nvl()、nvl2()、decode())nvl(tab.columnName, 0):如果tab.columnName值为空,则返回值取0,否则取tab.columnName;对应的MySQL函数为:ifnull(tab.columnName, 0)。nvl2(expr1,expr2,expr3):如果expr1不为null,则返回expr2,否则返回expr3;对应的MySQL函数为:if(expr1,expr2,expr3)。DECODE(value, val1, val2, val3):如果value等于val1,则返回val2,否则返回val3;MySQL可用IF函数表示:if(value=val1, val2, val3);DECODE(value, if1, val1, if2,val2,...,ifn, valn, val):如果value等于if1,则返回val1,如果value等于if2,则返回value2...如果value等于ifn,则返回valn,否则返回val;MySQL对于这种判断可以通过case when then else end;l来判断,即:case when value=if1 then val1 when value=if2 then val2,,,when value=ifn then valn else val end;trunc()函数TRUNC(12.123):返回整数(12);MySQL对应的函数:truncate(12.123, 0);TRUNC(12.123, 2):返回值保留2为小数(12.12);MySQL对应的函数:truncate(12.123, 2);TRUNC(SYSDATE):返回值为(2019-07-26 00:00:00);MySQL对应的为cast(now() as datetime):返回值为(2019-07-26 14:11:38);MySQL的cast函数语法为:CAST(xxx AS 类型) (可用类型为:二进制,同带binary前缀的效果:BINARY;字符型,可带参数:CHAR();日期:DATE;时间:TIME;日期时间型: DATETIME;浮点数: DECIMAL;整数:SIGNED;无符号整数:UNSIGNED)to_char() to_number()to_char(123):将数字123转换为字符串123;MySQL对应的函数为CAST(123 AS CHAR(3));to_number('123'):将字符串数字123转换为数字类型;MySQL对应的函数为cast('123' as SIGNED);sysdate 当前时间sysdate:返回当前日期+时间; MySQL对应的函数为 now();三、其他引号MySQL可识别双引号和单引号,Oracle只能识别单引号。字符串连接符 ||Oracle 可用'||'来连接字符串,但MySQL不支持'||'连接,MySQL可通过concat()函数链接字符串。Oracle的 a.studentname||'【'||a.studentno||'】' 相当于 MySQL的 concat(a.studentname, '【', a.studentno, '】')ROWNUMOracle可通过rownum获取前n条记录,MySQL通过limit来获取前n条记录,但二者的写法略有不同,在Oracle中rownum作为where条件的一部分,而MySQL中limit不是where条件的一部分。-- rownum语法如下:SELECT * FROM XJ_STUDENT WHERE ROWNUM = 1; -- 查询第一条数据SELECT * FROM XJ_STUDENT WHERE ROWNUM <= 10; -- 获取前10条数据-- 但rownum不支持查询后几条或第n(n>1)条数据,例如以下sql是不支持的SELECT * FROM XJ_STUDENT WHERE ROWNUM > 2;SELECT * FROM XJ_STUDENT WHERE ROWNUM = 3;-- limit 语法如下:SELECT * from fw_department limit 3; -- 查询前3条数据SELECT * from fw_department limit 2, 4; -- 从第2(序号从0开始)条开始,查4条记录空数据排序(nulls first 和nulls last)-- null值排在最前SELECT * FROM FW_DEPARTMENT A ORDER BY A.REMARK DESC NULLS FIRST-- null值排在最后SELECT * FROM FW_DEPARTMENT A ORDER BY A.REMARK DESC NULLS LAST-- MySQL 可通过IF和ISNULL函数达到相同的效果-- null值排在最后select * from FW_DEPARTMENT A order by IF(ISNULL(A.REMARK),1,0),A.REMARK desc-- null值排在最前select * from FW_DEPARTMENT A order by IF(ISNULL(A.REMARK),0,1),A.REMARK desc表(左/右)关联(+)Oracle左连接,右连接可以使用(+)来实现. MySQL只能使用left join ,right join等关键字。-- Oracle 左关联select * from taba, tabb where taba.id = tabb.id(+);-- Oracle 右关联select * from taba, tabb where taba.id(+) = tabb.id;-- MySQL 左关联select * from taba left join tabb on taba.id=tabb.id;-- MySQL 右关联select * from taba right join tabb on taba.id=tabb.id;删除语法MySQL的删除语法没有Oracle那么随意,例如下面的sql在Oracle中可以执行,但在MySQL中就不可以。-- Oracle 可执行,但MySQL中不能执行DELETE FROM FW_DEPARTMENT A WHERE A.DEPID = '111';DELETE FW_DEPARTMENT WHERE DEPID = '111';-- MySQL中删除语句格式如下:DELETE FROM FW_DEPARTMENT WHERE DEPID = '111';递归查询(start with connect by prior)MySQL不支持(start with connect by prior)的这种递归查询,但可以通过自定义函数来实现。-- Oracle 递归查询 查询部门ID为‘1111’的所有子部门(包含自身)SELECT *FROM FW_DEPARTMENTSTART WITH DEPID='1111'CONNECT BY PRIOR DEPID = PARENTDEPID;-- Oracle 递归查询 查询部门ID为‘1111’的所有父部门(包含自身)SELECT *FROM FW_DEPARTMENTSTART WITH DEPID='1111'CONNECT BY PRIOR PARENTDEPID = DEPID;-- MySQL 先创建fun_getDepIDList函数,用于查询部门ID字符串CREATE FUNCTION fun_getDepIDList(rootId VARCHAR(32))RETURNS VARCHAR(6000)BEGINDECLARE pTemp VARCHAR(6000);DECLARE cTemp VARCHAR(6000);SET pTemp='$';SET cTemp=rootId;WHILE cTemp is not null DOset pTemp=CONCAT(pTemp,',',cTemp);SELECT GROUP_CONCAT(depid) INTO cTemp from fw_departmentWHERE FIND_IN_SET(PARENTDEPID,cTemp)>0;END WHILE;RETURN pTemp;END;-- 查询部门ID为‘1111’的所有子部门(包含自己)select * from fw_departmentwhere FIND_IN_SET(DEPID, fun_getDepIDList('1111'));-- 查询部门ID为‘1111’的所有父部门(包含自己)select * from fw_departmentwhere FIND_IN_SET('1111', fun_getDepIDList(DEPID));merge intoMySQL不支持(merge into),但提供的replace into 和on duplicate key update可实现相似的功能。-- Oracle merge into (有则修改,无则新增)MERGE INTO TMPDEPTAB AUSING (SELECT '1111' DEPID, '哈哈' DEPNAME FROM DUAL) BON (A.DEPID = B.DEPID)WHEN MATCHED THENUPDATE SET A.DEPNAME = B.DEPNAMEWHEN NOT MATCHED THENINSERT(DEPID, DEPNAME) VALUES(B.DEPID, B.DEPNAME);-- MySQL replace into (特点:1、先删后增; 2、插入/更新的表必须有主键或唯一索引;-- 3、未修改/新增的数据项,如果必填,则必须有默认值)-- 1、由于是先删后增,所以需要满足以下2个条件之一:-- 1.要么必填项有默认值;-- 2.要么插入/更新时为没有默认值的必填项赋值, 否则新增时会报错。-- 2、表中需要有主键或唯一索引,否则下面语句如果执行多次,表中会出现重复数据。replace into fw_department(DEPID,PARENTDEPID,DEPNO,DEPNAME)values('1111111', '1234','123', '哈哈');-- MySQL on duplicate key update (特点:1、插入/更新的表必须有主键或唯一索引;-- 2、未修改/新增的数据项,如果必填,则必须有默认值)insert into fw_department(depid,parentdepid,depno,depname)select '1111111' depid, '123' parentdepid, 'e12' depno, '哈哈哈哈' depnamefrom fw_departmenton duplicate keyupdate parentdepid = values(parentdepid),depno=values(depno),depname=values(depname);withOracle 中可用with来构建一个临时表,但MySQL不支持with,对应临时表,MySQL可通过小括号的方式来处理,但构建的临时表必须设置临时表名。-- Oracle with使用WITH TMPTAB AS (SELECT A.DEPID FROM FW_DEPARTMENT A)SELECT DEPIDFROM TMPTAB-- MySQL 构建临时表使用(此处必须给括号中的临时表设置表名)select b.depidfrom (select depidfrom fw_department) bhttps://blog.csdn.net/weixin_63021300/article/details/132267190?ops_request_misc=%257B%2522request%255Fid%2522%253A%252274a5a63189f4ae0093201ba847814e67%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=74a5a63189f4ae0093201ba847814e67&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_positive~default-2-132267190-null-null.142^v102^pc_search_result_base1&utm_term=oracle&spm=1018.2226.3001.4187
2025年07月23日
2 阅读
0 评论
0 点赞
2025-07-23
加分逻辑
1.重要关键字(required)匹配:·动力类型:用户输入提取到'FD',配置规格中包含'FD'(在"FD/FG/FLB20-25"中),因此匹配,加30分。·吨位:用户输入提取到20.配置规格中吨位范围是20-25(从"FD/FG/FLB20-25"解析得到),20在范围内,因此匹配,加30分。2.没有可选关键字,所以没有加分。3.其他元素匹配(加分项):配置规格被拆分为:["FD/FG/FLB20-25","国产品牌","充气(STD)"]遍历每个元素:·"FD/FG/FLB20-25": 这是一个复合描述,在用户输入中并没有完全出现。用户输入中只有'FD20T',所以不匹配。由于它不在CONFIG_VALUES. 其它中,所以按常规元素处理:未匹配,扣0. 1分。·"国产品牌": 在CONFIG_VALUES. 其它中。用户输入中没有“国产品牌”这个字符串,所以未匹配,扣10分。·"充气(STD)": 在CONFIG_VALUES. 其它中?注意,CONFIG_VALUES. 其它数组里包含了'充气(STD)'.用户输入中没有提到“充气(STD)”,所以未匹配,扣10分。4.特殊处理:因为当前系统是轮胎系统(在遍历轮胎系统时),并且用户输入中没有包含任何轮胎相关的关键词(比如“胎”),而配置规格中包含“充气(STD)”(这是默认轮胎配置),所以触发特殊加分:加60分。
2025年07月23日
2 阅读
0 评论
0 点赞
2025-07-15
测试
<?php header('Content-Type: application/json'); header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST'); // 配置常量 - 同步前端最新配置 define('CONFIG_VALUES', [ '动力类型' => ['FD', 'FB', 'FLB', 'FTB', 'FG', 'FCG', 'FRB', 'FR4D'], '吨位' => [10, 15, 18, 19, 20, 25, 30, 35, 40, 45, '50F', '50TF', 50, 70, 80, 100, '1A', '1B', '1C'], '发动机型号' => ['4JG2', '4TNE98', '6BG1', 'C240', 'K21', 'K21双燃料', 'K25', 'K25双燃料', 'PSI2.4', 'S4S', 'S6S', 'S6S-T', 'L4C25-T', 'V2403-M', 'V2403-CR', 'V2403', 'WG2503-LPG', '全柴485', 'V29-V037', '3E22YG51', '新柴485', '4D27G31', '4D29X41-024', '4D32G31', 'A495BPG', 'A498BPG', 'A498BT1', '新柴C490(国2)', '新柴C490(欧3A)', 'YC4A115-T300'], '国产发动机' => ['A495BPG', 'A498BPG', 'A498BT1', '新柴C490(国2)', '全柴485', '4D29X41-024', '3E22YG51'], '有加速发动机' => ['4TNE98', '6BG1', 'S6S-T', 'S6S', '4JG2', 'C240', 'K25', 'K21', 'C490BPG', 'A498BPG', '4D27G31', 'A495BPG', 'A498BT1', 'C490BPG-51', 'NC485', '4B4-45V32', 'V2403-M', 'S4S'], '电控品牌' => ['Inmotion', '凡几', '嘉晨', '松正', '柯蒂斯', '麦格米特', '维德G2', '维德G3', 'S2', 'M1', '维德25G2', '维德35G3', '维德50G1'], '国产电控' => ['凡几', '嘉晨'], '电压等级' => ['48V铅酸', '51.2V锂电', '72V铅酸', '76.8V锂电', '80V铅酸', '205Ah', '230Ah', '173Ah', '280Ah', '410Ah'], '挡板' => ['铅酸', '锂电'], '年款' => ['16', '17'], '阀片' => ['2SV', '3SV', '4SV', '5SV'], '座椅' => ['丰田样式悬浮座椅', 'TCM样式座椅', 'TCM样式悬浮座椅', '格拉默座椅', '丰田样式座椅(STD)', '丰田样式座椅+座椅开关', '格拉默座椅+拇指开关', 'TCM样式座椅+座椅开关', '薄型座椅', 'TCM样式悬浮座椅+座椅开关', '丰田样式悬浮座椅+座椅开关', '丰田样式悬浮座椅+座椅开关+扶手', '合力样式悬浮座椅'], '默认座椅' => ['丰田样式悬浮座椅'], '其它' => ['闪光警示灯', '蓝光灯', '工作灯', '大灯防护罩', '后腿架', '半圆后视镜', '加长把手', '加长前腿把手', '线槽盖板', '前雨挡', '上雨挡', '后雨挡', '一字红光灯', '货叉架摄像头', '铸造后桥', '加大水箱', '加高水箱', '油水分离', '高排消声器', '灭火消声器', '左高排气', '右高排气', 'OPS', 'LPG', '高挂预滤器', '实心胎', '环保实心胎', '隔音', '手刹开关', '手刹报警', '油水分离', '十叶风扇', '座椅开关', '索达多路阀', '格拉默座椅', '刷卡仪表', '分体式', '前双胎', 'BATI', 'FLB方向盘', '电瓶挡板', 'EGLM', '进箱', '半交流', '暖风', '驾驶室', '充气(STD)', '软连接', '后腿把手', '2SV', '3SV', '4SV', '5SV', '下进气', '高排气', '实心', '加大电瓶'], '其它2' => ['闪光警示灯', '蓝光灯', '工作灯', '大灯防护罩', '后腿架', '半圆后视镜', '加长把手', '加长前腿把手', '线槽盖板', '前雨挡', '上雨挡', '后雨挡', '一字红光灯', '货叉架摄像头', '铸造后桥', '加大水箱', '加高水箱', '油水分离', '高排消声器', '灭火消声器', '左高排气', '右高排气', 'OPS', 'LPG', '高挂预滤器', '实心胎', '环保实心胎', '隔音', '手刹开关', '手刹报警', '油水分离', '十叶风扇', '座椅开关', '索达多路阀', '格拉默座椅', '刷卡仪表', '分体式', '前双胎', 'BATI', 'FLB方向盘', '电瓶挡板', 'EGLM', '进箱', '半交流', '暖风', '驾驶室', '空调', '充气(STD)', '软连接', '后腿把手', '2SV', '3SV', '4SV', '5SV', '下进气', '高排气', '扶手', '电液比例', '实心', '加大电瓶'], '默认轮胎' => ['国产品牌', '充气(STD)'] ]); define('DEFAULT_CONFIGS', [ '充气(STD)', '国产品牌', '丰田样式悬浮座椅' ]); // 发动机型号代称映射表(同步前端) define('ENGINE_ALIASES', [ 'NC485' => '新柴485(国2)', 'C490BPG' => '新柴490(国2)', 'A495BPG' => '新柴495(国2)', 'A498BPG' => '新柴498(国2)', '4N23G31' => '新柴485(国3)', '4D27G31' => '新柴490(国3)', '4D30G31' => '新柴495(国3)', '4D32G31' => '新柴498(国3)', '4D35ZG' => '新柴4D35(国3)', 'C490BPG-51' => '新柴490(欧3A)', 'A498BT1' => '新柴498(欧3A)', '4D29X41-024' => '新柴490(国4)', '3E22YG51' => '新柴(欧5)', '4B4-45V32' => '全柴485(国3)', 'GQ4Y' => 'GQ4Y', '6102' => '6102(国3)', 'YC4A115-T300' => '玉柴(国3)', 'C240' => 'C240(ⅢA/国3)', '4JG2' => '4JG2(欧3A)', '6BG1' => '6BG1', 'K21' => 'K21', 'K25' => 'K25', 'K25EPA' => 'K25EPA', 'S4S' => 'S4S(国3)', '4EG' => '4EG', 'S6S' => 'S6S(ⅢA)', 'S6S-T' => 'S6S-T(国三)', '4TNE98' => '4TNE98(国3)', '4TNV94L' => '4TNV94L(国4)', 'V2403' => 'V2403-CR', 'WG2503-L' => 'WG2503-L', 'QSF3.8' => 'QSF3.8(国3)', 'L4CRTV' => '韩国LS(欧5)', 'PSI认证版' => 'PSI2.4', 'WG2503-GL' => 'WG2503-GL', 'V2403-M' => 'V2403-M', 'V29-50V42' => '全柴490(国4)', '6102(国3)' => '6102', '全柴485(国3)' => '4B4-45V32', '新柴490(国3)' => '4D27G31', '新柴485(国3)' => '4N23G31', '新柴495(国3)' => '4D30G31', '新柴498(国3)' => '4D32G31', '新柴4D35(国3)' => '4D35ZG', '新柴490(国4)' => '4D29X41-024', '4TNV94L(国4)' => '4TNV94L', '全柴490(国4)' => 'V29-50V42', '新柴495(国2)' => 'A495BPG', '新柴498(国2)' => 'A498BPG', '新柴490(国2)' => 'C490BPG', '新柴485(国2)' => 'NC485', '新柴490(欧3A)' => 'C490BPG-51', '新柴498(欧3A)' => 'A498BT1', '新柴(欧5)' => '3E22YG51', 'C240(ⅢA/国3)' => 'C240', '4JG2(欧3A)' => '4JG2', 'GQ4Y' => 'GQ4Y', '玉柴(国3)' => 'YC4A115-T300', '6BG1' => '6BG1', 'K21' => 'K21', 'K25' => 'K25', 'K25EPA' => 'K25EPA', 'S4S(国3)' => 'S4S', '4EG' => '4EG', 'S6S(ⅢA)' => 'S6S', 'S6S-T(国三)' => 'S6S-T', '4TNE98(国3)' => '4TNE98', 'V2403-CR' => 'V2403', 'WG2503-L' => 'WG2503-L', 'QSF3.8(国3)' => 'QSF3.8', '韩国LS(欧5)' => 'L4CRTV', 'PSI2.4' => 'PSI认证版', 'WG2503-GL' => 'WG2503-GL', 'V2403-M' => 'V2403-M', '35G3' => '维德G3', '/G3' => '维德G3' ]); // 获取输入数据 $input = json_decode(file_get_contents('php://input'), true); $productDesc = isset($input['productDesc']) ? trim($input['productDesc']) : ''; $spec = isset($input['spec']) ? trim($input['spec']) : ''; $debugSystem = isset($input['debugSystem']) ? trim($input['debugSystem']) : ''; // 新增调试系统参数 if ($productDesc === '' || $spec === '') { exitJson(['error' => '缺少品号描述或规格']); } // 读取配置数据 $configData = json_decode(file_get_contents('data.json'), true); if (!$configData) { exitJson(['error' => '配置数据未加载']); } // 预处理配置数据:替换发动机代称为标准名称(同步前端逻辑) $configData = array_map(function($item) { $newItem = $item; // 处理规格字段 foreach (ENGINE_ALIASES as $alias => $standard) { if (strpos($newItem['规格'], $alias) !== false) { $newItem['规格'] = str_replace($alias, $standard, $newItem['规格']); } } // 处理名称字段 foreach (ENGINE_ALIASES as $alias => $standard) { if (strpos($newItem['名称'], $alias) !== false) { $newItem['名称'] = str_replace($alias, $standard, $newItem['名称']); } } return $newItem; }, $configData); // 提取动力类型 $powerType = extractPowerType($productDesc, $spec); if (!$powerType) { exitJson(['error' => '无法识别动力类型']); } // 读取系统配置文件 $sysFile = 'systems_' . $powerType . '.json'; if (!file_exists($sysFile)) { exitJson(['error' => '缺少 ' . $powerType . ' 的系统配置文件']); } $systemConfig = json_decode(file_get_contents($sysFile), true); // 提取关键配置值(同步前端逻辑,新增发动机代称处理) $extractedValues = extractConfigValues($productDesc, $spec, $powerType); // 执行匹配(新增调试系统参数) $results = matchConfigurations($configData, $productDesc, $spec, $systemConfig, $extractedValues, $debugSystem); exitJson([ 'powerType' => $powerType, 'extractedValues' => $extractedValues, 'matched' => $results['matched'], 'debugInfo' => $results['debugInfo'] // 返回调试信息 ]); // ========== 函数区 ========== function exitJson($data) { echo json_encode($data, JSON_UNESCAPED_UNICODE); exit; } // 提取动力类型(逻辑不变) function extractPowerType($productDesc, $spec) { $text = $productDesc . ' ' . $spec; foreach (CONFIG_VALUES['动力类型'] as $type) { if (stripos($text, $type) !== false) { return $type; } } return null; } // 提取配置值(同步前端,新增发动机代称处理) function extractConfigValues($productDesc, $spec, $powerType) { $values = [ '动力类型' => $powerType, '吨位' => null, '发动机型号' => null, '电控品牌' => null, '电压等级' => null, '挡板' => null, '年款' => null, '阀片' => null, '座椅' => null ]; $allText = $productDesc . ' ' . $spec; $prodesc = $productDesc; // 提取吨位 - 支持50F、50TF格式 if (preg_match('/(\d+[FT]?F|\d+)/', $prodesc, $tonMatch)) { $matchedTon = $tonMatch[0]; // 处理数字吨位 if (is_numeric($matchedTon)) { $matchedTon = intval($matchedTon); } if (in_array($matchedTon, CONFIG_VALUES['吨位'])) { $values['吨位'] = $matchedTon; } } // 根据动力类型提取不同字段(新增发动机代称映射) if (in_array($powerType, ['FD', 'FR4D', 'FCG', 'FG'])) { // 柴油车型:先匹配标准型号,再匹配代称 $foundEngine = null; // 1. 匹配标准发动机型号 foreach (CONFIG_VALUES['发动机型号'] as $engine) { if (strpos($allText, $engine) !== false) { $foundEngine = $engine; break; } } // 2. 未找到标准型号,匹配代称 if (!$foundEngine) { foreach (ENGINE_ALIASES as $alias => $standard) { if (strpos($allText, $alias) !== false) { $foundEngine = $standard; break; } } } $values['发动机型号'] = $foundEngine; } else if (in_array($powerType, ['FB', 'FLB', 'FRB', 'FTB'])) { // 电动车型 foreach (CONFIG_VALUES['电控品牌'] as $ec) { if (strpos($allText, $ec) !== false) { $values['电控品牌'] = $ec; break; } } foreach (CONFIG_VALUES['电压等级'] as $level) { if (strpos($allText, $level) !== false) { $values['电压等级'] = $level; break; } } foreach (CONFIG_VALUES['挡板'] as $board) { if (strpos($allText, $board) !== false) { $values['挡板'] = $board; break; } } } // 提取其他通用字段 foreach (CONFIG_VALUES['年款'] as $year) { if (strpos($allText, $year) !== false) { $values['年款'] = $year; break; } } foreach (CONFIG_VALUES['阀片'] as $valve) { if (strpos($allText, $valve) !== false) { $values['阀片'] = $valve; break; } } foreach (CONFIG_VALUES['座椅'] as $seat) { if (strpos($allText, $seat) !== false) { $values['座椅'] = $seat; break; } } return $values; } // 匹配配置(新增调试信息返回,同步前端特殊规则) function matchConfigurations($data, $productDesc, $spec, $systemConfig, $extractedValues, $debugSystem) { $allText = $productDesc . ' ' . $spec; $allTextLower = mb_strtolower($allText, 'UTF-8'); $results = []; $debugInfo = []; // 存储调试信息 $defaultConfigsLower = array_map('mb_strtolower', DEFAULT_CONFIGS); $otherKeywords = array_map('mb_strtolower', CONFIG_VALUES['其它']); $otherKeywords2 = array_map('mb_strtolower', CONFIG_VALUES['其它2']); // 确定国产标志(同步前端逻辑) $isDomestic = false; $powerType = $extractedValues['动力类型']; if (in_array($powerType, ['FD', 'FR4D', 'FCG', 'FG'])) { $engineType = $extractedValues['发动机型号'] ?? null; $isDomestic = $engineType && in_array($engineType, CONFIG_VALUES['国产发动机']); } else if (in_array($powerType, ['FB', 'FLB', 'FRB', 'FTB'])) { $electricControl = $extractedValues['电控品牌'] ?? null; $isDomestic = $electricControl && in_array($electricControl, CONFIG_VALUES['国产电控']); } foreach ($systemConfig['order'] as $system) { // 筛选当前系统的配置项 $items = array_filter($data, function($item) use ($system) { return strpos($item['分类'], $system) !== false; }); $items = array_values($items); $keywordRule = $systemConfig['keywords'][$system] ?? ['required' => [], 'optional' => []]; $bestItem = null; $bestScore = PHP_INT_MIN; $candidateDebug = []; // 单个系统的候选调试信息 foreach ($items as $item) { // 计算匹配分数(同步前端逻辑,新增特殊规则) $scoreData = calculateMatchScore($item, $system, $keywordRule, $extractedValues, $allText, $isDomestic); $score = $scoreData['score']; $details = $scoreData['details']; // 存储候选调试信息 $candidateDebug[] = [ 'item' => [ '编号' => $item['编号'], '名称' => $item['名称'], '规格' => $item['规格'] ], 'score' => $score, 'details' => $details ]; if ($score === -9999) { continue; } // 检查非默认配置项是否在输入中存在(同步前端) $itemSpecLower = mb_strtolower($item['规格'], 'UTF-8'); $nonDefaultKeywords = array_diff($otherKeywords, $defaultConfigsLower); $hasUnmatchedNonDefault = false; foreach ($nonDefaultKeywords as $keyword) { if (strpos($itemSpecLower, $keyword) !== false && strpos($allTextLower, $keyword) === false) { $hasUnmatchedNonDefault = true; break; } } if ($hasUnmatchedNonDefault) { $score -= 50; $details['optional'][] = '存在非默认配置项未在输入中匹配,扣50分'; } // 更新最佳匹配 if ($score > $bestScore) { $bestScore = $score; $bestItem = $item; $bestDetails = $details; } } // 检查特殊规则(同步前端所有规则) $specialRule = checkSpecialRules($system, $bestItem, $extractedValues, $allText); if ($bestItem && !$specialRule['pass']) { $bestItem = null; $bestScore = 0; $bestDetails['specialNote'] = $specialRule['note']; } else if ($bestItem) { $bestDetails['specialNote'] = $specialRule['note']; } // 存储当前系统结果 $results[] = $bestItem ? [ 'system' => $system, '编号' => $bestItem['编号'], '规格' => $bestItem['规格'], '名称' => $bestItem['名称'], 'score' => $bestScore, 'details' => $bestDetails ] : [ 'system' => $system, '编号' => null, '规格' => null, '名称' => null, 'score' => 0, 'details' => ['specialNote' => $specialRule['note'] ?? '未找到匹配配置'] ]; // 存储调试信息(仅当指定调试系统时) if ($debugSystem === $system) { $debugInfo = [ 'system' => $system, 'extractedValues' => $extractedValues, 'candidates' => $candidateDebug, 'bestCandidate' => $bestItem ? [ 'item' => $bestItem, 'score' => $bestScore, 'details' => $bestDetails ] : null ]; } } return [ 'matched' => $results, 'debugInfo' => $debugInfo ]; } // 计算匹配分数(同步前端逻辑,新增特殊规则加分) function calculateMatchScore($item, $system, $keywordRule, $extractedValues, $allText, $isDomestic) { $score = 0; $allTextLower = mb_strtolower($allText, 'UTF-8'); $itemSpecLower = mb_strtolower($item['规格'], 'UTF-8'); $itemNameLower = mb_strtolower($item['名称'], 'UTF-8'); $details = [ 'required' => [], 'optional' => [], 'tonnageMatch' => false, 'score' => 0 ]; $powerType = $extractedValues['动力类型']; $deus = explode(',', $item['分类']); // 拆分分类字段 // 1. 检查必须关键字 foreach ($keywordRule['required'] as $key) { $value = $extractedValues[$key] ?? null; if (!$value) { $details['required'][] = "必须关键字【$key】未提取到值,匹配失败"; return ['score' => -9999, 'details' => $details]; } // 吨位特殊处理(支持范围和单值) if ($key === '吨位') { $tonResult = matchTonnage($item['规格'], $extractedValues); if (!$tonResult['matched']) { $details['required'][] = "吨位【$value】不匹配配置范围,匹配失败"; return ['score' => -9999, 'details' => $details]; } $score += 30; $details['required'][] = "吨位【$value】匹配配置范围【{$tonResult['range']}】,加30分"; $details['tonnageMatch'] = true; continue; } // 发动机型号特殊处理(支持代称) if ($key === '发动机型号') { $allEngineNames = [$value]; // 获取所有相关代称 foreach (ENGINE_ALIASES as $alias => $standard) { if ($standard === $value) $allEngineNames[] = $alias; if ($alias === $value) $allEngineNames[] = $standard; } $isMatched = false; foreach ($allEngineNames as $name) { if (strpos($item['规格'], $name) !== false && strpos($allText, $name) !== false) { $isMatched = true; break; } } if (!$isMatched) { $details['required'][] = "发动机型号【$value】及其代称不匹配,匹配失败"; return ['score' => -9999, 'details' => $details]; } $score += 30; $details['required'][] = "发动机型号【$value】匹配,加30分"; continue; } // 其他必须关键字 if (strpos($item['规格'], $value) === false) { $details['required'][] = "必须关键字【$key:$value】不匹配配置,匹配失败"; return ['score' => -9999, 'details' => $details]; } $score += 30; $details['required'][] = "必须关键字【$key:$value】匹配,加30分"; } // 2. 检查可选关键字 foreach ($keywordRule['optional'] as $key) { $value = $extractedValues[$key] ?? null; if ($value && strpos($item['规格'], $value) !== false) { $score += 20; $details['optional'][] = "可选关键字【$key:$value】匹配,加20分"; } // 年款未区分时加分 if ($key === '年款' && !$value && !strpos($item['规格'], '16') && !strpos($item['规格'], '17')) { $score += 20; $details['optional'][] = "未检测到年款区分,加20分"; } } // 3. 特殊系统规则(同步前端所有特殊规则) $systemLower = mb_strtolower($system, 'UTF-8'); // 多路阀规则 if (in_array('多路阀', $deus) || strpos($systemLower, '多路阀') !== false) { if ($isDomestic) { if (!strpos($allTextLower, '进口品牌多路阀') && !strpos($allTextLower, '国产品牌多路阀') && !strpos($allTextLower, '3e22yg51') && strpos($itemNameLower, '国产品牌') !== false) { $score += 20; $details['optional'][] = '国产发动机且非欧五,多路阀国产品牌匹配,加20分'; } else if (strpos($allTextLower, '进口品牌多路阀') !== false && strpos($itemNameLower, '进口品牌') !== false) { $score += 20; $details['optional'][] = '国产发动机但要求进口多路阀,匹配加20分'; } else if (!strpos($allTextLower, '进口品牌多路阀') && !strpos($allTextLower, '国产品牌多路阀') && strpos($allTextLower, '3e22yg51') !== false && strpos($itemNameLower, '进口品牌') !== false) { $score += 20; $details['optional'][] = '欧五发动机默认进口多路阀,匹配加20分'; } } else { if (!strpos($allTextLower, '国产品牌多路阀') && strpos($itemNameLower, '进口品牌') !== false) { $score += 20; $details['optional'][] = '进口发动机多路阀进口品牌匹配,加20分'; } else if (strpos($allTextLower, '国产品牌多路阀') !== false && strpos($itemNameLower, '国产品牌') !== false) { $score += 20; $details['optional'][] = '进口发动机要求国产多路阀,匹配加20分'; } } } // 液压泵规则 if (in_array('液压泵', $deus) || strpos($systemLower, '液压泵') !== false) { if ($isDomestic) { if (!strpos($allTextLower, '进口品牌液压泵') && strpos($itemNameLower, '国产品牌') !== false) { $score += 20; $details['optional'][] = '国产发动机液压泵国产品牌匹配,加20分'; } else if (strpos($allTextLower, '进口品牌液压泵') !== false && strpos($itemNameLower, '进口品牌') !== false) { $score += 20; $details['optional'][] = '国产发动机要求进口液压泵,匹配加20分'; } } else { if (!strpos($allTextLower, '国产品牌液压泵') && strpos($itemNameLower, '进口品牌') !== false) { $score += 20; $details['optional'][] = '进口发动机液压泵进口品牌匹配,加20分'; } else if (strpos($allTextLower, '国产品牌液压泵') !== false && strpos($itemNameLower, '国产品牌') !== false) { $score += 20; $details['optional'][] = '进口发动机要求国产液压泵,匹配加20分'; } } } // 转向器规则 if (in_array('转向', $deus) || strpos($systemLower, '转向') !== false) { if ($isDomestic) { if (!strpos($allTextLower, '进口品牌转向器') && strpos($itemNameLower, '国产品牌') !== false) { $score += 20; $details['optional'][] = '国产发动机转向器国产品牌匹配,加20分'; } else if (strpos($allTextLower, '进口品牌转向器') !== false && strpos($itemNameLower, '进口品牌') !== false) { $score += 20; $details['optional'][] = '国产发动机要求进口转向器,匹配加20分'; } } else { if (!strpos($allTextLower, '国产品牌转向器') && strpos($itemNameLower, '进口品牌') !== false) { $score += 20; $details['optional'][] = '进口发动机转向器进口品牌匹配,加20分'; } else if (strpos($allTextLower, '国产品牌转向器') !== false && strpos($itemNameLower, '国产品牌') !== false) { $score += 20; $details['optional'][] = '进口发动机要求国产转向器,匹配加20分'; } } } // 轮胎规则 if (in_array('轮胎', $deus) || strpos($systemLower, '胎') !== false) { if (!strpos($allTextLower, '实心胎') && !strpos($allTextLower, '充气胎') && strpos($itemSpecLower, '国产品牌') !== false && strpos($itemSpecLower, 'std') !== false) { if (strpos($allTextLower, '前双胎') !== false && strpos($itemSpecLower, '前双胎') !== false) { $score += 30; $details['optional'][] = '前双胎特征匹配,加30分'; } $score += 100; $details['optional'][] = '默认国产品牌充气胎,加100分'; } else if (strpos($allTextLower, '实心胎(国产品牌)') !== false && strpos($itemSpecLower, '国产品牌') !== false && strpos($itemSpecLower, '实心') !== false) { $score += 30; $details['optional'][] = '国产品牌+实心胎匹配,加30分'; } else if (strpos($allTextLower, '实心胎(进口品牌)') !== false && strpos($itemSpecLower, '进口品牌') !== false && strpos($itemSpecLower, '实心') !== false) { $score += 30; $details['optional'][] = '进口品牌+实心胎匹配,加30分'; } else if (strpos($allTextLower, '充气胎(进口品牌)') !== false && strpos($itemSpecLower, '进口品牌') !== false && strpos($itemSpecLower, '充气') !== false) { $score += 30; $details['optional'][] = '进口品牌+充气胎匹配,加30分'; } if (!strpos($allTextLower, '前双胎') && strpos($itemSpecLower, '前双胎') !== false) { $score -= 30; $details['optional'][] = '配置有前双胎但输入无,扣30分'; } } // 覆盖件规则 if (in_array('覆盖件', $deus) || strpos($systemLower, '覆盖件') !== false) { if (strpos($allTextLower, '隔音') !== false && strpos($itemSpecLower, '隔音') !== false) { $score += 20; $details['optional'][] = '隔音要求匹配,加20分'; } else if (!strpos($allTextLower, '隔音') && !strpos($itemSpecLower, '隔音')) { $score += 20; $details['optional'][] = '无隔音要求匹配,加20分'; } } // 座椅规则 if (in_array('座椅', $deus) || strpos($systemLower, '座椅') !== false) { if (!strpos($allTextLower, '座椅') && !strpos($allTextLower, 'fr4d') && !strpos($allTextLower, 'frb') && !strpos($allTextLower, '软连接') && strpos($itemSpecLower, '丰田样式座椅std') !== false) { $score += 20; $details['optional'][] = '默认丰田样式座椅(STD)匹配,加20分'; } } // 驻车制动规则 if (in_array('驻车制动', $deus) || strpos($systemLower, '驻车制动') !== false) { if (strpos($allTextLower, '凡几') !== false && strpos($itemSpecLower, '手刹开关') !== false) { $score += 60; $details['optional'][] = '凡几电控默认手刹开关,加60分'; } if (strpos($allTextLower, '仪表显示') !== false && strpos($itemSpecLower, '手刹开关') !== false) { $score += 20; $details['optional'][] = '仪表显示P要求手刹开关,加20分'; } if ((strpos($allTextLower, '3e22yg51') !== false || strpos($allTextLower, '维德') !== false || strpos($allTextLower, '2403') !== false || strpos($allTextLower, 'wg2503') !== false || strpos($allTextLower, 'psi') !== false || strpos($allTextLower, 'l4crtv') !== false) && strpos($itemSpecLower, '手刹开关') !== false) { $score += 50; $details['optional'][] = '17款欧五/维德等默认手刹开关,加50分'; } } // 欧五发动机下进气规则 if ((in_array('覆盖件', $deus) || strpos($systemLower, '覆盖件') !== false) && (strpos($allTextLower, '3e22yg51') !== false || strpos($allTextLower, 'wg2503-l') !== false || strpos($allTextLower, 'v2403') !== false || strpos($allTextLower, 'psi') !== false || strpos($allTextLower, 'l4crtv') !== false)) { if (strpos($itemSpecLower, '下进气') !== false) { $score += 50; $details['optional'][] = '欧五/久保田等默认下进气,加50分'; } } // 刷卡仪表规则 if (strpos($allTextLower, '刷卡仪表') !== false && strpos($itemSpecLower, 'tsg81') !== false) { $score += 20; $details['optional'][] = '刷卡仪表要求TSG81,加20分'; } // 凡几/嘉晨侧装规则 if ((strpos($allTextLower, '凡几') !== false && strpos($allTextLower, '51.2v锂电') !== false) || (strpos($allTextLower, '嘉晨') !== false && strpos($allTextLower, '76.8v锂电') !== false)) { if (strpos($itemSpecLower, '侧装') !== false) { $score += 20; $details['optional'][] = '侧装配置匹配,加20分'; } if ((in_array('平衡重', $deus) || strpos($systemLower, '平衡重') !== false) && strpos($itemSpecLower, '实心') !== false) { $score += 50; $details['optional'][] = '侧装平衡重含实心配置,加50分'; } } // 50F/50TF规则 if (strpos($allTextLower, '50f') !== false && strpos($itemSpecLower, '50f') !== false) { $score += 20; $details['optional'][] = '50F配置匹配,加20分'; } if (strpos($allTextLower, '50tf') !== false && strpos($itemSpecLower, '50tf') !== false) { $score += 20; $details['optional'][] = '50TF配置匹配,加20分'; } // 发动机型号区分规则(S6S/S6S-T、V2403系列) if (strpos($allTextLower, 's6s') !== false && !strpos($allTextLower, 's6s-t') && strpos($itemSpecLower, 's6s-t') !== false) { $score = 0; $details['optional'][] = 'S6S发动机排除S6S-T配置,得分归零'; } if (strpos($allTextLower, 'v2403') !== false && !strpos($allTextLower, 'v2403-m') && !strpos($allTextLower, 'v2403-cr') && (strpos($itemSpecLower, 'v2403-m') !== false || strpos($itemSpecLower, 'v2403-cr') !== false)) { $score = 0; $details['optional'][] = 'V2403发动机排除V2403-M/V2403-CR配置,得分归零'; } // 手刹未拉报警规则 if (strpos($allTextLower, '3e22yg51') !== false && strpos($allTextLower, '手刹未拉') !== false && strpos($itemSpecLower, '断电手刹报警') !== false) { $score += 50; $details['optional'][] = '欧五发动机手刹未拉提醒,断电手刹报警匹配,加50分'; } if (strpos($allTextLower, 'inmotion') !== false && strpos($allTextLower, '手刹未拉') !== false && strpos($itemSpecLower, '断电手刹报警') !== false) { $score += 50; $details['optional'][] = 'Inmotion电控手刹未拉提醒,断电手刹报警匹配,加50分'; } // 分体式护顶架规则 if (strpos($allTextLower, '分体式') !== false && strpos($itemNameLower, '分体式') !== false) { $score += 30; $details['optional'][] = '分体式护顶架匹配,加30分'; } // 驾驶室规则 if (strpos($allTextLower, '驾驶室') !== false && !strpos($allTextLower, '空调驾驶室') && !strpos($allTextLower, '暖风') && strpos($itemNameLower, '驾驶室') !== false && !strpos($itemNameLower, '空调') && !strpos($itemNameLower, '暖风')) { $score += 20; $details['optional'][] = '普通驾驶室匹配,加20分'; } if (!strpos($allTextLower, '驾驶室') && !strpos($allTextLower, '空调驾驶室') && !strpos($allTextLower, '暖风') && !strpos($itemNameLower, '驾驶室') && !strpos($itemNameLower, '空调') && !strpos($itemNameLower, '暖风')) { $score += 20; $details['optional'][] = '无驾驶室要求匹配,加20分'; } // 其他配置项匹配(CONFIG_VALUES['其它2']) foreach (CONFIG_VALUES['其它2'] as $keyword) { $keywordLower = mb_strtolower($keyword, 'UTF-8'); if (strpos($itemSpecLower, $keywordLower) !== false) { if (strpos($allTextLower, $keywordLower) !== false) { $score += 1; $details['optional'][] = "配置【$keyword】匹配,加1分"; } else { $score -= 30; $details['optional'][] = "配置【$keyword】存在但输入无,扣30分"; } } } $details['score'] = round($score, 1); return ['score' => $score, 'details' => $details]; } // 吨位匹配(支持范围、单值、50F/50TF格式) function matchTonnage($itemSpec, $extractedValues) { $result = ['matched' => false, 'range' => null]; $powerType = $extractedValues['动力类型'] ?? ''; $userTonnage = $extractedValues['吨位'] ?? null; if (!$powerType || $userTonnage === null) { return $result; } // 处理50F、50TF等格式 if (is_string($userTonnage) && preg_match('/(\d+)/', $userTonnage, $numMatch)) { $userTonnageNum = intval($numMatch[1]); } else { $userTonnageNum = intval($userTonnage); } // 查找动力类型位置 $powerPos = mb_strpos($itemSpec, $powerType); if ($powerPos === false) { return $result; } // 提取吨位部分 $tonnagePart = mb_substr($itemSpec, $powerPos + mb_strlen($powerType)); // 1. 匹配范围格式(如:10~30、20-50) if (preg_match('/(\d+)\s*[~-]\s*(\d+)/', $tonnagePart, $rangeMatches)) { $min = intval($rangeMatches[1]); $max = intval($rangeMatches[2]); if ($userTonnageNum >= $min && $userTonnageNum <= $max) { $result['matched'] = true; $result['range'] = "$min-$max"; } return $result; } // 2. 匹配单值格式(如:FD30T、FB25) if (preg_match('/\b(\d+)\b/', $tonnagePart, $singleMatch)) { $specValue = intval($singleMatch[1]); if ($userTonnageNum === $specValue) { $result['matched'] = true; $result['range'] = (string)$specValue; } return $result; } // 3. 匹配字符串格式(如:50F、50TF) if (preg_match('/(\d+[FT]?F)/', $tonnagePart, $strMatch)) { if ($strMatch[1] === $userTonnage) { $result['matched'] = true; $result['range'] = $strMatch[1]; } return $result; } // 4. 直接匹配 if (strpos($itemSpec, (string)$userTonnage) !== false) { $result['matched'] = true; $result['range'] = (string)$userTonnage; } return $result; } // 检查特殊规则(同步前端所有25条规则) function checkSpecialRules($system, $configItem, $extractedValues, $allText) { $note = ''; $pass = true; $allTextLower = mb_strtolower($allText, 'UTF-8'); $powerType = $extractedValues['动力类型'] ?? ''; $engineType = $extractedValues['发动机型号'] ?? ''; $year = $extractedValues['年款'] ?? ''; // 规则1: 3E22YG51发动机电气系统必须含OPS if ($system == '电气' && strpos($allTextLower, '3e22yg51') !== false) { if ($configItem && strpos($configItem['规格'], 'OPS') === false) { $note .= '规则1:3E22YG51发动机电气系统必须含OPS配置,当前配置无'; $pass = false; } else if ($configItem) { $note .= '符合规则1:3E22YG51发动机电气系统含OPS配置'; } } // 规则2: 16款FD铸造桥涉及转向桥、车架 if (in_array($system, ['转向桥', '车架']) && strpos($allTextLower, '铸造') !== false && $year === '16' && $powerType === 'FD') { if ($configItem && strpos($configItem['规格'], '铸造') === false) { $note .= '规则2:16款FD铸造桥需转向桥/车架含铸造配置,当前配置无'; $pass = false; } else if ($configItem) { $note .= '符合规则2:16款FD铸造桥转向桥/车架含铸造配置'; } } // 规则3: 17款FD铸造桥涉及转向桥、车架、液压管路 if (in_array($system, ['转向桥', '车架', '液压管路']) && strpos($allTextLower, '铸造') !== false && $year === '17' && $powerType === 'FD') { if ($configItem && strpos($configItem['规格'], '铸造') === false) { $note .= '规则3:17款FD铸造桥需转向桥/车架/液压管路含铸造配置,当前配置无'; $pass = false; } else if ($configItem) { $note .= '符合规则3:17款FD铸造桥转向桥/车架/液压管路含铸造配置'; } } // 规则4: 仅指定发动机有加速系统 if ($system == '加速') { $supportedEngines = CONFIG_VALUES['有加速发动机']; if ($engineType && !in_array($engineType, $supportedEngines)) { $note .= '规则4:当前发动机型号无加速系统,无需匹配'; $pass = false; } else if ($configItem) { $note .= '符合规则4:当前发动机型号支持加速系统'; } } // 规则5: 传动冷却只区分吨位,全系通用 if ($system == '传动冷却' && in_array($powerType, ['FD', 'FG', 'FCG'])) { $note .= '符合规则5:传动冷却只区分吨位,全系通用'; $pass = true; } // 规则6-1: 16款4D29X41-024 OPS涉及车架、多路阀、多路阀操纵 if (in_array($system, ['车架', '多路阀系统', '多路阀操纵']) && strpos($allTextLower, 'ops') !== false && $year === '16' && $engineType === '4D29X41-024') { if (($configItem && strpos($configItem['规格'], 'OPS') === false) || !$configItem) { $note .= '规则6-1:16款4D29X41-024 OPS需车架/多路阀含OPS配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则6-1:16款4D29X41-024 OPS车架/多路阀含OPS配置'; } } // 规则6-2: 16款4JG2 OPS涉及车架、多路阀、多路阀操纵、液压管路 if (in_array($system, ['车架', '多路阀系统', '多路阀操纵', '液压管路']) && strpos($allTextLower, 'ops') !== false && $year === '16' && $engineType === '4JG2') { if (($configItem && strpos($configItem['规格'], 'OPS') === false) || !$configItem) { $note .= '规则6-2:16款4JG2 OPS需车架/多路阀/液压管路含OPS配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则6-2:16款4JG2 OPS车架/多路阀/液压管路含OPS配置'; } } // 规则6-3: 16款K21/K25 OPS涉及车架、多路阀、液压管路 if (in_array($system, ['车架', '多路阀系统', '液压管路']) && strpos($allTextLower, 'ops') !== false && $year === '16' && in_array($engineType, ['K21', 'K25'])) { if (($configItem && strpos($configItem['规格'], 'OPS') === false) || !$configItem) { $note .= '规则6-3:16款K21/K25 OPS需车架/多路阀/液压管路含OPS配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则6-3:16款K21/K25 OPS车架/多路阀/液压管路含OPS配置'; } } // 规则6-4: 17款FD/FG非欧五OPS涉及多路阀、多路阀操纵 if (in_array($system, ['多路阀系统', '多路阀操纵']) && strpos($allTextLower, 'ops') !== false && $year === '17' && in_array($powerType, ['FD', 'FG']) && $engineType !== '3E22YG51') { if (($configItem && strpos($configItem['规格'], 'OPS') === false) || !$configItem) { $note .= '规则6-4:17款FD/FG非欧五OPS需多路阀含OPS配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则6-4:17款FD/FG非欧五OPS多路阀含OPS配置'; } } // 规则6-5: 17款欧五OPS涉及多路阀、多路阀操纵、电气 if (in_array($system, ['多路阀系统', '多路阀操纵', '电气']) && strpos($allTextLower, 'ops') !== false && $year === '17' && $powerType === 'FD' && $engineType === '3E22YG51') { if (($configItem && strpos($configItem['规格'], 'OPS') === false) || !$configItem) { $note .= '规则6-5:17款欧五OPS需多路阀/电气含OPS配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则6-5:17款欧五OPS多路阀/电气含OPS配置'; } } // 规则6-6: FB OPS涉及多路阀,带刷卡仪表还涉及电器 if (($system == '多路阀系统' && $powerType === 'FB' && strpos($allTextLower, 'ops') !== false) || ($system == '电器' && $powerType === 'FB' && strpos($allTextLower, 'ops') !== false && strpos($allTextLower, '刷卡仪表') !== false)) { if (($configItem && strpos($configItem['规格'], 'OPS') === false) || !$configItem) { $note .= '规则6-6:FB OPS需多路阀/电器含OPS配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则6-6:FB OPS多路阀/电器含OPS配置'; } } // 规则6-7: FLB OPS涉及多路阀 if ($system == '多路阀系统' && $powerType === 'FLB' && strpos($allTextLower, 'ops') !== false) { if (($configItem && strpos($configItem['规格'], 'OPS') === false) || !$configItem) { $note .= '规则6-7:FLB OPS需多路阀含OPS配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则6-7:FLB OPS多路阀含OPS配置'; } } // 规则:年款不匹配防御 if (in_array($year, ['16', '17']) && $configItem && (strpos($configItem['规格'], '16') !== false || strpos($configItem['规格'], '17') !== false) && strpos($configItem['规格'], $year) === false) { $note .= '防御规则:配置年款与提取年款不匹配,禁止输出'; $pass = false; } else if (in_array($year, ['16', '17']) && $configItem && strpos($configItem['规格'], $year) !== false) { $note .= '防御规则:配置年款与提取年款匹配'; } // 规则7: 高排气涉及覆盖件、排气、平衡重(C240左高,其他右高) if (in_array($system, ['覆盖件', '排气', '平衡重']) && strpos($allTextLower, '高排气') !== false) { $target = $engineType === 'C240' ? '左高排气' : '右高排气'; if (($configItem && strpos($configItem['规格'], $target) === false) || !$configItem) { $note .= "规则7:高排气需{$target}配置,当前无"; $pass = false; } else if ($configItem) { $note .= "符合规则7:高排气含{$target}配置"; } } // 规则8: 无座椅指定且非FR4D/FRB/软连接,默认丰田样式座椅(STD) if ($system == '座椅' && strpos($allTextLower, '座椅') === false && !in_array($powerType, ['FR4D', 'FRB']) && strpos($allTextLower, '软连接') === false) { $note .= '符合规则8:无座椅指定,默认丰田样式座椅(STD)'; $pass = true; } // 规则9: 加大水箱/十叶风扇/油水分离涉及动力冷却 if ($system == '动力冷却' && (strpos($allTextLower, '加大水箱') !== false || strpos($allTextLower, '十叶风扇') !== false || strpos($allTextLower, '油水分离') !== false)) { if (($configItem && (strpos($configItem['规格'], '加大水箱') === false && strpos($configItem['规格'], '十叶风扇') === false && strpos($configItem['规格'], '油水分离') === false)) || !$configItem) { $note .= '规则9:加大水箱/十叶风扇/油水分离需动力冷却配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则9:动力冷却含加大水箱/十叶风扇/油水分离配置'; } } // 规则10: FLB电控维德S2/G1有动力冷却,其他无 if ($system == '动力冷却' && $powerType === 'FLB') { if (strpos($allTextLower, '维德s2') !== false || strpos($allTextLower, '维德g1') !== false) { $note .= '符合规则10:FLB维德S2/G1有动力冷却'; $pass = true; } else { $note .= '规则10:FLB非维德S2/G1无动力冷却,无需匹配'; $pass = false; } } // 规则11: 消声器/中排气涉及排气系统 if ($system == '排气' && (strpos($allTextLower, '消声器') !== false || strpos($allTextLower, '中排气') !== false)) { if (($configItem && (strpos($configItem['规格'], '消声器') === false && strpos($configItem['规格'], '中排气') === false)) || !$configItem) { $note .= '规则11:消声器/中排气需排气系统配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则11:排气系统含消声器/中排气配置'; } } // 规则12: 驾驶室涉及护顶架、覆盖件 if (in_array($system, ['护顶架', '覆盖件']) && strpos($allTextLower, '驾驶室') !== false) { if (($configItem && strpos($configItem['规格'], '驾驶室') === false) || !$configItem) { $note .= '规则12:驾驶室需护顶架/覆盖件含驾驶室配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则12:护顶架/覆盖件含驾驶室配置'; } } // 规则13: 凡几电控驻车制动默认手刹开关 if ($system == '驻车制动' && strpos($allTextLower, '凡几') !== false) { if ($configItem && strpos($configItem['规格'], '手刹开关') === false) { $note .= '规则13:凡几电控驻车制动需手刹开关,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则13:凡几电控驻车制动含手刹开关'; } } // 规则14: 17款欧五/维德等驻车制动默认手刹开关 if ($system == '驻车制动' && (strpos($allTextLower, '3e22yg51') !== false || strpos($allTextLower, '维德') !== false || strpos($allTextLower, '2403') !== false || strpos($allTextLower, 'wg2503') !== false || strpos($allTextLower, 'psi') !== false || strpos($allTextLower, 'l4crtv') !== false)) { if ($configItem && strpos($configItem['规格'], '手刹开关') === false) { $note .= '规则14:17款欧五/维德等驻车制动需手刹开关,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则14:17款欧五/维德等驻车制动含手刹开关'; } } // 规则15: 欧五/久保田等覆盖件默认下进气 if ($system == '覆盖件' && (strpos($allTextLower, '3e22yg51') !== false || strpos($allTextLower, 'wg2503-l') !== false || strpos($allTextLower, 'v2403') !== false || strpos($allTextLower, 'psi') !== false || strpos($allTextLower, 'l4crtv') !== false)) { if ($configItem && strpos($configItem['规格'], '下进气') === false) { $note .= '规则15:欧五/久保田等覆盖件需下进气,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则15:欧五/久保田等覆盖件含下进气'; } } // 规则16: 欧五发动机手刹未拉提醒需断电手刹报警 if ($system == '电气' && strpos($allTextLower, '3e22yg51') !== false && strpos($allTextLower, '手刹未拉') !== false) { if ($configItem && strpos($configItem['规格'], '断电手刹报警') === false) { $note .= '规则16:欧五发动机手刹未拉提醒需断电手刹报警,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则16:欧五发动机电气含断电手刹报警'; } } // 规则17: Inmotion电控手刹未拉提醒需断电手刹报警 if ($system == '电气' && strpos($allTextLower, 'inmotion') !== false && strpos($allTextLower, '手刹未拉') !== false) { if ($configItem && strpos($configItem['规格'], '断电手刹报警') === false) { $note .= '规则17:Inmotion电控手刹未拉提醒需断电手刹报警,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则17:Inmotion电控电气含断电手刹报警'; } } // 规则18: 格拉默座椅涉及覆盖件、座椅 if (in_array($system, ['覆盖件', '座椅']) && strpos($allTextLower, '格拉默') !== false) { if ($configItem && strpos($configItem['规格'], '格拉默') === false) { $note .= '规则18:格拉默座椅需覆盖件/座椅含格拉默配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则18:覆盖件/座椅含格拉默配置'; } } // 规则19: 刷卡仪表需TSG81 if ($system == '电器' && strpos($allTextLower, '刷卡') !== false) { if ($configItem && strpos($configItem['规格'], 'TSG81') === false) { $note .= '规则19:刷卡仪表需电器含TSG81配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则19:电器含TSG81配置'; } } // 规则20: 仪表显示P需手刹开关 if ($system == '驻车制动' && strpos($allTextLower, '仪表显示') !== false) { if ($configItem && strpos($configItem['规格'], '手刹开关') === false) { $note .= '规则20:仪表显示P需驻车制动含手刹开关,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则20:驻车制动含手刹开关'; } } // 规则21: 电瓶挡板涉及覆盖件 if ($system == '覆盖件' && strpos($allTextLower, '电瓶挡板') !== false) { if ($configItem && strpos($configItem['规格'], '电瓶挡板') === false) { $note .= '规则21:电瓶挡板需覆盖件含电瓶挡板配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则21:覆盖件含电瓶挡板配置'; } } // 规则22: BATI涉及平衡重 if ($system == '平衡重' && strpos($allTextLower, 'bati') !== false) { if ($configItem && strpos($configItem['规格'], ' BATI') === false) { $note .= '规则22:BATI需平衡重含BATI配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则22:平衡重含BATI配置'; } } // 规则23: FLB方向盘涉及转向系统 if ($system == '转向系统' && strpos($allTextLower, 'flb方向') !== false) { if (($configItem && strpos($configItem['规格'], 'FLB方向') === false) || !$configItem) { $note .= '规则23:FLB方向盘需转向系统含FLB方向配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则23:转向系统含FLB方向配置'; } } // 规则24: 半交流涉及电器、电气系统 if (in_array($system, ['电器', '电气']) && strpos($allTextLower, '半交流') !== false) { if (($configItem && strpos($configItem['规格'], '半交流') === false) || !$configItem) { $note .= '规则24:半交流需电器/电气含半交流配置,当前无'; $pass = false; } else if ($configItem) { $note .= '符合规则24:电器/电气含半交流配置'; } } // 规则25: 欧五发动机默认进口多路阀 if ($system == '多路阀系统' && strpos($allTextLower, '3e22yg51') !== false && strpos($allTextLower, '进口多路阀') !== false) { if (($configItem && strpos($configItem['名称'], '进口') === false) || !$configItem) { $note .= '规则25:欧五发动机需进口多路阀,当前配置非进口'; $pass = false; } else if ($configItem) { $note .= '符合规则25:欧五发动机多路阀为进口品牌'; } } return ['pass' => $pass, 'note' => $note]; } ?>
2025年07月15日
4 阅读
0 评论
0 点赞
2025-07-09
导航页面
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>清爽导航</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; } body { background: linear-gradient(135deg, #f5f7fa 0%, #e4edf9 100%); min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 20px; color: #333; } .container { width: 100%; max-width: 900px; background: rgba(255, 255, 255, 0.92); border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); overflow: hidden; backdrop-filter: blur(10px); } header { text-align: center; padding: 30px 20px 20px; background: linear-gradient(to right, #4b6cb7, #6a93cb); color: white; } h1 { font-size: 2.5rem; font-weight: 300; letter-spacing: 1px; margin-bottom: 10px; } .subtitle { font-weight: 300; opacity: 0.9; font-size: 1.1rem; } .tabs { display: flex; background: #f0f5ff; border-bottom: 1px solid #e1e8f7; } .tab { flex: 1; text-align: center; padding: 18px 0; font-size: 1.1rem; font-weight: 500; color: #5a7ab5; cursor: pointer; transition: all 0.3s ease; position: relative; } .tab:hover { background: rgba(106, 147, 203, 0.1); } .tab.active { color: #4b6cb7; background: white; } .tab.active::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: #4b6cb7; } .tab i { margin-right: 10px; font-size: 1.2rem; } .content { padding: 30px; min-height: 400px; } .tab-content { display: none; animation: fadeIn 0.5s ease; } .tab-content.active { display: block; } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } h2 { color: #4b6cb7; margin-bottom: 20px; font-weight: 500; display: flex; align-items: center; } h2 i { margin-right: 12px; background: #eef4ff; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; } p { line-height: 1.8; color: #555; margin-bottom: 20px; font-size: 1.05rem; } .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; } .card { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03); transition: transform 0.3s ease, box-shadow 0.3s ease; border: 1px solid #eef2f7; } .card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(75, 108, 183, 0.15); } .card h3 { color: #4b6cb7; margin-bottom: 15px; display: flex; align-items: center; } .card h3 i { margin-right: 10px; color: #6a93cb; } .card ul { list-style: none; padding-left: 10px; } .card li { padding: 8px 0; border-bottom: 1px dashed #eaeff5; display: flex; align-items: center; } .card li:last-child { border-bottom: none; } .card li i { margin-right: 10px; color: #6a93cb; font-size: 0.9rem; } footer { text-align: center; padding: 20px; color: #7a8fb3; font-size: 0.9rem; border-top: 1px solid #eef2f7; background: #f9fbfe; } @media (max-width: 768px) { .tabs { flex-wrap: wrap; } .tab { flex: 1 0 50%; padding: 15px 0; } h1 { font-size: 2rem; } .content { padding: 20px; } } @media (max-width: 480px) { .tab { flex: 1 0 100%; } .card-grid { grid-template-columns: 1fr; } } </style> </head> <body> <div class="container"> <header> <h1>清爽导航</h1> <p class="subtitle">简洁高效 • 专注体验</p> </header> <div class="tabs"> <div class="tab active" data-tab="dashboard"> <i class="fas fa-home"></i>首页 </div> <div class="tab" data-tab="resources"> <i class="fas fa-book"></i>资源 </div> <div class="tab" data-tab="tools"> <i class="fas fa-tools"></i>工具 </div> <div class="tab" data-tab="settings"> <i class="fas fa-cog"></i>设置 </div> </div> <div class="content"> <!-- 首页内容 --> <div class="tab-content active" id="dashboard"> <h2><i class="fas fa-home"></i>欢迎使用清爽导航</h2> <p>这是一个简洁高效的导航页面,帮助您快速访问常用资源。设计注重用户体验和视觉舒适度,让您的日常操作更加流畅愉悦。</p> <div class="card-grid"> <div class="card"> <h3><i class="fas fa-rocket"></i>快捷入口</h3> <ul> <li><i class="fas fa-envelope"></i>邮箱服务</li> <li><i class="fas fa-calendar"></i>日程管理</li> <li><i class="fas fa-cloud"></i>云存储</li> <li><i class="fas fa-users"></i>团队协作</li> </ul> </div> <div class="card"> <h3><i class="fas fa-history"></i>最近访问</h3> <ul> <li><i class="fas fa-file-alt"></i>项目文档</li> <li><i class="fas fa-chart-bar"></i>数据分析</li> <li><i class="fas fa-shopping-cart"></i>在线商城</li> <li><i class="fas fa-video"></i>视频会议</li> </ul> </div> <div class="card"> <h3><i class="fas fa-bell"></i>通知提醒</h3> <ul> <li><i class="fas fa-check-circle"></i>任务已完成</li> <li><i class="fas fa-exclamation-circle"></i>系统更新</li> <li><i class="fas fa-user-plus"></i>新成员加入</li> <li><i class="fas fa-gift"></i>特别优惠</li> </ul> </div> </div> </div> <!-- 资源内容 --> <div class="tab-content" id="resources"> <h2><i class="fas fa-book"></i>学习资源</h2> <p>精选高质量学习资源,涵盖多个领域,助力您的知识成长与技能提升。</p> <div class="card-grid"> <div class="card"> <h3><i class="fas fa-laptop-code"></i>开发资源</h3> <ul> <li><i class="fab fa-github"></i>GitHub 开源项目</li> <li><i class="fas fa-code"></i>在线编程练习</li> <li><i class="fas fa-book-open"></i>技术文档</li> <li><i class="fas fa-video"></i>教学视频</li> </ul> </div> <div class="card"> <h3><i class="fas fa-paint-brush"></i>设计资源</h3> <ul> <li><i class="fas fa-palette"></i>配色方案</li> <li><i class="fas fa-font"></i>字体资源</li> <li><i class="fas fa-images"></i>图片素材</li> <li><i class="fas fa-cube"></i>3D模型</li> </ul> </div> <div class="card"> <h3><i class="fas fa-book"></i>电子书籍</h3> <ul> <li><i class="fas fa-globe"></i>网络技术</li> <li><i class="fas fa-brain"></i>人工智能</li> <li><i class="fas fa-chart-line"></i>商业经济</li> <li><i class="fas fa-heart"></i>文学艺术</li> </ul> </div> </div> </div> <!-- 工具内容 --> <div class="tab-content" id="tools"> <h2><i class="fas fa-tools"></i>实用工具</h2> <p>精选高效工具,提升您的工作效率和创造力,让复杂任务变得简单。</p> <div class="card-grid"> <div class="card"> <h3><i class="fas fa-calculator"></i>转换计算</h3> <ul> <li><i class="fas fa-ruler"></i>单位换算</li> <li><i class="fas fa-money-bill-wave"></i>货币转换</li> <li><i class="fas fa-percentage"></i>百分比计算</li> <li><i class="fas fa-clock"></i>时区转换</li> </ul> </div> <div class="card"> <h3><i class="fas fa-edit"></i>文档处理</h3> <ul> <li><i class="fas fa-file-pdf"></i>PDF工具</li> <li><i class="fas fa-file-image"></i>图片压缩</li> <li><i class="fas fa-file-word"></i>文档转换</li> <li><i class="fas fa-file-alt"></i>文本处理</li> </ul> </div> <div class="card"> <h3><i class="fas fa-chart-pie"></i>数据分析</h3> <ul> <li><i class="fas fa-table"></i>数据可视化</li> <li><i class="fas fa-chart-line"></i>图表生成</li> <li><i class="fas fa-calculator"></i>统计计算</li> <li><i class="fas fa-database"></i>数据清洗</li> </ul> </div> </div> </div> <!-- 设置内容 --> <div class="tab-content" id="settings"> <h2><i class="fas fa-cog"></i>系统设置</h2> <p>自定义您的导航体验,调整设置以满足您的个人偏好和工作需求。</p> <div class="card-grid"> <div class="card"> <h3><i class="fas fa-user"></i>账户设置</h3> <ul> <li><i class="fas fa-user-edit"></i>个人信息</li> <li><i class="fas fa-shield-alt"></i>安全设置</li> <li><i class="fas fa-bell"></i>通知偏好</li> <li><i class="fas fa-language"></i>语言设置</li> </ul> </div> <div class="card"> <h3><i class="fas fa-paint-brush"></i>外观设置</h3> <ul> <li><i class="fas fa-moon"></i>深色模式</li> <li><i class="fas fa-palette"></i>主题颜色</li> <li><i class="fas fa-font"></i>字体大小</li> <li><i class="fas fa-border-all"></i>布局调整</li> </ul> </div> <div class="card"> <h3><i class="fas fa-sliders-h"></i>高级设置</h3> <ul> <li><i class="fas fa-sync-alt"></i>数据同步</li> <li><i class="fas fa-keyboard"></i>快捷键</li> <li><i class="fas fa-plug"></i>插件管理</li> <li><i class="fas fa-database"></i>数据备份</li> </ul> </div> </div> </div> </div> <footer> <p>© 2023 清爽导航 | 简洁设计,高效体验</p> </footer> </div> <script> document.addEventListener('DOMContentLoaded', function() { const tabs = document.querySelectorAll('.tab'); const tabContents = document.querySelectorAll('.tab-content'); tabs.forEach(tab => { tab.addEventListener('click', () => { // 移除所有活动状态 tabs.forEach(t => t.classList.remove('active')); tabContents.forEach(c => c.classList.remove('active')); // 添加当前活动状态 tab.classList.add('active'); const tabId = tab.getAttribute('data-tab'); document.getElementById(tabId).classList.add('active'); }); }); }); </script> </body> </html>
2025年07月09日
2 阅读
0 评论
0 点赞
1
...
9
10
11
...
32
0:00