diff --git a/docs/2026-09-29-第一期中奖名单导入记录.md b/docs/2026-09-29-第一期中奖名单导入记录.md index c111c5d..ba841aa 100644 --- a/docs/2026-09-29-第一期中奖名单导入记录.md +++ b/docs/2026-09-29-第一期中奖名单导入记录.md @@ -50,3 +50,16 @@ dscp-uat 当前部署的后端与上表结构不匹配: ## 发布结果(2026-09-29 16:07 线上实测) 已发布生效:入口 `index.8ec4f995.js` → `index.e438708b.js`,修复分片 `pages-winners-winners.a875331e.js`(含 loadAll 全量搜索)公网 200。浏览器实测:不翻页直接搜「王球莲」命中 1 条(4 个 pageSize=500 请求自动拉全),姓名/身份证/手机号三列正常。四站点回归 hh/pxdy/mkh5/api/dw 全 200。发布过程偏差(目录切换替代覆盖式)已按手册补救:旧 hash 资源全量还原、`._*` AppleDouble 清理、webroot 备份 `/root/hh-html-backup-20260929-presearchfix.tar.gz`。winners.vue 源码改动尚未 commit。 + +## 追加修复(2026-09-30):完整手机号搜索 + +**问题**:接口下发的手机号为掩码形态(`185****6312`),用户输入完整明文号码时「包含」比对必然落空(旧版即存在)。**修法**(winners.vue 过滤逻辑):输入为 8~11 位纯数字时,先按「前3+****+后4」转成同型掩码精确比对,原有明文包含比对保留(兼容输号段场景)。线上实测搜 `18570996312` 命中「粟欢欢」,姓名搜索不受影响。 + +**发布**(2026-09-30 11:2x):入口 `index.e438708b.js` → `index.c7052d8a.js`,分片 `pages-winners-winners.ec4a4d4c.js` 公网 200。按手册**覆盖式**发布(先铺 static 保留旧 hash、最后换 index.html、清 `._*`)。发布通道变更:服务器已装部署公钥(`~/.ssh/hh_121.43.239.220_ed25519`,备注 claude-deploy-hh),发布不再需要手输密码;authorized_keys 仅追加该公钥一行。 + +## 追加修复(2026-09-30 第二批):空态闪现 + 完整身份证搜索 + +1. **「暂无数据」闪现**:首屏日期接口未回、搜索触发全量拉取期间,列表区改为显示「查询中...」加载态(`datesLoaded` 标志 + `loadingAll` + `loadStatus==='loading'` 三重守卫),仅真正无结果才落空态。 +2. **完整身份证号搜索**:与手机号同因(接口下发 `433***********0040` 形态掩码),17 位数字+校验位(含 x)输入转「前3+11星+后4」同型掩码精确比对;占位符更新「搜索姓名/手机号/身份证号」。 +3. **掩码等值固有口径**:身份证中段 8 位库内不可逆,前3+后4 同型者一并命中(实测合成号命中 熊金花/王球莲/刘元香 3 人),属预期行为,非 bug。 +4. **发布**(免密覆盖式):入口 `index.c7052d8a.js` → `index.5506cf30.js`,分片 `pages-winners-winners.c4b5297b.js`。线上实测:手机全号→粟欢欢 1 条;身份证全号→3 条含目标;姓名→王球莲 1 条;加载期无空态闪现。winners.vue 两批改动截至本次未 commit。 diff --git a/pages/winners/winners.vue b/pages/winners/winners.vue index d1095af..091c034 100644 --- a/pages/winners/winners.vue +++ b/pages/winners/winners.vue @@ -39,7 +39,7 @@ - + 搜索 @@ -62,7 +62,10 @@ - + + + + 暂无数据 @@ -81,27 +84,25 @@ export default { // xuchao: 页码改为按期维护(原单一 pageNo 在切期后会被沿用,导致同一页重复追加/跳页) pageNos: {}, pageSize: 10, - // xuchao: 搜索触发的全量拉取用大页尺寸(列表接口仅支持分页参数,无姓名检索) - pageSizeFull: 500, totals: {}, - fullLoaded: {}, - loadingAll: {}, + // xuchao: 各期全量人数(无关键字),仅用于顶部"已产生"总数;搜索态不影响该统计 + periodTotals: {}, + // xuchao: 各期当前生效的查询关键字(loadMore 续拉用它,而非输入框实时值) + queryKeywords: {}, + // xuchao: 各期请求序号,丢弃乱序返回的旧响应 + reqSeqs: {}, totalWinners: 0, inFlight: 0, loadStatusMap: {}, + // xuchao: 期次日期接口是否已回,首屏未回前显示查询态而非空态 + datesLoaded: false, keyword: '' } }, computed: { + // xuchao: 服务端已按关键字模糊过滤,前端直接渲染当期列表 currentList() { - const list = this.winnerData[this.currentTab] || [] - if (!this.keyword) return list - const kw = this.keyword.trim().toLowerCase() - if (!kw) return list - return list.filter(item => - (item.memberName && item.memberName.toLowerCase().includes(kw)) || - (item.memberPhone && item.memberPhone.includes(kw)) - ) + return this.winnerData[this.currentTab] || [] }, // xuchao: 各期独立的加载状态,避免并行请求互相覆盖 loadStatus() { @@ -109,12 +110,10 @@ export default { } }, watch: { - // xuchao: 输入关键字即后台拉全当期名单,修复"没翻到的人物搜索无结果" - keyword(val) { + // xuchao: 关键字防抖 400ms 后走服务端模糊搜索(姓名/手机号/身份证任意片段) + keyword() { clearTimeout(this._kwTimer) - if (val && val.trim() && !this.fullLoaded[this.currentTab]) { - this._kwTimer = setTimeout(() => this.loadAll(this.currentTab), 400) - } + this._kwTimer = setTimeout(() => this.search(), 400) } }, onLoad() { @@ -126,6 +125,7 @@ export default { methods: { loadDates() { this.$u.api.getWinnerDates().then(res => { + this.datesLoaded = true if (res.errcode === 0 && res.data) { const dates = res.data this.tabs = dates.map((date, index) => ({ @@ -137,112 +137,87 @@ export default { data[index] = [] }) this.winnerData = data - // xuchao: 预置各期 key,保证 totals/pageNos/loadStatusMap 的响应式 + // xuchao: 预置各期 key,保证响应式 this.totals = {} this.pageNos = {} this.loadStatusMap = {} + this.periodTotals = {} + this.queryKeywords = {} + this.reqSeqs = {} dates.forEach((date, index) => { this.$set(this.totals, index, 0) this.$set(this.pageNos, index, 1) this.$set(this.loadStatusMap, index, 'loading') + this.$set(this.periodTotals, index, 0) + this.$set(this.queryKeywords, index, '') + this.$set(this.reqSeqs, index, 0) + }) + // xuchao: 预取各期第一页(无关键字),汇总已产生总人数 + this.tabs.forEach((tab, index) => { + this.loadTab(index, 1, '') }) - // xuchao: 预取各期第一页,汇总已产生总人数 - if (this.tabs.length > 0) { - this.tabs.forEach((tab, index) => { - this.loadWinnerList(index, 1, true) - }) - } } - }) + }).catch(() => { this.datesLoaded = true }) }, - loadWinnerList(tabIndex, pageNo, allowConcurrent) { + // xuchao: 拉取某期某页;keyword 走服务端 LIKE(姓名/手机/身份证任意片段),空串=不过滤 + loadTab(tabIndex, pageNo, keyword) { if (!this.tabs[tabIndex]) return - if (this.inFlight > 0 && !allowConcurrent) return - // xuchao: 本期页码独立计算,缺省续拉该期下一页 - const page = pageNo || (this.pageNos[tabIndex] || 1) + const kw = keyword || '' + // xuchao: 递增序号,返回时仅最新请求生效,丢弃连续输入产生的乱序旧响应 + const seq = (this.reqSeqs[tabIndex] || 0) + 1 + this.$set(this.reqSeqs, tabIndex, seq) this.inFlight++ this.$set(this.loadStatusMap, tabIndex, 'loading') - const drawDate = this.tabs[tabIndex].date this.$u.api.getWinnerList({ - pageNo: page, + pageNo: pageNo, pageSize: this.pageSize, - drawDate: drawDate + drawDate: this.tabs[tabIndex].date, + keyword: kw }).then(res => { - // xuchao: 全量拉取已就绪/进行中时,旧的10条分页响应直接丢弃,避免覆盖全量列表 - if (this.fullLoaded[tabIndex] || this.loadingAll[tabIndex]) return + if (seq !== this.reqSeqs[tabIndex]) return if (res.errcode === 0 && res.data) { const list = res.data.list || [] - const prev = this.winnerData[tabIndex] || [] - this.$set(this.pageNos, tabIndex, page) - if (page === 1) { - this.$set(this.winnerData, tabIndex, list) - } else { - this.$set(this.winnerData, tabIndex, prev.concat(list)) - } + const prev = pageNo > 1 ? (this.winnerData[tabIndex] || []) : [] + this.$set(this.winnerData, tabIndex, prev.concat(list)) + this.$set(this.pageNos, tabIndex, pageNo) + this.$set(this.queryKeywords, tabIndex, kw) this.$set(this.totals, tabIndex, res.data.total || 0) - // xuchao: 各期总人数求和,用于顶部幸运持卡人数 - this.totalWinners = Object.values(this.totals).reduce((sum, n) => sum + n, 0) + // xuchao: 顶部总数只累计"无关键字"的全量人数,搜索态不会让它缩水 + if (!kw) { + this.$set(this.periodTotals, tabIndex, res.data.total || 0) + this.totalWinners = Object.values(this.periodTotals).reduce((s, n) => s + n, 0) + } } }).finally(() => { this.inFlight-- + if (seq !== this.reqSeqs[tabIndex]) return const len = (this.winnerData[tabIndex] || []).length const total = this.totals[tabIndex] || 0 this.$set(this.loadStatusMap, tabIndex, len === 0 || len >= total ? 'nomore' : 'loadmore') }) }, + // xuchao: 执行一次关键字搜索(当期回到第1页);输入防抖与点搜索按钮都走这里 + search() { + this.loadTab(this.currentTab, 1, (this.keyword || '').trim()) + }, loadMore() { const tab = this.currentTab - if (this.loadingAll[tab]) return const total = this.totals[tab] || 0 const len = (this.winnerData[tab] || []).length if (len < total && this.inFlight === 0) { - this.loadWinnerList(tab, (this.pageNos[tab] || 1) + 1) + this.loadTab(tab, (this.pageNos[tab] || 1) + 1, this.queryKeywords[tab] || '') } }, - // xuchao: 按大页把当期名单一次拉全,搜索即可命中未翻到的人;完成后整期替换并标记 fullLoaded - loadAll(tabIndex) { - const tab = this.tabs[tabIndex] - if (!tab || this.fullLoaded[tabIndex] || this.loadingAll[tabIndex]) return - this.$set(this.loadingAll, tabIndex, true) - this.$set(this.loadStatusMap, tabIndex, 'loading') - const acc = [] - const pull = (pageNo) => this.$u.api.getWinnerList({ - pageNo: pageNo, - pageSize: this.pageSizeFull, - drawDate: tab.date - }).then(res => { - if (res.errcode !== 0 || !res.data) return - const list = res.data.list || [] - const total = res.data.total || 0 - acc.push(...list) - this.$set(this.totals, tabIndex, total) - if (list.length > 0 && acc.length < total && pageNo < 50) return pull(pageNo + 1) - }) - pull(1).then(() => { - if (acc.length > 0) { - this.$set(this.winnerData, tabIndex, acc) - this.$set(this.fullLoaded, tabIndex, true) - this.$set(this.pageNos, tabIndex, Math.ceil(acc.length / this.pageSizeFull)) - } - this.totalWinners = Object.values(this.totals).reduce((s, n) => s + n, 0) - }).catch(() => { - // 拉全失败静默降级为已加载部分可搜 - }).finally(() => { - this.$set(this.loadingAll, tabIndex, false) - const len = (this.winnerData[tabIndex] || []).length - const total = this.totals[tabIndex] || 0 - this.$set(this.loadStatusMap, tabIndex, len === 0 || len >= total ? 'nomore' : 'loadmore') - }) - }, switchTab(index) { this.currentTab = index - // xuchao: 不再重置全局 pageNo(各期游标自带);空列表补拉首页时允许并发, - // 避免首屏预取仍在途时切期被丢弃后一直显示“暂无数据” - if ((this.winnerData[index] || []).length === 0) { - this.loadWinnerList(index, 1, true) + // xuchao: 关键字作用于"正在看的这期"——若输入关键字与该期已生效查询不同则重查,否则复用已加载结果 + const kw = (this.keyword || '').trim() + if (kw !== (this.queryKeywords[index] || '')) { + this.loadTab(index, 1, kw) } else { const total = this.totals[index] || 0 - this.$set(this.loadStatusMap, index, this.winnerData[index].length >= total ? 'nomore' : 'loadmore') + const len = (this.winnerData[index] || []).length + this.$set(this.loadStatusMap, index, len === 0 || len >= total ? 'nomore' : 'loadmore') } }, goBack() { @@ -255,8 +230,9 @@ export default { } }, onSearch() { - // xuchao: 点搜索立即确保当期全量已拉取(过滤仍在前端本地完成) - if (!this.fullLoaded[this.currentTab]) this.loadAll(this.currentTab) + // xuchao: 点搜索/键盘确认 → 立即搜索,取消待执行的防抖 + clearTimeout(this._kwTimer) + this.search() } } }