阶段三

This commit is contained in:
zpc 2026-01-02 17:24:05 +08:00
parent 4d60b1f93d
commit 21c4bb5c6a
3 changed files with 867 additions and 0 deletions

View File

@ -0,0 +1,375 @@
# Design Document: 用户管理系统迁移
## Overview
本设计文档描述了用户管理系统从PHP迁移到.NET 8的技术方案。系统包括用户资产管理、VIP等级、优惠券、任务、推荐关系、排行榜、兑换码和福利屋等模块。
## Architecture
### 系统架构
```
┌─────────────────────────────────────────────────────────────┐
│ API Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐│
│ │UserController│ │CouponController│ │WelfareController ││
│ └─────────────┘ └─────────────┘ └─────────────────────────┘│
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Service Layer │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────────┐ │
│ │IAssetService │ │ICouponService │ │IWelfareService │ │
│ │IVipService │ │ITaskService │ │IRankService │ │
│ │IInvitationSvc │ │IRedeemService │ │
│ └───────────────┘ └───────────────┘ └───────────────────┘ │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Data Layer │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ HoneyBoxDbContext │ │
│ │ ProfitMoney | ProfitIntegral | ProfitMoney2 │ │
│ │ UserCoupon | TaskList | UserTaskList │ │
│ │ UserVip | Order | OrderList | Goods | GoodsList │ │
│ └───────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
```
## Components and Interfaces
### 1. 资产服务接口 (IAssetService)
```csharp
public interface IAssetService
{
// 余额明细查询
Task<PagedResult<AssetRecordDto>> GetMoneyRecordsAsync(int userId, int type, int page, int limit = 15);
// 吧唧币明细查询
Task<PagedResult<AssetRecordDto>> GetIntegralRecordsAsync(int userId, int type, int page, int limit = 15);
// 积分明细查询
Task<PagedResult<AssetRecordDto>> GetScoreRecordsAsync(int userId, int type, int page, int limit = 15);
// 支付记录查询
Task<PagedResult<AssetRecordDto>> GetPayRecordsAsync(int userId, int page, int limit = 15);
}
```
### 2. VIP服务接口 (IVipService)
```csharp
public interface IVipService
{
// 获取VIP信息
Task<VipInfoResponse> GetVipInfoAsync(int userId);
// 计算VIP等级
Task<int> CalculateVipLevelAsync(int userId, int currentVip);
// 获取VIP等级列表
Task<List<VipLevelDto>> GetVipLevelsAsync();
}
```
### 3. 优惠券服务接口 (ICouponService)
```csharp
public interface ICouponService
{
// 获取优惠券列表
Task<CouponListResponse> GetCouponListAsync(int userId, int status, int page, int limit = 15);
// 获取优惠券详情
Task<CouponDetailDto> GetCouponDetailAsync(int userId, int couponId);
// 分享优惠券
Task<bool> ShareCouponAsync(int userId, int couponId);
// 领取优惠券
Task<bool> ClaimCouponAsync(int userId, int couponId);
// 计算合成
Task<SynthesisCalculateResult> CalculateSynthesisAsync(int userId, string couponIds);
// 执行合成
Task<bool> SynthesisCouponsAsync(int userId, string couponIds);
}
```
### 4. 任务服务接口 (ITaskService)
```csharp
public interface ITaskService
{
// 获取任务列表
Task<TaskListResponse> GetTaskListAsync(int userId, int type);
// 领取任务奖励
Task<bool> ClaimTaskRewardAsync(int userId, int taskListId);
}
```
### 5. 推荐服务接口 (IInvitationService)
```csharp
public interface IInvitationService
{
// 获取推荐信息
Task<InvitationInfoResponse> GetInvitationInfoAsync(int userId, int page);
// 绑定邀请码
Task<bool> BindInviteCodeAsync(int userId, string inviteCode);
}
```
### 6. 排行榜服务接口 (IRankService)
```csharp
public interface IRankService
{
// 获取周榜
Task<RankResponse> GetWeekRankAsync(int userId);
// 获取月榜
Task<RankResponse> GetMonthRankAsync(int userId);
}
```
### 7. 兑换码服务接口 (IRedeemService)
```csharp
public interface IRedeemService
{
// 使用兑换码
Task<RedeemResult> UseRedeemCodeAsync(int userId, string code);
}
```
### 8. 福利屋服务接口 (IWelfareService)
```csharp
public interface IWelfareService
{
// 获取福利屋列表
Task<PagedResult<WelfareItemDto>> GetWelfareListAsync(int userId, int type, int page, int limit = 15);
// 获取福利屋详情
Task<WelfareDetailResponse> GetWelfareDetailAsync(int userId, int goodsId);
// 获取参与者列表
Task<List<ParticipantDto>> GetParticipantsAsync(int goodsId);
// 获取开奖记录
Task<List<WinningRecordDto>> GetWinningRecordsAsync(int goodsId);
// 获取用户参与记录
Task<List<UserParticipationDto>> GetUserParticipationRecordsAsync(int userId);
// 获取用户中奖记录
Task<List<UserWinningDto>> GetUserWinningRecordsAsync(int userId);
}
```
## Data Models
### 资产记录DTO
```csharp
public class AssetRecordDto
{
public string ChangeMoney { get; set; }
public string Content { get; set; }
public string AddTime { get; set; }
}
```
### VIP信息响应
```csharp
public class VipInfoResponse
{
public VipUserInfoDto Userinfo { get; set; }
public List<VipLevelDto> Data { get; set; }
}
public class VipUserInfoDto
{
public string Nickname { get; set; }
public string Headimg { get; set; }
public int Vip { get; set; }
public string UpgradeMoney { get; set; }
public int LastVip { get; set; }
public decimal JinDu { get; set; }
public string Notice { get; set; }
}
```
### 优惠券DTO
```csharp
public class CouponDto
{
public int Id { get; set; }
public int Status { get; set; }
public int Level { get; set; }
public string LevelText { get; set; }
public string LevelImg { get; set; }
public string Title { get; set; }
public string Num { get; set; }
public int KlNum { get; set; }
public int KlNum2 { get; set; }
public int YiLing { get; set; }
}
```
### 任务DTO
```csharp
public class TaskDto
{
public int Id { get; set; }
public int Type { get; set; }
public int Cate { get; set; }
public string Title { get; set; }
public int Number { get; set; }
public int ZNumber { get; set; }
public int IsComplete { get; set; }
public int Percentage { get; set; }
public int YwcCount { get; set; }
}
```
### 排行榜DTO
```csharp
public class RankItemDto
{
public int Rank { get; set; }
public int UserId { get; set; }
public string Nickname { get; set; }
public string Headimg { get; set; }
public decimal OrderTotal { get; set; }
public string PrizeTitle { get; set; }
public string PrizeImgurl { get; set; }
}
```
## Correctness Properties
*A property is a characteristic or behavior that should hold true across all valid executions of a system-essentially, a formal statement about what the system should do. Properties serve as the bridge between human-readable specifications and machine-verifiable correctness guarantees.*
### Property 1: 资产记录分页一致性
*For any* asset record query with pagination, the returned last_page value SHALL correctly reflect the total number of pages based on total records and page size.
**Validates: Requirements 1.1, 1.2, 1.3, 1.4, 1.6**
### Property 2: VIP等级计算正确性
*For any* user with total consumption amount X, the calculated VIP level SHALL be the highest level whose condition is less than or equal to X.
**Validates: Requirements 2.1, 2.2**
### Property 3: VIP升级进度计算
*For any* user not at maximum VIP level, the upgrade progress percentage SHALL equal (current_consumption / next_level_threshold) * 100.
**Validates: Requirements 2.4**
### Property 4: 优惠券等级映射
*For any* coupon with level L, the level_text and level_img SHALL correctly map to: 1=特级赏券, 2=终极赏券, 3=高级赏券, 4=普通赏券.
**Validates: Requirements 3.3**
### Property 5: 优惠券领取随机金额
*For any* coupon claim, the random amount SHALL be between minimum (1) and remaining pool, and the sum of all claimed amounts SHALL not exceed the original coupon value.
**Validates: Requirements 6.1**
### Property 6: 优惠券合成损耗
*For any* coupon synthesis, the new coupon value SHALL equal sum of original values minus 10% loss.
**Validates: Requirements 7.2**
### Property 7: 任务周期计算
*For any* daily task, the progress SHALL only count activities within current day (00:00:00 to 23:59:59).
*For any* weekly task, the progress SHALL only count activities within current week (Monday 00:00:00 to Sunday 23:59:59).
**Validates: Requirements 8.2, 8.3**
### Property 8: 排行榜排序正确性
*For any* ranking query, the returned list SHALL be sorted by consumption amount in descending order, with ties broken by user_id in ascending order.
**Validates: Requirements 10.1, 10.2**
### Property 9: 福利屋解锁金额验证
*For any* welfare house with unlock_amount > 0, only users whose total consumption >= unlock_amount SHALL be able to view the activity.
**Validates: Requirements 12.3, 13.1**
## Error Handling
### 通用错误处理
| 错误场景 | 错误码 | 错误消息 |
|---------|--------|---------|
| 参数缺失 | 0 | 缺少必要参数 |
| 数据不存在 | 0 | 数据不存在/参数错误 |
| 未授权 | -1 | 请先登录 |
| 业务限制 | 2222 | 具体业务提示 |
### 优惠券特殊错误
| 错误场景 | 错误码 | 错误消息 |
|---------|--------|---------|
| 领取自己的券 | 2222 | 请勿开启自己的劵 |
| 已领取过 | 2222 | 你已经领取过了 |
| 已被领完 | 2222 | 来晚了, 已经被人领完了 |
| 达到每日上限 | 0 | 每天最多领取N次 |
| 特级/终极券不能合成 | 0 | 特级,终极赏券不能合成 |
| 超过合成数量限制 | 0 | 最多只能20个合成 |
## Testing Strategy
### 单元测试
- 测试各服务的核心业务逻辑
- 测试边界条件和错误处理
- 使用Mock隔离外部依赖
### 属性测试
使用FsCheck进行属性测试验证以下属性
- VIP等级计算正确性
- 优惠券合成损耗计算
- 任务周期边界计算
- 排行榜排序正确性
### 集成测试
- 测试完整的API请求响应流程
- 测试数据库事务一致性
- 测试Redis缓存行为
### 测试配置
```csharp
// 属性测试配置
[Property(MaxTest = 100)]
public Property VipLevelCalculation_ShouldBeCorrect()
{
return Prop.ForAll<decimal>(consumption =>
{
var level = CalculateVipLevel(consumption);
// 验证等级正确性
});
}
```

