门店账户多账号

This commit is contained in:
2026-07-12 12:24:34 +08:00
parent 06b1cb22e0
commit 54a15d6da7
39 changed files with 1962 additions and 311 deletions
@@ -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);
}
}