# Implementation Plan: 用户管理系统迁移 ## Overview 本任务列表将PHP用户管理系统迁移到.NET 8,按照接口优先级逐个迁移。每迁移一个接口前,需要先查看PHP代码了解详细业务逻辑;迁移完成后,需要在API接口文档.md中标记迁移状态。 ## Tasks - [x] 1. 基础设施准备 - [x] 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_ - [x] 1.2 创建服务接口定义 - 在HoneyBox.Core/Interfaces目录下创建IAssetService、IVipService、ICouponService、ITaskService、IInvitationService、IRankService、IRedeemService、IWelfareService接口 - _Requirements: 1.1-15.3_ - [x] 1.3 注册服务到DI容器 - 在ServiceModule.cs中注册新服务 - _Requirements: 1.1-15.3_ - [-] 2. 资产服务实现 - [x] 2.1 查看PHP代码了解资产明细业务逻辑 - 阅读server/php/app/api/controller/User.php中的profitMoney、profitIntegral、profitScore、profitPay方法 - 理解type参数过滤逻辑和分页实现 - _Requirements: 1.1-1.6_ - [x] 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** - [x] 3. VIP服务实现 - [x] 3.1 查看PHP代码了解VIP业务逻辑 - 阅读server/php/app/api/controller/User.php中的vip_list、vip_level方法 - 理解VIP等级计算规则和升级逻辑 - _Requirements: 2.1-2.5_ - [x] 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** - [x] 4. 优惠券服务实现 - [x] 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_ - [x] 4.2 实现CouponService - 列表和详情 - 实现GetCouponListAsync(优惠券列表) - 实现GetCouponDetailAsync(优惠券详情) - _Requirements: 3.1-4.4_ - [x] 4.3 实现CouponService - 分享和领取 - 实现ShareCouponAsync(分享优惠券) - 实现ClaimCouponAsync(领取优惠券) - 实现随机金额算法rand_money - _Requirements: 5.1-6.7_ - [x] 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** - [x] 5. 任务服务实现 - [x] 5.1 查看PHP代码了解任务业务逻辑 - 阅读server/php/app/api/controller/TaskList.php中的task_list、ling_task方法 - 理解每日/每周任务周期计算和进度统计 - _Requirements: 8.1-8.7_ - [x] 5.2 实现TaskService - 实现GetTaskListAsync(任务列表) - 实现ClaimTaskRewardAsync(领取任务奖励) - 实现任务周期计算(每日/每周) - 实现任务进度计算(邀请/抽赏) - _Requirements: 8.1-8.7_ - [ ]* 5.3 编写TaskService属性测试 - **Property 7: 任务周期计算** - **Validates: Requirements 8.2, 8.3** - [ ] 6. Checkpoint - 核心服务测试验证 - 确保资产、VIP、优惠券、任务服务测试通过 - 如有问题请询问用户 - [x] 7. 推荐服务实现 - [x] 7.1 查看PHP代码了解推荐业务逻辑 - 阅读相关PHP代码了解推荐关系和奖励逻辑 - _Requirements: 9.1-9.5_ - [x] 7.2 实现InvitationService - 实现GetInvitationInfoAsync(推荐信息) - 实现BindInviteCodeAsync(绑定邀请码) - _Requirements: 9.1-9.5_ - [x] 8. 排行榜服务实现 - [x] 8.1 查看PHP代码了解排行榜业务逻辑 - 阅读server/php/app/api/controller/Rank.php中的rank_week、rank_month方法 - 理解周榜/月榜计算和奖品关联 - _Requirements: 10.1-10.5_ - [x] 8.2 实现RankService - 实现GetWeekRankAsync(周榜) - 实现GetMonthRankAsync(月榜) - _Requirements: 10.1-10.5_ - [ ]* 8.3 编写RankService属性测试 - **Property 8: 排行榜排序正确性** - **Validates: Requirements 10.1, 10.2** - [x] 9. 兑换码服务实现 - [x] 9.1 查看PHP代码了解兑换码业务逻辑 - 阅读相关PHP代码了解兑换码验证和奖励发放 - _Requirements: 11.1-11.4_ - [x] 9.2 实现RedeemService - 实现UseRedeemCodeAsync(使用兑换码) - _Requirements: 11.1-11.4_ - [x] 10. 福利屋服务实现 - [x] 10.1 查看PHP代码了解福利屋业务逻辑 - 阅读server/php/app/api/controller/FuLiWu.php中的所有方法 - 理解福利屋列表、详情、参与记录逻辑 - _Requirements: 12.1-14.4_ - [x] 10.2 实现WelfareService - 列表和详情 - 实现GetWelfareListAsync(福利屋列表) - 实现GetWelfareDetailAsync(福利屋详情) - _Requirements: 12.1-13.4_ - [x] 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 - 服务层测试验证 - 确保所有服务层单元测试通过 - 确保所有属性测试通过 - 如有问题请询问用户 - [x] 12. 控制器实现 - UserController扩展 - [x] 12.1 实现余额明细接口 POST /profitMoney - 调用AssetService.GetMoneyRecordsAsync - 更新API接口文档标记迁移状态 - _Requirements: 1.1_ - [x] 12.2 实现吧唧币明细接口 POST /profitIntegral - 调用AssetService.GetIntegralRecordsAsync - 更新API接口文档标记迁移状态 - _Requirements: 1.2_ - [x] 12.3 实现积分明细接口 POST /profitScore - 调用AssetService.GetScoreRecordsAsync - 更新API接口文档标记迁移状态 - _Requirements: 1.3_ - [x] 12.4 实现支付记录接口 POST /profitPay - 调用AssetService.GetPayRecordsAsync - 更新API接口文档标记迁移状态 - _Requirements: 1.4_ - [x] 12.5 实现VIP信息接口 POST /vip_list - 调用VipService.GetVipInfoAsync - 更新API接口文档标记迁移状态 - _Requirements: 2.1-2.5_ - [x] 13. 控制器实现 - CouponController - [x] 13.1 实现优惠券列表接口 POST /coupon_list - 调用CouponService.GetCouponListAsync - 更新API接口文档标记迁移状态 - _Requirements: 3.1-3.4_ - [x] 13.2 实现优惠券详情接口 POST /coupon_detail - 调用CouponService.GetCouponDetailAsync - 更新API接口文档标记迁移状态 - _Requirements: 4.1-4.4_ - [x] 13.3 实现优惠券分享接口 POST /coupon_share - 调用CouponService.ShareCouponAsync - 更新API接口文档标记迁移状态 - _Requirements: 5.1-5.3_ - [x] 13.4 实现优惠券领取接口 POST /coupon_ling - 调用CouponService.ClaimCouponAsync - 更新API接口文档标记迁移状态 - _Requirements: 6.1-6.7_ - [x] 13.5 实现优惠券合成计算接口 POST /coupon_ji_suan - 调用CouponService.CalculateSynthesisAsync - 更新API接口文档标记迁移状态 - _Requirements: 7.1-7.4_ - [x] 13.6 实现优惠券合成接口 POST /coupon_synthesis - 调用CouponService.SynthesisCouponsAsync - 更新API接口文档标记迁移状态 - _Requirements: 7.5_ - [x] 14. 控制器实现 - TaskController - [x] 14.1 实现任务列表接口 POST /task_list - 调用TaskService.GetTaskListAsync - 更新API接口文档标记迁移状态 - _Requirements: 8.1-8.5_ - [x] 14.2 实现领取任务奖励接口 POST /ling_task - 调用TaskService.ClaimTaskRewardAsync - 更新API接口文档标记迁移状态 - _Requirements: 8.6-8.7_ - [x] 15. 控制器实现 - InvitationController - [x] 15.1 实现推荐信息接口 POST /invitation - 调用InvitationService.GetInvitationInfoAsync - 更新API接口文档标记迁移状态 - _Requirements: 9.1-9.2_ - [x] 15.2 实现绑定邀请码接口 POST /bind_invite_code - 调用InvitationService.BindInviteCodeAsync - 更新API接口文档标记迁移状态 - _Requirements: 9.3-9.5_ - [x] 16. 控制器实现 - RankController - [x] 16.1 实现周榜接口 GET /rank_week - 调用RankService.GetWeekRankAsync - 更新API接口文档标记迁移状态 - _Requirements: 10.1, 10.3-10.5_ - [x] 16.2 实现月榜接口 GET /rank_month - 调用RankService.GetMonthRankAsync - 更新API接口文档标记迁移状态 - _Requirements: 10.2-10.5_ - [x] 17. 控制器实现 - RedeemController - [x] 17.1 实现兑换码使用接口 POST /used - 调用RedeemService.UseRedeemCodeAsync - 更新API接口文档标记迁移状态 - _Requirements: 11.1-11.4_ - [x] 18. 控制器实现 - WelfareController - [x] 18.1 实现福利屋列表接口 POST /welfare_house_list - 调用WelfareService.GetWelfareListAsync - 更新API接口文档标记迁移状态 - _Requirements: 12.1-12.5_ - [x] 18.2 实现福利屋详情接口 POST /fuliwu_detail - 调用WelfareService.GetWelfareDetailAsync - 更新API接口文档标记迁移状态 - _Requirements: 13.1-13.4_ - [x] 18.3 实现福利屋参与者接口 POST /fuliwu_participants - 调用WelfareService.GetParticipantsAsync - 更新API接口文档标记迁移状态 - _Requirements: 14.1_ - [x] 18.4 实现福利屋开奖记录接口 POST /fuliwu_records - 调用WelfareService.GetWinningRecordsAsync - 更新API接口文档标记迁移状态 - _Requirements: 14.2_ - [x] 18.5 实现用户参与记录接口 GET /fuliwu_user_records - 调用WelfareService.GetUserParticipationRecordsAsync - 更新API接口文档标记迁移状态 - _Requirements: 14.3_ - [x] 18.6 实现用户中奖记录接口 GET /fuliwu_user_winning_records - 调用WelfareService.GetUserWinningRecordsAsync - 更新API接口文档标记迁移状态 - _Requirements: 14.4_ - [x] 19. Checkpoint - 控制器测试验证 - 确保所有控制器接口可正常访问 - 使用Postman或HTTP文件测试各接口 - 如有问题请询问用户 - [x] 20. 集成测试 - [x] 20.1 编写资产明细集成测试 - 测试完整的资产查询流程 - _Requirements: 1.1-1.6_ - [x] 20.2 编写优惠券集成测试 - 测试优惠券分享、领取、合成流程 - _Requirements: 3.1-7.5_ - [x] 20.3 编写任务系统集成测试 - 测试任务进度和奖励领取流程 - _Requirements: 8.1-8.7_ - [x] 21. 文档更新和最终验证 - [x] 21.1 更新API接口文档 - 确认所有迁移接口都已标记 - 记录新接口地址 - _Requirements: 15.1-15.3_ - [x] 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代码了解详细业务逻辑,确保功能一致性