View File

@ -0,0 +1,195 @@
# Requirements Document
## Introduction
本文档定义了用户管理系统从PHP迁移到.NET 8的需求规范。用户管理系统包括用户资产管理、VIP等级系统、优惠券系统、任务系统、推荐关系管理、排行榜系统、兑换码系统和福利屋系统等功能模块。
## Glossary
- **User_Management_System**: 用户管理系统,负责管理用户资产、等级、优惠券等功能
- **Asset_Service**: 资产服务,处理用户余额、积分、吧唧币等资产变更
- **VIP_Service**: VIP服务处理用户VIP等级计算和升级
- **Coupon_Service**: 优惠券服务,处理优惠券的分享、领取、合成等功能
- **Task_Service**: 任务服务,处理每日/每周任务的进度计算和奖励发放
- **Invitation_Service**: 推荐服务,处理用户推荐关系和奖励
- **Rank_Service**: 排行榜服务,处理周榜和月榜排名
- **Redeem_Service**: 兑换码服务,处理兑换码验证和奖励发放
- **Welfare_Service**: 福利屋服务,处理福利活动的展示和参与
## Requirements
### Requirement 1: 用户资产明细查询
**User Story:** As a user, I want to view my asset transaction records, so that I can track my balance, integral, and score changes.
#### Acceptance Criteria
1. WHEN a user requests balance records with type filter, THE Asset_Service SHALL return paginated balance change records matching the filter criteria
2. WHEN a user requests integral records with type filter, THE Asset_Service SHALL return paginated integral change records matching the filter criteria
3. WHEN a user requests score records with type filter, THE Asset_Service SHALL return paginated score change records matching the filter criteria
4. WHEN a user requests payment records, THE Asset_Service SHALL return paginated payment records
5. FOR ALL asset record queries, THE Asset_Service SHALL format timestamps as "Y-m-d H:i:s" format
6. FOR ALL asset record queries, THE Asset_Service SHALL return last_page for pagination
### Requirement 2: VIP等级系统
**User Story:** As a user, I want to view my VIP level and upgrade progress, so that I can understand my membership benefits.
#### Acceptance Criteria
1. WHEN a user requests VIP information, THE VIP_Service SHALL calculate current VIP level based on total order consumption
2. WHEN a user's consumption meets upgrade threshold, THE VIP_Service SHALL automatically upgrade the user's VIP level
3. WHEN a user requests VIP list, THE VIP_Service SHALL return all VIP levels with conditions and privileges
4. THE VIP_Service SHALL calculate upgrade progress percentage based on current consumption and next level threshold
5. WHEN a user reaches maximum VIP level (5), THE VIP_Service SHALL indicate no further upgrades available
### Requirement 3: 优惠券列表查询
**User Story:** As a user, I want to view my coupons, so that I can manage and use them.
#### Acceptance Criteria
1. WHEN a user requests coupon list with status=1, THE Coupon_Service SHALL return unused coupons ordered by id desc
2. WHEN a user requests coupon list with status=2, THE Coupon_Service SHALL return shared coupons ordered by share_time desc
3. FOR ALL coupons, THE Coupon_Service SHALL return level_text and level_img based on coupon level (1=特级赏券, 2=终极赏券, 3=高级赏券, 4=普通赏券)
4. THE Coupon_Service SHALL return y_count (today's claimed count), z_count (total limit=50), user_integral, ke_hc_count (max synthesis=20), sun_hao (loss rate=10%)
### Requirement 4: 优惠券详情查询
**User Story:** As a user, I want to view coupon details, so that I can see who claimed my shared coupon.
#### Acceptance Criteria
1. WHEN a user requests coupon detail, THE Coupon_Service SHALL return coupon information including level, share_time, num, own2
2. THE Coupon_Service SHALL return yl_count (claimed count) and yl_integral_count (total claimed integral)
3. THE Coupon_Service SHALL return share_user information (nickname, headimg)
4. THE Coupon_Service SHALL return yl_list with claimer details and lucky_king flag for highest amount
### Requirement 5: 优惠券分享
**User Story:** As a user, I want to share my coupon, so that others can claim it.
#### Acceptance Criteria
1. WHEN a user shares a coupon, THE Coupon_Service SHALL update coupon status to 2 (shared)
2. WHEN a user shares a coupon, THE Coupon_Service SHALL set share_time to current timestamp
3. IF the coupon does not belong to the user, THEN THE Coupon_Service SHALL return error
### Requirement 6: 优惠券领取
**User Story:** As a user, I want to claim shared coupons, so that I can get integral rewards.
#### Acceptance Criteria
1. WHEN a user claims a coupon, THE Coupon_Service SHALL generate random amount from remaining pool
2. WHEN a user claims a coupon, THE Coupon_Service SHALL add integral to user's account
3. IF the user is the coupon owner, THEN THE Coupon_Service SHALL return error with code 2222
4. IF the user already claimed this coupon, THEN THE Coupon_Service SHALL return error with code 2222
5. IF the user reached daily claim limit, THEN THE Coupon_Service SHALL return error
6. IF the coupon has no remaining amount, THEN THE Coupon_Service SHALL return error with code 2222
7. WHEN a coupon is claimed, THE Coupon_Service SHALL give share reward to coupon owner
### Requirement 7: 优惠券合成
**User Story:** As a user, I want to synthesize multiple coupons into a higher level coupon, so that I can get better rewards.
#### Acceptance Criteria
1. WHEN a user calculates synthesis, THE Coupon_Service SHALL return new coupon level based on total value
2. THE Coupon_Service SHALL apply 10% loss rate to synthesis
3. IF any coupon is level 1 or 2 (特级/终极), THEN THE Coupon_Service SHALL return error
4. IF coupon count exceeds 20, THEN THE Coupon_Service SHALL return error
5. WHEN synthesis is confirmed, THE Coupon_Service SHALL delete original coupons and create new coupon
### Requirement 8: 任务系统
**User Story:** As a user, I want to complete tasks and claim rewards, so that I can earn extra benefits.
#### Acceptance Criteria
1. WHEN a user requests task list, THE Task_Service SHALL return tasks with completion status and progress
2. FOR daily tasks (type=1), THE Task_Service SHALL calculate progress within current day
3. FOR weekly tasks (type=2), THE Task_Service SHALL calculate progress within current week (Monday to Sunday)
4. FOR invitation tasks (cate=1), THE Task_Service SHALL count new referrals in the period
5. FOR lottery tasks (cate=2), THE Task_Service SHALL count paid orders in the period
6. WHEN a user claims task reward, THE Task_Service SHALL verify task completion and add ou_qi reward
7. IF the user already claimed the task in current period, THEN THE Task_Service SHALL return error
### Requirement 9: 推荐关系管理
**User Story:** As a user, I want to invite friends and track my referrals, so that I can earn referral rewards.
#### Acceptance Criteria
1. WHEN a user requests invitation info, THE Invitation_Service SHALL return referral code and statistics
2. THE Invitation_Service SHALL return recent referrals with nickname, headimg, register_time, and reward
3. WHEN a user binds invite code, THE Invitation_Service SHALL update user's pid to inviter's id
4. IF the invite code is invalid, THEN THE Invitation_Service SHALL return error
5. IF the user already has a referrer, THEN THE Invitation_Service SHALL return error
### Requirement 10: 排行榜系统
**User Story:** As a user, I want to view consumption rankings, so that I can see my position among other users.
#### Acceptance Criteria
1. WHEN a user requests week ranking, THE Rank_Service SHALL return top 30 users by weekly consumption
2. WHEN a user requests month ranking, THE Rank_Service SHALL return top 30 users by monthly consumption
3. THE Rank_Service SHALL return user's own rank and consumption amount
4. THE Rank_Service SHALL return prize information for each rank position
5. THE Rank_Service SHALL return date range and end_date for the ranking period
### Requirement 11: 兑换码系统
**User Story:** As a user, I want to use redemption codes, so that I can get rewards.
#### Acceptance Criteria
1. WHEN a user submits a redemption code, THE Redeem_Service SHALL verify code validity
2. IF the code is valid, THEN THE Redeem_Service SHALL grant reward and mark code as used
3. IF the code is invalid or already used, THEN THE Redeem_Service SHALL return error
4. THE Redeem_Service SHALL return reward type and amount after successful redemption
### Requirement 12: 福利屋列表
**User Story:** As a user, I want to view welfare house activities, so that I can participate and win prizes.
#### Acceptance Criteria
1. WHEN a user requests welfare list with type=1, THE Welfare_Service SHALL return ongoing activities
2. WHEN a user requests welfare list with type=3, THE Welfare_Service SHALL return completed activities ordered by open_time desc
3. THE Welfare_Service SHALL filter activities by user's unlock_amount (total consumption)
4. FOR ALL activities, THE Welfare_Service SHALL return join_count (participation count)
5. THE Welfare_Service SHALL format time fields as "Y-m-d H:i:s"
### Requirement 13: 福利屋详情
**User Story:** As a user, I want to view welfare house details, so that I can understand the activity rules and prizes.
#### Acceptance Criteria
1. WHEN a user requests welfare detail, THE Welfare_Service SHALL verify user meets unlock_amount requirement
2. THE Welfare_Service SHALL return goods info, prize list, join_count, and user's participation count
3. THE Welfare_Service SHALL return user's consumption data within activity period
4. THE Welfare_Service SHALL return activity status (waiting/ongoing/ended/to_open/opened)
### Requirement 14: 福利屋参与记录
**User Story:** As a user, I want to view welfare house participation and winning records, so that I can track my activities.
#### Acceptance Criteria
1. WHEN a user requests participants list, THE Welfare_Service SHALL return users who participated in the activity
2. WHEN a user requests winning records, THE Welfare_Service SHALL return users who won prizes
3. WHEN a user requests own participation records, THE Welfare_Service SHALL return user's participation history
4. WHEN a user requests own winning records, THE Welfare_Service SHALL return user's winning history
### Requirement 15: API文档更新
**User Story:** As a developer, I want the API documentation to reflect migration status, so that I can track migration progress.
#### Acceptance Criteria
1. WHEN an interface is migrated, THE Documentation SHALL be updated with migration status marker
2. THE Documentation SHALL include new interface address for migrated endpoints
3. THE Documentation SHALL maintain backward compatibility information

View File

@ -0,0 +1,297 @@
# 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代码了解详细业务逻辑确保功能一致性