* 批量保存到 Redis * @private
(accounts)
| 257 | const existingIndex = data.accounts.findIndex(account => account.email === email) |
| 258 | const existing = existingIndex !== -1 ? data.accounts[existingIndex] : {} |
| 259 | |
| 260 | // 仅写入显式传入的字段;未传字段保留 existing 值。stats 同理—— |
| 261 | // 避免 token refresh / proxy update 的 partial save 把累计 stats 清零 |
| 262 | const merged = { ...existing, email } |
| 263 | if (accountData.password !== undefined) merged.password = accountData.password |
| 264 | if (accountData.token !== undefined) merged.token = accountData.token |
| 265 | if (accountData.expires !== undefined) merged.expires = accountData.expires |
| 266 | if (accountData.proxy !== undefined) merged.proxy = accountData.proxy ?? null |
| 267 | if (accountData.stats !== undefined) merged.stats = accountData.stats |
| 268 | if (accountData.statsHistory !== undefined) merged.statsHistory = accountData.statsHistory |
| 269 | if (accountData.fingerprint !== undefined) merged.fingerprint = accountData.fingerprint |
no test coverage detected