From 337b253ed96c2eb10b21e0bd47ad4c9bbac128df Mon Sep 17 00:00:00 2001 From: "chuanzhen.zhu" <chuanzhen.zhu@downtown8.com> Date: Tue, 1 Apr 2025 14:07:14 +0800 Subject: [PATCH] feat: GetMobielOrderConfig --- Proto.lock | 4 +- Proto.toml | 2 +- proto/vendor/rms-mobile-hera/Proto.toml | 2 +- .../vendor/rms-mobile-hera/mobileConfig.proto | 72 +++++++++++++++++++ src/app.module.ts | 4 +- src/controller/mobileConfig.controller.ts | 15 ++++ src/main.ts | 2 +- 7 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 proto/vendor/rms-mobile-hera/mobileConfig.proto create mode 100644 src/controller/mobileConfig.controller.ts diff --git a/Proto.lock b/Proto.lock index e914b10..aa4173b 100644 --- a/Proto.lock +++ b/Proto.lock @@ -2,9 +2,9 @@ version = 1 [[packages]] name = "rms-mobile-hera" -digest = "sha256:46ea53350b84c8148116fc4dd7c7528d57d1d44dec05fcd44ed7f78742ec87d0" +digest = "sha256:aa1df7d6d4a8341148600cf556f1373f2ee1b36482fe53ca8a076468564f7cab" registry = "https://jfrog.downtown8.com/artifactory" repository = "protobuf" -version = "0.1.7" +version = "0.1.8" dependencies = [] dependants = 1 diff --git a/Proto.toml b/Proto.toml index 38ad9a6..ddde563 100644 --- a/Proto.toml +++ b/Proto.toml @@ -1,6 +1,6 @@ edition = "0.9" [dependencies.rms-mobile-hera] -version = "=0.1.7" +version = "=0.1.8" repository = "protobuf" registry = "https://jfrog.downtown8.com/artifactory" diff --git a/proto/vendor/rms-mobile-hera/Proto.toml b/proto/vendor/rms-mobile-hera/Proto.toml index 9bb043f..fcdfd5e 100644 --- a/proto/vendor/rms-mobile-hera/Proto.toml +++ b/proto/vendor/rms-mobile-hera/Proto.toml @@ -3,6 +3,6 @@ edition = "0.9" [package] type = "api" name = "rms-mobile-hera" -version = "0.1.7" +version = "0.1.8" [dependencies] diff --git a/proto/vendor/rms-mobile-hera/mobileConfig.proto b/proto/vendor/rms-mobile-hera/mobileConfig.proto new file mode 100644 index 0000000..0f4a19b --- /dev/null +++ b/proto/vendor/rms-mobile-hera/mobileConfig.proto @@ -0,0 +1,72 @@ +syntax = "proto3"; + +option go_package = "rmsMobile"; + +package mobileConfig; + +message StoreIdDto { + int32 brandId = 1; + int32 storeId = 2; +} + +message TimeHourStartAndEnd { + string start = 1; + string end = 2; +} + +message EatTypeDto { + string eatType = 1; + bool isOpen = 2; + string name = 3; +} + +message MobileOrderConfigData { + int32 brandId = 1; + int32 storeId = 2; + bool isStoreInfoShow =3; + bool isCostomShow = 4; + string costomShowValue = 5; + string costomShowMode = 6; + string costomShowTimeType = 7; + repeated int32 costomShowTimeValue = 8; + string costomShowTimeDateStart = 9; + string costomShowTimeDateEnd = 10; + repeated TimeHourStartAndEnd costomShowTimeHours = 11; + + bool isWaitInfoShow = 12; + string waitInfoShowType = 13; + int32 waitTimeShowMoreThan = 14; + int32 waitTimeEveryProduct = 15; + + bool isSaleShow = 16; + bool isStockShow = 17; + string saleShowTimeRange = 18; + int32 saleShowMoreThan = 19; + string stockOverShowType = 20; + + bool isSmartPushShow = 21; + string smartPushShowType = 22; + + bool isSearchShow = 23; + + repeated EatTypeDto brandCodeEatTypes = 24; + repeated EatTypeDto tableCodeEatTypes = 25; + + bool isMobileMust = 26; + + bool isRemarkCommit = 27; + repeated string remarkTemplates = 28; + + bool isPickupNotice = 29; +} + +message MobileOrderConfigRes { + int32 code = 1; + string msg = 2; + MobileOrderConfigData data = 3; +} + +service MobileConfigService { + // gql-query + rpc GetMobielOrderConfig(StoreIdDto) returns (MobileOrderConfigRes); +} \ No newline at end of file diff --git a/src/app.module.ts b/src/app.module.ts index d228139..52c9934 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -1,9 +1,11 @@ import { Module } from '@nestjs/common'; import { OrderConfigController } from '@/controller/storeOrderConfig.controller'; import { DecorationConfigController } from '@/controller/decorationConfig.controller'; +import { MobileConfigController } from '@/controller/mobileConfig.controller'; + @Module({ imports: [], - controllers: [OrderConfigController, DecorationConfigController], + controllers: [OrderConfigController, DecorationConfigController, MobileConfigController], providers: [], }) export class AppModule {} diff --git a/src/controller/mobileConfig.controller.ts b/src/controller/mobileConfig.controller.ts new file mode 100644 index 0000000..49bb173 --- /dev/null +++ b/src/controller/mobileConfig.controller.ts @@ -0,0 +1,15 @@ +import { Controller } from '@nestjs/common'; +import { Metadata } from '@grpc/grpc-js'; +import { GrpcMethod } from '@nestjs/microservices'; + +import { postProxy } from '@/lib/rpc2Http'; + +@Controller('mobileConfig') +export class MobileConfigController { + storeOrderConfigUrl = process.env.STORE_ORDER_CONFIG_URL; + + @GrpcMethod('MobileConfigService') + GetMobielOrderConfig(data: any, metadata: Metadata) { + return postProxy(this.storeOrderConfigUrl + '/cache/getMobielOrderConfig', data, metadata); + } +} diff --git a/src/main.ts b/src/main.ts index 331abf5..199631f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -30,7 +30,7 @@ async function bootstrap() { const app = await NestFactory.createMicroservice<MicroserviceOptions>(AppModule, { transport: Transport.GRPC, options: { - package: ['rmsMobile', 'decorationConfig'], + package: ['rmsMobile', 'decorationConfig', 'mobileConfig'], protoPath: protoFilePath, url: `0.0.0.0:${PORT}`, loader: { keepCase: true }, -- GitLab