门店账户多账号
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Get, Post, Req, UseGuards } from '@nestjs/common';
|
||||
import { BadRequestException, Body, Controller, Get, Post, Req, UseGuards } from '@nestjs/common';
|
||||
import type { Request } from 'express';
|
||||
import { AuthService } from './auth.service';
|
||||
import {
|
||||
@@ -122,6 +122,7 @@ export class ShopAuthController {
|
||||
dto.code,
|
||||
ClientApp.SHOP_H5,
|
||||
dto.platform ?? 'h5',
|
||||
user.storeId,
|
||||
);
|
||||
}
|
||||
return this.authService.loginStoreWechat(dto.code, ClientApp.SHOP_H5, dto.platform ?? 'h5');
|
||||
@@ -132,10 +133,23 @@ export class ShopAuthController {
|
||||
return this.authService.refreshAccessToken(dto.refreshToken, ClientApp.SHOP_H5);
|
||||
}
|
||||
|
||||
@Get('stores')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
stores(@CurrentUser() user: AuthUser) {
|
||||
return this.authService.listShopStores(user.actorId);
|
||||
}
|
||||
|
||||
@Post('select-store')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
selectStore(@CurrentUser() user: AuthUser, @Body() body: { storeId: string }) {
|
||||
if (!body?.storeId) throw new BadRequestException('请选择门店');
|
||||
return this.authService.selectShopStore(user.actorId, BigInt(body.storeId), ClientApp.SHOP_H5);
|
||||
}
|
||||
|
||||
@Get('me')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
me(@CurrentUser() user: AuthUser) {
|
||||
return this.authService.getMe(user.actorType, user.actorId);
|
||||
return this.authService.getShopMe(user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user