HaniBlindBox/.kiro/specs/user-management-migration/tasks.md
2026-01-02 18:56:19 +08:00

12 KiB
Raw Blame History

Implementation Plan: 用户管理系统迁移

Overview

本任务列表将PHP用户管理系统迁移到.NET 8按照接口优先级逐个迁移。每迁移一个接口前需要先查看PHP代码了解详细业务逻辑迁移完成后需要在API接口文档.md中标记迁移状态。

Tasks

  • 1. 基础设施准备

    • 1.1 创建用户管理相关的DTO和Request/Response模型
      • 在HoneyBox.Model/Models目录下创建Asset、Vip、Coupon、Task、Rank、Welfare相关模型
      • 包括AssetRecordDto、VipInfoResponse、CouponDto、TaskDto、RankItemDto等
      • Requirements: 1.1-1.6, 2.1-2.5, 3.1-3.4
    • 1.2 创建服务接口定义
      • 在HoneyBox.Core/Interfaces目录下创建IAssetService、IVipService、ICouponService、ITaskService、IInvitationService、IRankService、IRedeemService、IWelfareService接口
      • Requirements: 1.1-15.3
    • 1.3 注册服务到DI容器
      • 在ServiceModule.cs中注册新服务
      • Requirements: 1.1-15.3
  • [-] 2. 资产服务实现

    • 2.1 查看PHP代码了解资产明细业务逻辑
      • 阅读server/php/app/api/controller/User.php中的profitMoney、profitIntegral、profitScore、profitPay方法
      • 理解type参数过滤逻辑和分页实现
      • Requirements: 1.1-1.6
    • 2.2 实现AssetService
      • 实现GetMoneyRecordsAsync余额明细
      • 实现GetIntegralRecordsAsync吧唧币明细
      • 实现GetScoreRecordsAsync积分明细
      • 实现GetPayRecordsAsync支付记录
      • Requirements: 1.1-1.6
    • * 2.3 编写AssetService属性测试
      • Property 1: 资产记录分页一致性
      • Validates: Requirements 1.1, 1.2, 1.3, 1.4, 1.6
  • 3. VIP服务实现

    • 3.1 查看PHP代码了解VIP业务逻辑
      • 阅读server/php/app/api/controller/User.php中的vip_list、vip_level方法
      • 理解VIP等级计算规则和升级逻辑
      • Requirements: 2.1-2.5
    • 3.2 实现VipService
      • 实现GetVipInfoAsync获取VIP信息
      • 实现CalculateVipLevelAsync计算VIP等级
      • 实现GetVipLevelsAsync获取VIP等级列表
      • Requirements: 2.1-2.5
    • * 3.3 编写VipService属性测试
      • Property 2: VIP等级计算正确性
      • Property 3: VIP升级进度计算
      • Validates: Requirements 2.1, 2.2, 2.4
  • 4. 优惠券服务实现

    • 4.1 查看PHP代码了解优惠券业务逻辑
      • 阅读server/php/app/api/controller/User.php中的coupon_list、coupon_detail、coupon_share、coupon_ling、coupon_ji_suan、coupon_synthesis方法
      • 理解优惠券等级、分享、领取、合成逻辑
      • Requirements: 3.1-7.5
    • 4.2 实现CouponService - 列表和详情
      • 实现GetCouponListAsync优惠券列表
      • 实现GetCouponDetailAsync优惠券详情
      • Requirements: 3.1-4.4
    • 4.3 实现CouponService - 分享和领取
      • 实现ShareCouponAsync分享优惠券
      • 实现ClaimCouponAsync领取优惠券
      • 实现随机金额算法rand_money
      • Requirements: 5.1-6.7
    • 4.4 实现CouponService - 合成
      • 实现CalculateSynthesisAsync计算合成
      • 实现SynthesisCouponsAsync执行合成
      • Requirements: 7.1-7.5
    • * 4.5 编写CouponService属性测试
      • Property 4: 优惠券等级映射
      • Property 5: 优惠券领取随机金额
      • Property 6: 优惠券合成损耗
      • Validates: Requirements 3.3, 6.1, 7.2
  • 5. 任务服务实现

    • 5.1 查看PHP代码了解任务业务逻辑
      • 阅读server/php/app/api/controller/TaskList.php中的task_list、ling_task方法
      • 理解每日/每周任务周期计算和进度统计
      • Requirements: 8.1-8.7
    • 5.2 实现TaskService
      • 实现GetTaskListAsync任务列表
      • 实现ClaimTaskRewardAsync领取任务奖励
      • 实现任务周期计算(每日/每周)
      • 实现任务进度计算(邀请/抽赏)
      • Requirements: 8.1-8.7
    • * 5.3 编写TaskService属性测试
      • Property 7: 任务周期计算
      • Validates: Requirements 8.2, 8.3
  • 6. Checkpoint - 核心服务测试验证

    • 确保资产、VIP、优惠券、任务服务测试通过
    • 如有问题请询问用户
  • 7. 推荐服务实现

    • 7.1 查看PHP代码了解推荐业务逻辑
      • 阅读相关PHP代码了解推荐关系和奖励逻辑
      • Requirements: 9.1-9.5
    • 7.2 实现InvitationService
      • 实现GetInvitationInfoAsync推荐信息
      • 实现BindInviteCodeAsync绑定邀请码
      • Requirements: 9.1-9.5
  • 8. 排行榜服务实现

    • 8.1 查看PHP代码了解排行榜业务逻辑
      • 阅读server/php/app/api/controller/Rank.php中的rank_week、rank_month方法
      • 理解周榜/月榜计算和奖品关联
      • Requirements: 10.1-10.5
    • 8.2 实现RankService
      • 实现GetWeekRankAsync周榜
      • 实现GetMonthRankAsync月榜
      • Requirements: 10.1-10.5
    • * 8.3 编写RankService属性测试
      • Property 8: 排行榜排序正确性
      • Validates: Requirements 10.1, 10.2
  • 9. 兑换码服务实现

    • 9.1 查看PHP代码了解兑换码业务逻辑
      • 阅读相关PHP代码了解兑换码验证和奖励发放
      • Requirements: 11.1-11.4
    • 9.2 实现RedeemService
      • 实现UseRedeemCodeAsync使用兑换码
      • Requirements: 11.1-11.4
  • 10. 福利屋服务实现

    • 10.1 查看PHP代码了解福利屋业务逻辑
      • 阅读server/php/app/api/controller/FuLiWu.php中的所有方法
      • 理解福利屋列表、详情、参与记录逻辑
      • Requirements: 12.1-14.4
    • 10.2 实现WelfareService - 列表和详情
      • 实现GetWelfareListAsync福利屋列表
      • 实现GetWelfareDetailAsync福利屋详情
      • Requirements: 12.1-13.4
    • 10.3 实现WelfareService - 记录查询
      • 实现GetParticipantsAsync参与者列表
      • 实现GetWinningRecordsAsync开奖记录
      • 实现GetUserParticipationRecordsAsync用户参与记录
      • 实现GetUserWinningRecordsAsync用户中奖记录
      • Requirements: 14.1-14.4
    • * 10.4 编写WelfareService属性测试
      • Property 9: 福利屋解锁金额验证
      • Validates: Requirements 12.3, 13.1
  • 11. Checkpoint - 服务层测试验证

    • 确保所有服务层单元测试通过
    • 确保所有属性测试通过
    • 如有问题请询问用户
  • 12. 控制器实现 - UserController扩展

    • 12.1 实现余额明细接口 POST /profitMoney
      • 调用AssetService.GetMoneyRecordsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 1.1
    • 12.2 实现吧唧币明细接口 POST /profitIntegral
      • 调用AssetService.GetIntegralRecordsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 1.2
    • 12.3 实现积分明细接口 POST /profitScore
      • 调用AssetService.GetScoreRecordsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 1.3
    • 12.4 实现支付记录接口 POST /profitPay
      • 调用AssetService.GetPayRecordsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 1.4
    • 12.5 实现VIP信息接口 POST /vip_list
      • 调用VipService.GetVipInfoAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 2.1-2.5
  • 13. 控制器实现 - CouponController

    • 13.1 实现优惠券列表接口 POST /coupon_list
      • 调用CouponService.GetCouponListAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 3.1-3.4
    • 13.2 实现优惠券详情接口 POST /coupon_detail
      • 调用CouponService.GetCouponDetailAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 4.1-4.4
    • 13.3 实现优惠券分享接口 POST /coupon_share
      • 调用CouponService.ShareCouponAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 5.1-5.3
    • 13.4 实现优惠券领取接口 POST /coupon_ling
      • 调用CouponService.ClaimCouponAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 6.1-6.7
    • 13.5 实现优惠券合成计算接口 POST /coupon_ji_suan
      • 调用CouponService.CalculateSynthesisAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 7.1-7.4
    • 13.6 实现优惠券合成接口 POST /coupon_synthesis
      • 调用CouponService.SynthesisCouponsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 7.5
  • 14. 控制器实现 - TaskController

    • 14.1 实现任务列表接口 POST /task_list
      • 调用TaskService.GetTaskListAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 8.1-8.5
    • 14.2 实现领取任务奖励接口 POST /ling_task
      • 调用TaskService.ClaimTaskRewardAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 8.6-8.7
  • 15. 控制器实现 - InvitationController

    • 15.1 实现推荐信息接口 POST /invitation
      • 调用InvitationService.GetInvitationInfoAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 9.1-9.2
    • 15.2 实现绑定邀请码接口 POST /bind_invite_code
      • 调用InvitationService.BindInviteCodeAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 9.3-9.5
  • 16. 控制器实现 - RankController

    • 16.1 实现周榜接口 GET /rank_week
      • 调用RankService.GetWeekRankAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 10.1, 10.3-10.5
    • 16.2 实现月榜接口 GET /rank_month
      • 调用RankService.GetMonthRankAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 10.2-10.5
  • 17. 控制器实现 - RedeemController

    • 17.1 实现兑换码使用接口 POST /used
      • 调用RedeemService.UseRedeemCodeAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 11.1-11.4
  • 18. 控制器实现 - WelfareController

    • 18.1 实现福利屋列表接口 POST /welfare_house_list
      • 调用WelfareService.GetWelfareListAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 12.1-12.5
    • 18.2 实现福利屋详情接口 POST /fuliwu_detail
      • 调用WelfareService.GetWelfareDetailAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 13.1-13.4
    • 18.3 实现福利屋参与者接口 POST /fuliwu_participants
      • 调用WelfareService.GetParticipantsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 14.1
    • 18.4 实现福利屋开奖记录接口 POST /fuliwu_records
      • 调用WelfareService.GetWinningRecordsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 14.2
    • 18.5 实现用户参与记录接口 GET /fuliwu_user_records
      • 调用WelfareService.GetUserParticipationRecordsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 14.3
    • 18.6 实现用户中奖记录接口 GET /fuliwu_user_winning_records
      • 调用WelfareService.GetUserWinningRecordsAsync
      • 更新API接口文档标记迁移状态
      • Requirements: 14.4
  • 19. Checkpoint - 控制器测试验证

    • 确保所有控制器接口可正常访问
    • 使用Postman或HTTP文件测试各接口
    • 如有问题请询问用户
  • 20. 集成测试

    • 20.1 编写资产明细集成测试
      • 测试完整的资产查询流程
      • Requirements: 1.1-1.6
    • 20.2 编写优惠券集成测试
      • 测试优惠券分享、领取、合成流程
      • Requirements: 3.1-7.5
    • 20.3 编写任务系统集成测试
      • 测试任务进度和奖励领取流程
      • Requirements: 8.1-8.7
  • 21. 文档更新和最终验证

    • 21.1 更新API接口文档
      • 确认所有迁移接口都已标记
      • 记录新接口地址
      • Requirements: 15.1-15.3
    • 21.2 创建HTTP测试文件
      • 在HoneyBox.Api目录下创建user-management.http测试文件
      • 包含所有用户管理相关接口的测试请求
  • 22. Final Checkpoint - 完整功能验证

    • 确保所有测试通过
    • 确保API文档已更新
    • 确保与前端兼容性
    • 如有问题请询问用户

Notes

  • Tasks marked with * are optional and can be skipped for faster MVP
  • Each task references specific requirements for traceability
  • Checkpoints ensure incremental validation
  • Property tests validate universal correctness properties
  • Unit tests validate specific examples and edge cases
  • 每迁移完成一个接口都需要在docs/API接口文档.md中标记迁移状态和新接口地址
  • 迁移前必须先查看PHP代码了解详细业务逻辑确保功能一致性