diff --git a/.workbuddy/expert-history.json b/.workbuddy/expert-history.json index f15b4ca..c0ada6c 100644 --- a/.workbuddy/expert-history.json +++ b/.workbuddy/expert-history.json @@ -24,5 +24,5 @@ } ] }, - "lastUpdated": 1776103090047 + "lastUpdated": 1776132867828 } \ No newline at end of file diff --git a/.workbuddy/memory/2026-04-14.md b/.workbuddy/memory/2026-04-14.md index c2c5bed..81ba2eb 100644 --- a/.workbuddy/memory/2026-04-14.md +++ b/.workbuddy/memory/2026-04-14.md @@ -40,3 +40,17 @@ - API: `api/shop/referral.ts` - 页面: `dealer/referral/index.tsx` - 首页入口: 在分销商首页添加「推荐客户」功能 + +### 编译错误修复(10:14) +1. **Controller层** - `R.ok()` → `ApiResult` + `success()`,两个Controller均继承 `BaseController` + - `CustomerLeadController`: 去掉 `import R`,改用 `ApiResult` + `extends BaseController` + - `LeadReferralController`: 同上 + +2. **Service层** - `userService.getLoginUser()` 方法不存在 + - `CustomerLeadServiceImpl`: 去掉 `UserService` 注入,改用私有 `getLoginUser()` 方法(通过 `SecurityContextHolder` 实现,与 `BaseController` 逻辑一致) + - `LeadReferralServiceImpl`: 同上;另外修正 `userService.getUserById()` → `userService.getByIdRel()`(`UserService` 仍保留用于按ID查询用户) + +**项目规范记录**: +- 返回值用 `ApiResult` + `success()`,Controller继承 `BaseController` +- Service层获取登录用户:`SecurityContextHolder.getContext().getAuthentication().getPrincipal()` 强转 `User` +- 按ID查询用户:`userService.getByIdRel(userId)`(非 `getUserById`)