|
|
发表于 2026-8-15 18:23:07
|
查看全部
monkeye 发表于 2026-8-4 21:14
别听 AI 瞎指导; 来来,看看AI给的解决方案:
根因彻底定位
insertpost() 第 884 行:
php$pid = table_forum_post_tableid::t()->insert(['pid' => null], true);
pid 靠 pre_forum_post_tableid 表的 pid 列自增分配(插一行 null,拿回自增 id)。问题就是:这个表的 AUTO_INCREMENT 计数器落后了——它还停在 276 附近,但 forum_post 里 pid 早就用到 279 了。所以它分出一个早已被占用的 276 → INSERT forum_post 撞 Duplicate → thread 已先插、无事务 → 孤儿。
计数器落后,大概率是历史备份恢复或迁移时 forum_post_tableid 表状态和 forum_post 不一致造成的(计数器是旧的,pid 已增长)。
治本操作(宝塔 phpMyAdmin 执行)
第 1 步——确认计数器落后:
sqlSHOW TABLE STATUS LIKE 'pre_forum_post_tableid';SELECT MAX(pid) FROM pre_forum_post;
看第一个结果里的 Auto_increment 列,对比第二个的 MAX(pid)(应该是 279)。如果 Auto_increment ≤ 279,确诊。
第 2 步——把计数器推到全新区间:
sqlALTER TABLE pre_forum_post_tableid AUTO_INCREMENT = 280;
(280 = MAX(pid) + 1;如果第 1 步查出来 MAX(pid) 不是 279,就改成那个值 +1)
第 3 步——验证:发个测试帖,能正常打开就成。
.ce-block { margin-bottom: 20px;}.ce-block__content,.ce-toolbar__content { /* max-width:calc(100% - 50px) */ margin-left: auto; margin-right: auto;}.ce-paragraph { line-height: 1.6em; outline: none; text-indent: 2em; font-size: 16px;}.ce-paragraph--right { text-align: right;}.ce-paragraph--center { text-align: center;}.ce-paragraph--left { text-align: left;}.ce-paragraph--justify { text-align: justify;}.ce-paragraph-text-indent { text-align: justify;}.ce-paragraph[data-placeholder]:empty::before{ content: attr(data-placeholder); color: #707684; font-weight: normal; opacity: 0;}/** Show placeholder at the first paragraph if Editor is empty */.codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty::before { opacity: 1;}.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph[data-placeholder]:empty::before,.codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty:focus::before { opacity: 0;}.ce-paragraph p:first-of-type{ margin-top: 0;}.ce-paragraph p:last-of-type{ margin-bottom: 0;}.svg-icon { width: 1em; height: 1em;}.svg-icon path,.svg-icon polygon,.svg-icon rect { fill: #4691f6;}.svg-icon circle { stroke: #4691f6; stroke-width: 1;}.ce-block { margin-top: 20px; margin-bottom: 20px;}.ce-block__content,.ce-toolbar__content { /* max-width:calc(100% - 50px) */ margin-left: auto; margin-right: auto;}/** * Plugin styles */.ce-header { position: relative; padding: 1px 0px 1px 15px; margin: 0; line-height: 1.25em; outline: none; margin-bottom: 10px;}.ce-header p,.ce-header div { padding: 0 !important; margin: 0 !important;}.ce-header::before { content: ""; width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 12px solid #155BD5; position: absolute; left: 0; top: 50%; transform: translateY(-50%); background-color: transparent; border-radius: 0;}/** * Styles for Plugin icon in Toolbar */.ce-header__icon {}.ce-header[contentEditable="true"][data-placeholder]::before { position: absolute; content: attr(data-placeholder); color: #707684; font-weight: normal; display: none; cursor: text;}.ce-header[contentEditable="true"][data-placeholder]:empty::before { display: block;}.ce-header[contentEditable="true"][data-placeholder]:empty:focus::before { display: none;}/* FontSize */h1.ce-header { font-size: 2.0em;}h2.ce-header { font-size: 1.7em;}h3.ce-header { font-size: 1.4em;}h4.ce-header { font-size: 1.15em;}h5.ce-header { font-size: 0.95em;}h6.ce-header { font-size: 0.8em;}/* Alignment*/.ce-header--right { text-align: right;}.ce-header--center { text-align: center;}.ce-header--left { text-align: left;}.ce-header--justify { text-align: justify;}.inline-code { background: rgba(250, 239, 240, 0.78); color: #b44437; padding: 3px 4px; border-radius: 5px; margin: 0 1px; font-family: inherit; font-size: 0.86em; font-weight: 500; letter-spacing: 0.3px;} |
|