feat(store): 门店详情核销记录走马灯
新增 GET /stores/:id/recent-redeems,C 端在门店详情区上方循环展示脱敏核销动态。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,7 +12,10 @@ import { CurrentUser } from '../../common/decorators/current-user.decorator';
|
||||
|
||||
@Controller('stores')
|
||||
export class PublicStoreController {
|
||||
constructor(private readonly storeService: StoreService) {}
|
||||
constructor(
|
||||
private readonly storeService: StoreService,
|
||||
private readonly redeemService: RedeemService,
|
||||
) {}
|
||||
|
||||
@Get()
|
||||
@UseGuards(OptionalJwtAuthGuard)
|
||||
@@ -28,6 +31,24 @@ export class PublicStoreController {
|
||||
return this.storeService.listOpenStores(cityCode, userLat, userLng, { phone: viewerPhone });
|
||||
}
|
||||
|
||||
@Get(':id/recent-redeems')
|
||||
@UseGuards(OptionalJwtAuthGuard)
|
||||
async recentRedeems(
|
||||
@CurrentUser() user: AuthUser | undefined,
|
||||
@Param('id') id: string,
|
||||
@Query('limit') limit?: string,
|
||||
) {
|
||||
const viewerPhone = await this.resolveViewerPhone(user);
|
||||
// 与详情同权:白名单门店对不可见用户返回空(不泄露存在核销)
|
||||
try {
|
||||
await this.storeService.getStore(BigInt(id), { phone: viewerPhone });
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
const n = limit != null && limit !== '' ? Number(limit) : 20;
|
||||
return this.redeemService.listPublicStoreRecentRedeems(BigInt(id), Number.isFinite(n) ? n : 20);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
@UseGuards(OptionalJwtAuthGuard)
|
||||
async detail(@CurrentUser() user: AuthUser | undefined, @Param('id') id: string) {
|
||||
|
||||
Reference in New Issue
Block a user