Skip to content

fix(chaoxing): support multiple uploadDate formats#2545

Merged
xrgzs merged 3 commits into
OpenListTeam:mainfrom
yuxiaoyu8192:fix/chaoxing-uploaddate-compatibility
May 31, 2026
Merged

fix(chaoxing): support multiple uploadDate formats#2545
xrgzs merged 3 commits into
OpenListTeam:mainfrom
yuxiaoyu8192:fix/chaoxing-uploaddate-compatibility

Conversation

@yuxiaoyu8192
Copy link
Copy Markdown
Contributor

@yuxiaoyu8192 yuxiaoyu8192 commented May 31, 2026

Summary / 摘要

修复超星小组盘驱动在解析不同来源文件时的 uploadDate 字段兼容性问题。超星 API
在不同场景下返回三种不同格式的时间戳,导致 JSON 解析失败。

问题:

  • 网页端上传:数字时间戳 1780191356415
  • 手机端上传:字符串时间戳 "1780191356415"
  • 旧版本数据:日期字符串 "2024-11-06 07:49"

解决方案:
增强 int64_str 类型的 UnmarshalJSON 方法,支持三种格式的智能解析,统一输出毫秒时间戳。

修改内容:

  • 增强 int64_str.UnmarshalJSON() 方法,添加日期字符串解析逻辑
  • 修改 File.Content.UploadDate 字段类型为 int64_str
  • 添加 fileToObj() 函数的类型转换

用户可见变化:

  • ✅ 修复文件列表拉取失败的问题

  • ✅ 支持手机端和网页端上传的所有文件

  • ✅ 兼容历史遗留数据

  • This PR has breaking changes.

  • This PR changes public API, config, storage format, or migration behavior.

  • This PR requires corresponding changes in related repositories.

Related repository PRs / 关联仓库 PR:

  • OpenList-Frontend: N/A
  • OpenList-Docs: N/A

Related Issues / 关联 Issue

Fixes # (如果有相关 issue,请填写编号)

Testing / 测试

测试环境:

  • 超星小组盘 BBSID: 834df21c-2a65-49b8-a30c-71e36aeaca52
  • 测试文件数:2 个
  • 测试日期:2026-05-31

测试结果:

  • ✅ 成功解析数字时间戳格式(网页端上传)
  • ✅ 成功解析字符串时间戳格式(手机端上传)
  • ✅ 成功解析日期字符串格式(旧版本数据)
  • ✅ 文件列表拉取正常
  • ✅ 文件下载功能正常(247.78 MB 视频文件测试通过)

测试数据:
文件 1: uploadDate: 1780191356415 (数字) ✅
文件 2: uploadDate: "2024-11-06 07:49" (字符串) ✅

  • go test ./... (未添加单元测试,但已通过真实 API 测试)
  • Manual test / 手动测试: 已使用 Python 脚本测试真实超星 API 响应

Checklist / 检查清单

  • I have read CONTRIBUTING.
  • I confirm this contribution follows the repository license, contribution policy, and code of conduct.
  • I have formatted the changed code with gofmt, go fmt, or prettier where applicable.
  • I have requested review from relevant maintainers or code owners where applicable.

AI Disclosure / AI 使用声明

  • This PR includes AI-assisted content.

Tools used / 使用工具:

  • Claude (Claude Code - Opus 4.8)

Usage scope / 使用范围:

  • Code generation / 代码生成

  • Documentation / 文档

  • Tests / 测试

  • Review assistance / 审查辅助

  • I have reviewed and validated all AI-assisted content included in this PR.

  • I have ensured that all AI-assisted commits include Co-Authored-By attribution.

  • I can reproduce all AI-assisted content included in this PR without any AI tools.

AI 使用详情:

  • 工具: Claude (Anthropic) - Claude Code (Opus 4.8)
  • 使用范围:
    • 问题分析和根因定位
    • int64_str 类型的 UnmarshalJSON 方法增强
    • 代码注释和文档编写
    • Python 测试脚本编写(用于验证真实 API 响应)
  • 确认事项:
    • ✅ 已审查并验证所有 AI 生成的代码
    • ✅ 代码符合 AGPL-3.0 许可证
    • ✅ 遵循项目贡献政策和代码规范
    • ✅ 已使用真实 API 数据测试验证
    • ✅ 可以独立重现所有修改内容

Signed-off-by: yuxiaoyu8192 <103018181+yuxiaoyu8192@users.noreply.github.com>
代码格式化

Signed-off-by: yuxiaoyu8192 <103018181+yuxiaoyu8192@users.noreply.github.com>
Comment thread drivers/chaoxing/types.go Outdated
时间解析失败返回空

Signed-off-by: yuxiaoyu8192 <103018181+yuxiaoyu8192@users.noreply.github.com>
@xrgzs xrgzs added bug Module: Driver Driver-Related Issue/PR labels May 31, 2026
@xrgzs xrgzs merged commit cd6643a into OpenListTeam:main May 31, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Module: Driver Driver-Related Issue/PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants