fix:提交修复6个问题
This commit is contained in:
@@ -2,6 +2,7 @@ import { Body, Controller, Get, Param, Post, Put, Query, UseGuards } from '@nest
|
||||
import { StoreService } from './store.service';
|
||||
import { RedeemService } from '../redeem/redeem.service';
|
||||
import { JwtAuthGuard, AuthUser } from '../../common/guards/jwt-auth.guard';
|
||||
import { PartnerPrimaryGuard } from '../../common/guards/partner-primary.guard';
|
||||
import { CurrentUser } from '../../common/decorators/current-user.decorator';
|
||||
|
||||
@Controller('stores')
|
||||
@@ -34,6 +35,11 @@ export class PartnerStoreController {
|
||||
return this.storeService.partnerListCities(user.actorId);
|
||||
}
|
||||
|
||||
@Get('phone-available')
|
||||
phoneAvailable(@Query('phone') phone?: string) {
|
||||
return this.storeService.partnerCheckStorePhone(phone ?? '');
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
detail(@CurrentUser() user: AuthUser, @Param('id') id: string) {
|
||||
return this.storeService.partnerGetStore(user.actorId, BigInt(id));
|
||||
@@ -64,7 +70,7 @@ export class PartnerStoreController {
|
||||
}
|
||||
|
||||
@Controller('partner/dashboard')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, PartnerPrimaryGuard)
|
||||
export class PartnerDashboardController {
|
||||
constructor(private readonly storeService: StoreService) {}
|
||||
|
||||
@@ -72,6 +78,30 @@ export class PartnerDashboardController {
|
||||
dashboard(@CurrentUser() user: AuthUser) {
|
||||
return this.storeService.partnerDashboard(user.actorId);
|
||||
}
|
||||
|
||||
@Get('leaderboard')
|
||||
leaderboard(
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Query('period') period?: string,
|
||||
) {
|
||||
const normalized =
|
||||
period === 'month' || period === 'lastMonth' || period === 'total' ? period : 'total';
|
||||
return this.storeService.partnerLeaderboard(user.actorId, normalized);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller('partner/reports')
|
||||
@UseGuards(JwtAuthGuard, PartnerPrimaryGuard)
|
||||
export class PartnerReportController {
|
||||
constructor(private readonly storeService: StoreService) {}
|
||||
|
||||
@Get('weekly')
|
||||
weekly(
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Query('startDate') startDate?: string,
|
||||
) {
|
||||
return this.storeService.partnerWeeklyReport(user.actorId, startDate);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller('shop/store')
|
||||
|
||||
Reference in New Issue
Block a user