From 5b05e8b6d4d9fa7f40b496705be0ed7699d35349 Mon Sep 17 00:00:00 2001 From: "chuanzhen.zhu" <chuanzhen.zhu@downtown8.com> Date: Wed, 26 Mar 2025 10:24:42 +0800 Subject: [PATCH 1/6] fix: PayModule --- Proto.lock | 9 +++++++++ Proto.toml | 7 ++++++- config-templates/config/.env | 3 +++ config/.env | 2 ++ src/app.module.ts | 4 +++- src/common/base.grpc.service.ts | 13 +++++++++++-- src/pay/pay.graphql | 7 +++++++ src/pay/pay.module.ts | 26 ++++++++++++++++++++++++++ src/pay/payment.resolver.ts | 24 ++++++++++++++++++++++++ src/pay/payment.service.ts | 24 ++++++++++++++++++++++++ 10 files changed, 115 insertions(+), 4 deletions(-) create mode 100644 src/pay/pay.graphql create mode 100644 src/pay/pay.module.ts create mode 100644 src/pay/payment.resolver.ts create mode 100644 src/pay/payment.service.ts diff --git a/Proto.lock b/Proto.lock index 2d95840..d0d6861 100644 --- a/Proto.lock +++ b/Proto.lock @@ -9,6 +9,15 @@ version = "0.0.10" dependencies = [] dependants = 1 +[[packages]] +name = "pay-hera" +digest = "sha256:e8b4d70d38e206516d50e62805a23c9b74911cfe7cd7ecf9bd63dbce7a6f8767" +registry = "https://jfrog.downtown8.com/artifactory" +repository = "protobuf" +version = "0.1.7" +dependencies = [] +dependants = 1 + [[packages]] name = "user-center-hera" digest = "sha256:dca5189f791f3d00a7c3e773b1143011c35e13c07f618a91d5fdda4493a321c9" diff --git a/Proto.toml b/Proto.toml index 1f5371b..5fef67d 100644 --- a/Proto.toml +++ b/Proto.toml @@ -5,7 +5,12 @@ version = "=0.1.28" repository = "protobuf" registry = "https://jfrog.downtown8.com/artifactory" +[dependencies.pay-hera] +version = "=0.1.7" +repository = "protobuf" +registry = "https://jfrog.downtown8.com/artifactory" + [dependencies.g-hq-orchestrator-hera] version = "=0.0.10" repository = "protobuf" -registry = "https://jfrog.downtown8.com/artifactory" \ No newline at end of file +registry = "https://jfrog.downtown8.com/artifactory" diff --git a/config-templates/config/.env b/config-templates/config/.env index 8cdcb66..0990ba4 100644 --- a/config-templates/config/.env +++ b/config-templates/config/.env @@ -16,5 +16,8 @@ USER_CENTER_SERVICE_GRPC_PORT=9000 HQ_ORCHESTRATOR_SERVICE=g-hq-orchestrator HQ_ORCHESTRATOR_SERVICE_GRPC_PORT=9000 +PAY_CENTER_SERVICE=n-pay-center +PAY_CENTER_SERVICE_GRPC_PORT=9000 + QYWX_BOT_KEY={{getv "/configuration/projects/pos-bff-service/QYWX_BOT_KEY"}} \ No newline at end of file diff --git a/config/.env b/config/.env index 934db09..ece3e6d 100644 --- a/config/.env +++ b/config/.env @@ -15,6 +15,8 @@ USER_CENTER_SERVICE_GRPC_PORT=8080 HQ_ORCHESTRATOR_SERVICE=127.0.0.1 HQ_ORCHESTRATOR_SERVICE_GRPC_PORT=9000 +PAY_CENTER_SERVICE=127.0.0.1 +PAY_CENTER_SERVICE_GRPC_PORT=9000 RABBIT_VHOST=localv1 QYWX_BOT_KEY="d01614bc-dc2f-4e54-ad79-bedbfd9faeb6" \ No newline at end of file diff --git a/src/app.module.ts b/src/app.module.ts index 3350201..90cea89 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -18,6 +18,7 @@ import { grpcResolver } from "./common/grpcResolver"; import { GrpcMetadataInterceptor } from "./interceptor/grpc-metadata.interceptor"; import { UserLoginModule } from "./userLogin/userLogin.module"; import { PublicModule } from './public/public.module'; +import { PayModule } from './pay/pay.module'; @Module({ imports: [ GraphQLModule.forRootAsync<ApolloDriverConfig>({ @@ -118,7 +119,8 @@ import { PublicModule } from './public/public.module'; }), UserCenterModule, UserLoginModule, - PublicModule + PublicModule, + PayModule ], controllers: [AppController], providers: [ diff --git a/src/common/base.grpc.service.ts b/src/common/base.grpc.service.ts index 12b0b14..4720f83 100644 --- a/src/common/base.grpc.service.ts +++ b/src/common/base.grpc.service.ts @@ -14,15 +14,22 @@ export class BaseGrpcService { protected userPermitService: any; protected userAccessService: any; protected hqPublicOrchestratorService: any; + protected payService: any; protected get serviceMap() { return { hqUserPermit: this.userPermitService, hqUserAccess: this.userAccessService, hqPublicOrchestrator: this.hqPublicOrchestratorService, + payService: this.payService, }; } - protected async callGrpcMethod(serviceName: string, methodName: string, input: any, context: any) { + protected async callGrpcMethod( + serviceName: string, + methodName: string, + input: any, + context: any + ) { const service = this.serviceMap[serviceName]; const request = context.req; const metadata: Metadata = request.grpcMetadata; @@ -39,7 +46,9 @@ export class BaseGrpcService { input.storeId = request.storeId; } - const result = await lastValueFrom<GrpcResponse>(service[methodName](input, metadata)); + const result = await lastValueFrom<GrpcResponse>( + service[methodName](input, metadata) + ); console.log("result--------", result); diff --git a/src/pay/pay.graphql b/src/pay/pay.graphql new file mode 100644 index 0000000..290997c --- /dev/null +++ b/src/pay/pay.graphql @@ -0,0 +1,7 @@ +input BrandIdDto { + brandId: Int +} + +type Query { + WechatBankList(input: BrandIdDto!): [String] +} diff --git a/src/pay/pay.module.ts b/src/pay/pay.module.ts new file mode 100644 index 0000000..f4bf70d --- /dev/null +++ b/src/pay/pay.module.ts @@ -0,0 +1,26 @@ +import { join } from "path"; +import { Module } from "@nestjs/common"; +import { PaymentResolver } from "./payment.resolver"; +import { PaymentService } from "./payment.service"; + +import { ClientsModule, Transport } from "@nestjs/microservices"; + +@Module({ + imports: [ + ClientsModule.register([ + { + name: "PAY-CENTER", + transport: Transport.GRPC, + options: { + url: `${process.env.PAY_CENTER_SERVICE}:${process.env.PAY_CENTER_SERVICE_GRPC_PORT}`, + package: ["pay"], + protoPath: [ + join(process.cwd(), "proto/vendor/pay-hera/payment.proto"), + ], + }, + }, + ]), + ], + providers: [PaymentResolver, PaymentService], +}) +export class PayModule {} diff --git a/src/pay/payment.resolver.ts b/src/pay/payment.resolver.ts new file mode 100644 index 0000000..2b38216 --- /dev/null +++ b/src/pay/payment.resolver.ts @@ -0,0 +1,24 @@ +import { Args, Query, Resolver, Context } from "@nestjs/graphql"; +import { UseInterceptors } from "@nestjs/common"; +import { GrpcMetadataInterceptor } from "../interceptor/grpc-metadata.interceptor"; +import { NullToZeroInterceptor } from "../interceptor/null-to-zero.interceptor"; +import { OperationTypeInterceptor } from "../interceptor/operation-type.interceptor"; + +import { PaymentService } from "./payment.service"; + +@Resolver() +@UseInterceptors( + GrpcMetadataInterceptor, + NullToZeroInterceptor, + OperationTypeInterceptor +) +export class PaymentResolver { + constructor(private readonly paymentService: PaymentService) {} + + @Query("WechatBankList") + async WechatBankList(@Args("input") input: any, @Context() context: any) { + const result = await this.paymentService.WechatBankList(input, context); + console.log("结果为", result); + return result; + } +} diff --git a/src/pay/payment.service.ts b/src/pay/payment.service.ts new file mode 100644 index 0000000..bb292cf --- /dev/null +++ b/src/pay/payment.service.ts @@ -0,0 +1,24 @@ +import { BaseGrpcService } from "@/common/base.grpc.service"; +import { Injectable, Inject } from "@nestjs/common"; +import { ClientGrpc } from "@nestjs/microservices"; + +@Injectable() +export class PaymentService extends BaseGrpcService { + constructor(@Inject("PAY-CENTER") private readonly client: ClientGrpc) { + super(); + } + + onModuleInit() { + this.payService = this.client.getService<any>("PaymentService"); + } + + async WechatBankList(input: any, context: any) { + const result = await this.callGrpcMethod( + "payService", + "WechatBankList", + input, + context + ); + return result; + } +} -- GitLab From 4c9e2b0866c054fb050fa0e4840be418ca4104fe Mon Sep 17 00:00:00 2001 From: "chuanzhen.zhu" <chuanzhen.zhu@downtown8.com> Date: Wed, 26 Mar 2025 11:04:55 +0800 Subject: [PATCH 2/6] fix: MobileConfigModule --- Proto.lock | 9 + Proto.toml | 15 +- config-templates/config/.env | 3 + config/.env | 3 + src/app.module.ts | 8 +- src/common/base.grpc.service.ts | 2 + src/mobileConfig/mobileConfig.module.ts | 29 ++ .../storeOrder/storeOrderConfig.graphql | 256 ++++++++++++++++++ .../storeOrder/storeOrderConfig.resolver.ts | 24 ++ .../storeOrder/storeOrderConfig.service.ts | 24 ++ 10 files changed, 365 insertions(+), 8 deletions(-) create mode 100644 src/mobileConfig/mobileConfig.module.ts create mode 100644 src/mobileConfig/storeOrder/storeOrderConfig.graphql create mode 100644 src/mobileConfig/storeOrder/storeOrderConfig.resolver.ts create mode 100644 src/mobileConfig/storeOrder/storeOrderConfig.service.ts diff --git a/Proto.lock b/Proto.lock index d0d6861..fd7156f 100644 --- a/Proto.lock +++ b/Proto.lock @@ -18,6 +18,15 @@ version = "0.1.7" dependencies = [] dependants = 1 +[[packages]] +name = "rms-mobile-hera" +digest = "sha256:038c7551d49be8ec141748505e4e5c09bcfdc587b1524a574da9849314b4bb36" +registry = "https://jfrog.downtown8.com/artifactory" +repository = "protobuf" +version = "0.1.3" +dependencies = [] +dependants = 1 + [[packages]] name = "user-center-hera" digest = "sha256:dca5189f791f3d00a7c3e773b1143011c35e13c07f618a91d5fdda4493a321c9" diff --git a/Proto.toml b/Proto.toml index 5fef67d..a80a672 100644 --- a/Proto.toml +++ b/Proto.toml @@ -1,10 +1,5 @@ edition = "0.9" -[dependencies.user-center-hera] -version = "=0.1.28" -repository = "protobuf" -registry = "https://jfrog.downtown8.com/artifactory" - [dependencies.pay-hera] version = "=0.1.7" repository = "protobuf" @@ -14,3 +9,13 @@ registry = "https://jfrog.downtown8.com/artifactory" version = "=0.0.10" repository = "protobuf" registry = "https://jfrog.downtown8.com/artifactory" + +[dependencies.rms-mobile-hera] +version = "=0.1.3" +repository = "protobuf" +registry = "https://jfrog.downtown8.com/artifactory" + +[dependencies.user-center-hera] +version = "=0.1.28" +repository = "protobuf" +registry = "https://jfrog.downtown8.com/artifactory" diff --git a/config-templates/config/.env b/config-templates/config/.env index 0990ba4..759d0fe 100644 --- a/config-templates/config/.env +++ b/config-templates/config/.env @@ -19,5 +19,8 @@ HQ_ORCHESTRATOR_SERVICE_GRPC_PORT=9000 PAY_CENTER_SERVICE=n-pay-center PAY_CENTER_SERVICE_GRPC_PORT=9000 +N_RMS_MOBILE_CENTER_SERVICE=n-rms-mobile-center +N_RMS_MOBILE_CENTER_SERVICE_GRPC_PORT=9000 + QYWX_BOT_KEY={{getv "/configuration/projects/pos-bff-service/QYWX_BOT_KEY"}} \ No newline at end of file diff --git a/config/.env b/config/.env index ece3e6d..0330984 100644 --- a/config/.env +++ b/config/.env @@ -18,5 +18,8 @@ HQ_ORCHESTRATOR_SERVICE_GRPC_PORT=9000 PAY_CENTER_SERVICE=127.0.0.1 PAY_CENTER_SERVICE_GRPC_PORT=9000 +N_RMS_MOBILE_CENTER_SERVICE=127.0.0.1 +N_RMS_MOBILE_CENTER_SERVICE_GRPC_PORT=9000 + RABBIT_VHOST=localv1 QYWX_BOT_KEY="d01614bc-dc2f-4e54-ad79-bedbfd9faeb6" \ No newline at end of file diff --git a/src/app.module.ts b/src/app.module.ts index 90cea89..4d6707f 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -17,8 +17,9 @@ import { UserCenterModule } from "./user/user.module"; import { grpcResolver } from "./common/grpcResolver"; import { GrpcMetadataInterceptor } from "./interceptor/grpc-metadata.interceptor"; import { UserLoginModule } from "./userLogin/userLogin.module"; -import { PublicModule } from './public/public.module'; -import { PayModule } from './pay/pay.module'; +import { PublicModule } from "./public/public.module"; +import { PayModule } from "./pay/pay.module"; +import { MobileConfigModule } from "./mobileConfig/mobileConfig.module"; @Module({ imports: [ GraphQLModule.forRootAsync<ApolloDriverConfig>({ @@ -120,7 +121,8 @@ import { PayModule } from './pay/pay.module'; UserCenterModule, UserLoginModule, PublicModule, - PayModule + PayModule, + MobileConfigModule, ], controllers: [AppController], providers: [ diff --git a/src/common/base.grpc.service.ts b/src/common/base.grpc.service.ts index 4720f83..1c64aaa 100644 --- a/src/common/base.grpc.service.ts +++ b/src/common/base.grpc.service.ts @@ -15,12 +15,14 @@ export class BaseGrpcService { protected userAccessService: any; protected hqPublicOrchestratorService: any; protected payService: any; + protected orderConfigService: any; protected get serviceMap() { return { hqUserPermit: this.userPermitService, hqUserAccess: this.userAccessService, hqPublicOrchestrator: this.hqPublicOrchestratorService, payService: this.payService, + orderConfigService: this.orderConfigService, }; } diff --git a/src/mobileConfig/mobileConfig.module.ts b/src/mobileConfig/mobileConfig.module.ts new file mode 100644 index 0000000..596253b --- /dev/null +++ b/src/mobileConfig/mobileConfig.module.ts @@ -0,0 +1,29 @@ +import { join } from "path"; +import { Module } from "@nestjs/common"; +import { StoreOrderConfigResolver } from "./storeOrder/storeOrderConfig.resolver"; +import { StoreOrderConfigService } from "./storeOrder/storeOrderConfig.service"; + +import { ClientsModule, Transport } from "@nestjs/microservices"; + +@Module({ + imports: [ + ClientsModule.register([ + { + name: "MOBILE-CONFIG", + transport: Transport.GRPC, + options: { + url: `${process.env.N_RMS_MOBILE_CENTER_SERVICE}:${process.env.N_RMS_MOBILE_CENTER_SERVICE_GRPC_PORT}`, + package: ["rmsMobile"], + protoPath: [ + join( + process.cwd(), + "proto/vendor/rms-mobile-hera/storeOrderConfig.proto" + ), + ], + }, + }, + ]), + ], + providers: [StoreOrderConfigResolver, StoreOrderConfigService], +}) +export class MobileConfigModule {} diff --git a/src/mobileConfig/storeOrder/storeOrderConfig.graphql b/src/mobileConfig/storeOrder/storeOrderConfig.graphql new file mode 100644 index 0000000..7eb2126 --- /dev/null +++ b/src/mobileConfig/storeOrder/storeOrderConfig.graphql @@ -0,0 +1,256 @@ +# Code generated by protoc-gen-graphql. DO NOT EDIT. + +type rmsMobile_SuccesResponse { + code: Int + msg: String +} + +input Input_rmsMobile_StoreIdDto { + brandId: Int + storeId: Int +} + +input Input_rmsMobile_TimeHourStartAndEnd { + start: String + end: String +} + +type rmsMobile_TimeHourStartAndEnd { + start: String + end: String +} + +input Input_rmsMobile_StorePlacardData { + brandId: Int + storeId: Int + isStoreInfoShow: Boolean + isCostomShow: Boolean + costomShowValue: String + costomShowMode: String + costomShowTimeType: String + costomShowTimeValue: [Int] + costomShowTimeDateStart: String + costomShowTimeDateEnd: String + costomShowTimeHours: [Input_rmsMobile_TimeHourStartAndEnd] +} + +type rmsMobile_StorePlacardData { + brandId: Int + storeId: Int + isStoreInfoShow: Boolean + isCostomShow: Boolean + costomShowValue: String + costomShowMode: String + costomShowTimeType: String + costomShowTimeValue: [Int] + costomShowTimeDateStart: String + costomShowTimeDateEnd: String + costomShowTimeHours: [rmsMobile_TimeHourStartAndEnd] +} + +type rmsMobile_StorePlacardDataRes { + code: Int + msg: String + data: rmsMobile_StorePlacardData +} + +input Input_rmsMobile_StoreWaitInfoData { + brandId: Int + storeId: Int + isWaitInfoShow: Boolean + waitInfoShowType: String + waitTimeShowMoreThan: Int + waitTimeEveryProduct: Int +} + +type rmsMobile_StoreWaitInfoData { + brandId: Int + storeId: Int + isWaitInfoShow: Boolean + waitInfoShowType: String + waitTimeShowMoreThan: Int + waitTimeEveryProduct: Int +} + +type rmsMobile_StoreWaitInfoDataRes { + code: Int + msg: String + data: rmsMobile_StoreWaitInfoData +} + +type rmsMobile_StoreProductSaleStockData { + brandId: Int + storeId: Int + isSaleShow: Boolean + isStockShow: Boolean + saleShowTimeRange: String + saleShowMoreThan: Int + stockOverShowType: String +} + +input Input_rmsMobile_StoreProductSaleStockData { + brandId: Int + storeId: Int + isSaleShow: Boolean + isStockShow: Boolean + saleShowTimeRange: String + saleShowMoreThan: Int + stockOverShowType: String +} + +type rmsMobile_StoreProductSaleStockDataRes { + code: Int + msg: String + data: rmsMobile_StoreProductSaleStockData +} + +input Input_rmsMobile_StoreProductPushData { + brandId: Int + storeId: Int + isSmartPushShow: Boolean + smartPushShowType: String +} + +type rmsMobile_StoreProductPushData { + brandId: Int + storeId: Int + isSmartPushShow: Boolean + smartPushShowType: String +} + +type rmsMobile_StoreProductPushDataRes { + code: Int + msg: String + data: rmsMobile_StoreProductPushData +} + +input Input_rmsMobile_StoreProductSearchData { + brandId: Int + storeId: Int + isSearchShow: Boolean +} + +type rmsMobile_StoreProductSearchData { + brandId: Int + storeId: Int + isSearchShow: Boolean +} + +type rmsMobile_StoreProductSearchDataRes { + code: Int + msg: String + data: rmsMobile_StoreProductSearchData +} + +input Input_rmsMobile_EatTypeDto { + eatType: String + isOpen: Boolean + name: String +} + +type rmsMobile_EatTypeDto { + eatType: String + isOpen: Boolean + name: String +} + +input Input_rmsMobile_StoreEatTypeData { + brandId: Int + storeId: Int + brandCodeEatTypes: [Input_rmsMobile_EatTypeDto] + tableCodeEatTypes: [Input_rmsMobile_EatTypeDto] +} + +type rmsMobile_StoreEatTypeData { + brandId: Int + storeId: Int + brandCodeEatTypes: [rmsMobile_EatTypeDto] + tableCodeEatTypes: [rmsMobile_EatTypeDto] +} + +type rmsMobile_StoreEatTypeDataRes { + code: Int + msg: String + data: rmsMobile_StoreEatTypeData +} + +input Input_rmsMobile_StoreOrderMustMobileData { + brandId: Int + storeId: Int + isMobileMust: Boolean +} + +type rmsMobile_StoreOrderMustMobileData { + brandId: Int + storeId: Int + isMobileMust: Boolean +} + +type rmsMobile_StoreOrderMustMobileDataRes { + code: Int + msg: String + data: rmsMobile_StoreOrderMustMobileData +} + +input Input_rmsMobile_StoreOrderRemarkData { + brandId: Int + storeId: Int + isRemarkCommit: Boolean + remarkTemplates: [String] +} + +type rmsMobile_StoreOrderRemarkData { + brandId: Int + storeId: Int + isRemarkCommit: Boolean + remarkTemplates: [String] +} + +type rmsMobile_StoreOrderRemarkDataRes { + code: Int + msg: String + data: rmsMobile_StoreOrderRemarkData +} + +input Input_rmsMobile_StoreNoticeData { + brandId: Int + storeId: Int + isPickupNotice: Boolean +} + +type rmsMobile_StoreNoticeData { + brandId: Int + storeId: Int + isPickupNotice: Boolean +} + +type rmsMobile_StoreNoticeDataRes { + code: Int + msg: String + data: rmsMobile_StoreNoticeData +} + +type Query { + StorePlacardGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StorePlacardData! + StoreWaitInfoGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StoreWaitInfoData! + StoreProductSaleStockGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StoreProductSaleStockData! + StoreProductPushGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StoreProductPushData! + StoreProductSearchGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StoreProductSearchData! + StoreEatTypeGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StoreEatTypeData! + StoreOrderMustMobileGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StoreOrderMustMobileData! + StoreOrderRemarkGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StoreOrderRemarkData! + StoreNoticeGet(input: Input_rmsMobile_StoreIdDto!): rmsMobile_StoreNoticeData! +} + +type Mutation { + StorePlacardSet(input: Input_rmsMobile_StorePlacardData!): String! + StoreWaitInfoSet(input: Input_rmsMobile_StoreWaitInfoData!): String! + StoreProductSaleStockSet(input: Input_rmsMobile_StoreProductSaleStockData!): String! + StoreProductPushSet(input: Input_rmsMobile_StoreProductPushData!): String! + StoreProductSearchSet(input: Input_rmsMobile_StoreProductSearchData!): String! + StoreEatTypeSet(input: Input_rmsMobile_StoreEatTypeData!): String! + StoreOrderMustMobileSet(input: Input_rmsMobile_StoreOrderMustMobileData!): String! + StoreOrderRemarkSet(input: Input_rmsMobile_StoreOrderRemarkData!): String! + StoreNoticeSet(input: Input_rmsMobile_StoreNoticeData!): String! +} + diff --git a/src/mobileConfig/storeOrder/storeOrderConfig.resolver.ts b/src/mobileConfig/storeOrder/storeOrderConfig.resolver.ts new file mode 100644 index 0000000..a391318 --- /dev/null +++ b/src/mobileConfig/storeOrder/storeOrderConfig.resolver.ts @@ -0,0 +1,24 @@ +import { Args, Query, Resolver, Context } from "@nestjs/graphql"; +import { UseInterceptors } from "@nestjs/common"; +import { GrpcMetadataInterceptor } from "../../interceptor/grpc-metadata.interceptor"; +import { NullToZeroInterceptor } from "../../interceptor/null-to-zero.interceptor"; +import { OperationTypeInterceptor } from "../../interceptor/operation-type.interceptor"; + +import { StoreOrderConfigService } from "./storeOrderConfig.service"; + +@Resolver() +@UseInterceptors( + GrpcMetadataInterceptor, + NullToZeroInterceptor, + OperationTypeInterceptor +) +export class StoreOrderConfigResolver { + constructor( + private readonly storeOrderConfigService: StoreOrderConfigService + ) {} + + @Query("StorePlacardGet") + async StorePlacardGet(@Args("input") input: any, @Context() context: any) { + return this.storeOrderConfigService.StorePlacardGet(input, context); + } +} diff --git a/src/mobileConfig/storeOrder/storeOrderConfig.service.ts b/src/mobileConfig/storeOrder/storeOrderConfig.service.ts new file mode 100644 index 0000000..55a7758 --- /dev/null +++ b/src/mobileConfig/storeOrder/storeOrderConfig.service.ts @@ -0,0 +1,24 @@ +import { BaseGrpcService } from "@/common/base.grpc.service"; +import { Injectable, Inject } from "@nestjs/common"; +import { ClientGrpc } from "@nestjs/microservices"; + +@Injectable() +export class StoreOrderConfigService extends BaseGrpcService { + constructor(@Inject("MOBILE-CONFIG") private readonly client: ClientGrpc) { + super(); + } + + onModuleInit() { + this.orderConfigService = this.client.getService<any>("OrderConfigService"); + } + + async StorePlacardGet(input: any, context: any) { + const result = await this.callGrpcMethod( + "orderConfigService", + "StorePlacardGet", + input, + context + ); + return result; + } +} -- GitLab From c2c022cdc91250e90df0efaec81e16a713b01c4d Mon Sep 17 00:00:00 2001 From: "chuanzhen.zhu" <chuanzhen.zhu@downtown8.com> Date: Wed, 26 Mar 2025 11:09:34 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=9A=84await?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mobileConfig/storeOrder/storeOrderConfig.service.ts | 3 +-- src/pay/payment.resolver.ts | 4 +--- src/pay/payment.service.ts | 8 +------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/mobileConfig/storeOrder/storeOrderConfig.service.ts b/src/mobileConfig/storeOrder/storeOrderConfig.service.ts index 55a7758..262c3ef 100644 --- a/src/mobileConfig/storeOrder/storeOrderConfig.service.ts +++ b/src/mobileConfig/storeOrder/storeOrderConfig.service.ts @@ -13,12 +13,11 @@ export class StoreOrderConfigService extends BaseGrpcService { } async StorePlacardGet(input: any, context: any) { - const result = await this.callGrpcMethod( + return this.callGrpcMethod( "orderConfigService", "StorePlacardGet", input, context ); - return result; } } diff --git a/src/pay/payment.resolver.ts b/src/pay/payment.resolver.ts index 2b38216..ff5d93b 100644 --- a/src/pay/payment.resolver.ts +++ b/src/pay/payment.resolver.ts @@ -17,8 +17,6 @@ export class PaymentResolver { @Query("WechatBankList") async WechatBankList(@Args("input") input: any, @Context() context: any) { - const result = await this.paymentService.WechatBankList(input, context); - console.log("结果为", result); - return result; + return this.paymentService.WechatBankList(input, context); } } diff --git a/src/pay/payment.service.ts b/src/pay/payment.service.ts index bb292cf..0299956 100644 --- a/src/pay/payment.service.ts +++ b/src/pay/payment.service.ts @@ -13,12 +13,6 @@ export class PaymentService extends BaseGrpcService { } async WechatBankList(input: any, context: any) { - const result = await this.callGrpcMethod( - "payService", - "WechatBankList", - input, - context - ); - return result; + return this.callGrpcMethod("payService", "WechatBankList", input, context); } } -- GitLab From 9b999be5d6bdf4e0e7679609f1804bc25b20c004 Mon Sep 17 00:00:00 2001 From: "chuanzhen.zhu" <chuanzhen.zhu@downtown8.com> Date: Wed, 26 Mar 2025 11:22:34 +0800 Subject: [PATCH 4/6] =?UTF-8?q?style:=20prettierrc=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierrc | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..205163f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 180 +} \ No newline at end of file -- GitLab From 1daa26a29170f265c2fba1f5630cee5774aab1fc Mon Sep 17 00:00:00 2001 From: "chuanzhen.zhu" <chuanzhen.zhu@downtown8.com> Date: Wed, 26 Mar 2025 11:32:11 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=E6=89=8B=E6=9C=BA=E7=82=B9=E5=8D=95?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mobileConfig/mobileConfig.module.ts | 21 ++-- .../storeOrder/storeOrderConfig.resolver.ts | 111 +++++++++++++++--- .../storeOrder/storeOrderConfig.service.ts | 86 ++++++++++++-- 3 files changed, 178 insertions(+), 40 deletions(-) diff --git a/src/mobileConfig/mobileConfig.module.ts b/src/mobileConfig/mobileConfig.module.ts index 596253b..5201110 100644 --- a/src/mobileConfig/mobileConfig.module.ts +++ b/src/mobileConfig/mobileConfig.module.ts @@ -1,25 +1,20 @@ -import { join } from "path"; -import { Module } from "@nestjs/common"; -import { StoreOrderConfigResolver } from "./storeOrder/storeOrderConfig.resolver"; -import { StoreOrderConfigService } from "./storeOrder/storeOrderConfig.service"; +import { join } from 'path'; +import { Module } from '@nestjs/common'; +import { StoreOrderConfigResolver } from './storeOrder/storeOrderConfig.resolver'; +import { StoreOrderConfigService } from './storeOrder/storeOrderConfig.service'; -import { ClientsModule, Transport } from "@nestjs/microservices"; +import { ClientsModule, Transport } from '@nestjs/microservices'; @Module({ imports: [ ClientsModule.register([ { - name: "MOBILE-CONFIG", + name: 'MOBILE-CONFIG', transport: Transport.GRPC, options: { url: `${process.env.N_RMS_MOBILE_CENTER_SERVICE}:${process.env.N_RMS_MOBILE_CENTER_SERVICE_GRPC_PORT}`, - package: ["rmsMobile"], - protoPath: [ - join( - process.cwd(), - "proto/vendor/rms-mobile-hera/storeOrderConfig.proto" - ), - ], + package: ['rmsMobile'], + protoPath: [join(process.cwd(), 'proto/vendor/rms-mobile-hera/storeOrderConfig.proto')], }, }, ]), diff --git a/src/mobileConfig/storeOrder/storeOrderConfig.resolver.ts b/src/mobileConfig/storeOrder/storeOrderConfig.resolver.ts index a391318..4159f88 100644 --- a/src/mobileConfig/storeOrder/storeOrderConfig.resolver.ts +++ b/src/mobileConfig/storeOrder/storeOrderConfig.resolver.ts @@ -1,24 +1,103 @@ -import { Args, Query, Resolver, Context } from "@nestjs/graphql"; -import { UseInterceptors } from "@nestjs/common"; -import { GrpcMetadataInterceptor } from "../../interceptor/grpc-metadata.interceptor"; -import { NullToZeroInterceptor } from "../../interceptor/null-to-zero.interceptor"; -import { OperationTypeInterceptor } from "../../interceptor/operation-type.interceptor"; +import { UseInterceptors } from '@nestjs/common'; +import { Args, Query, Resolver, Context, Mutation } from '@nestjs/graphql'; +import { GrpcMetadataInterceptor } from '../../interceptor/grpc-metadata.interceptor'; +import { NullToZeroInterceptor } from '../../interceptor/null-to-zero.interceptor'; +import { OperationTypeInterceptor } from '../../interceptor/operation-type.interceptor'; -import { StoreOrderConfigService } from "./storeOrderConfig.service"; +import { StoreOrderConfigService } from './storeOrderConfig.service'; @Resolver() -@UseInterceptors( - GrpcMetadataInterceptor, - NullToZeroInterceptor, - OperationTypeInterceptor -) +@UseInterceptors(GrpcMetadataInterceptor, NullToZeroInterceptor, OperationTypeInterceptor) export class StoreOrderConfigResolver { - constructor( - private readonly storeOrderConfigService: StoreOrderConfigService - ) {} + constructor(private readonly storeOrderConfigService: StoreOrderConfigService) {} - @Query("StorePlacardGet") - async StorePlacardGet(@Args("input") input: any, @Context() context: any) { + @Query('StorePlacardGet') + async StorePlacardGet(@Args('input') input: any, @Context() context: any) { return this.storeOrderConfigService.StorePlacardGet(input, context); } + + @Mutation('StorePlacardSet') + async StorePlacardSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StorePlacardSet(input, context); + } + + @Query('StoreWaitInfoGet') + async StoreWaitInfoGet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreWaitInfoGet(input, context); + } + + @Mutation('StoreWaitInfoSet') + async StoreWaitInfoSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreWaitInfoSet(input, context); + } + + @Query('StoreProductSaleStockGet') + async StoreProductSaleStockGet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreProductSaleStockGet(input, context); + } + + @Mutation('StoreProductSaleStockSet') + async StoreProductSaleStockSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreProductSaleStockSet(input, context); + } + + @Query('StoreProductPushGet') + async StoreProductPushGet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreProductPushGet(input, context); + } + + @Mutation('StoreProductPushSet') + async StoreProductPushSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreProductPushSet(input, context); + } + + @Query('StoreProductSearchGet') + async StoreProductSearchGet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreProductSearchGet(input, context); + } + + @Mutation('StoreProductSearchSet') + async StoreProductSearchSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreProductSearchSet(input, context); + } + + @Query('StoreEatTypeGet') + async StoreEatTypeGet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreEatTypeGet(input, context); + } + + @Mutation('StoreEatTypeSet') + async StoreEatTypeSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreEatTypeSet(input, context); + } + + @Query('StoreOrderMustMobileGet') + async StoreOrderMustMobileGet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreOrderMustMobileGet(input, context); + } + + @Mutation('StoreOrderMustMobileSet') + async StoreOrderMustMobileSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreOrderMustMobileSet(input, context); + } + + @Query('StoreOrderRemarkGet') + async StoreOrderRemarkGet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreOrderRemarkGet(input, context); + } + + @Mutation('StoreOrderRemarkSet') + async StoreOrderRemarkSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreOrderRemarkSet(input, context); + } + + @Query('StoreNoticeGet') + async StoreNoticeGet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreNoticeGet(input, context); + } + + @Mutation('StoreNoticeSet') + async StoreNoticeSet(@Args('input') input: any, @Context() context: any) { + return this.storeOrderConfigService.StoreNoticeSet(input, context); + } } diff --git a/src/mobileConfig/storeOrder/storeOrderConfig.service.ts b/src/mobileConfig/storeOrder/storeOrderConfig.service.ts index 262c3ef..b04783b 100644 --- a/src/mobileConfig/storeOrder/storeOrderConfig.service.ts +++ b/src/mobileConfig/storeOrder/storeOrderConfig.service.ts @@ -1,23 +1,87 @@ -import { BaseGrpcService } from "@/common/base.grpc.service"; -import { Injectable, Inject } from "@nestjs/common"; -import { ClientGrpc } from "@nestjs/microservices"; +import { BaseGrpcService } from '@/common/base.grpc.service'; +import { Injectable, Inject } from '@nestjs/common'; +import { ClientGrpc } from '@nestjs/microservices'; @Injectable() export class StoreOrderConfigService extends BaseGrpcService { - constructor(@Inject("MOBILE-CONFIG") private readonly client: ClientGrpc) { + constructor(@Inject('MOBILE-CONFIG') private readonly client: ClientGrpc) { super(); } onModuleInit() { - this.orderConfigService = this.client.getService<any>("OrderConfigService"); + this.orderConfigService = this.client.getService<any>('OrderConfigService'); } async StorePlacardGet(input: any, context: any) { - return this.callGrpcMethod( - "orderConfigService", - "StorePlacardGet", - input, - context - ); + return this.callGrpcMethod('orderConfigService', 'StorePlacardGet', input, context); + } + + async StorePlacardSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StorePlacardSet', input, context); + } + // + + async StoreWaitInfoGet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreWaitInfoGet', input, context); + } + + async StoreWaitInfoSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreWaitInfoSet', input, context); + } + + async StoreProductSaleStockGet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreProductSaleStockGet', input, context); + } + + async StoreProductSaleStockSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreProductSaleStockSet', input, context); + } + + async StoreProductPushGet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreProductPushGet', input, context); + } + + async StoreProductPushSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreProductPushSet', input, context); + } + + async StoreProductSearchGet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreProductSearchGet', input, context); + } + + async StoreProductSearchSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreProductSearchSet', input, context); + } + + async StoreEatTypeGet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreEatTypeGet', input, context); + } + + async StoreEatTypeSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreEatTypeSet', input, context); + } + + async StoreOrderMustMobileGet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreOrderMustMobileGet', input, context); + } + + async StoreOrderMustMobileSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreOrderMustMobileSet', input, context); + } + + async StoreOrderRemarkGet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreOrderRemarkGet', input, context); + } + + async StoreOrderRemarkSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreOrderRemarkSet', input, context); + } + + async StoreNoticeGet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreNoticeGet', input, context); + } + + async StoreNoticeSet(input: any, context: any) { + return this.callGrpcMethod('orderConfigService', 'StoreNoticeSet', input, context); } } -- GitLab From 7f955bbdd4cca3c226ddf6b0877d46dabab9a640 Mon Sep 17 00:00:00 2001 From: "chuanzhen.zhu" <chuanzhen.zhu@downtown8.com> Date: Wed, 26 Mar 2025 11:33:52 +0800 Subject: [PATCH 6/6] =?UTF-8?q?style:=20=E8=B0=83=E6=95=B4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pay/pay.module.ts | 18 ++++++++---------- src/pay/payment.resolver.ts | 23 ++++++++++------------- src/pay/payment.service.ts | 13 +++++++------ 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/pay/pay.module.ts b/src/pay/pay.module.ts index f4bf70d..ee77991 100644 --- a/src/pay/pay.module.ts +++ b/src/pay/pay.module.ts @@ -1,22 +1,20 @@ -import { join } from "path"; -import { Module } from "@nestjs/common"; -import { PaymentResolver } from "./payment.resolver"; -import { PaymentService } from "./payment.service"; +import { join } from 'path'; +import { Module } from '@nestjs/common'; +import { PaymentResolver } from './payment.resolver'; +import { PaymentService } from './payment.service'; -import { ClientsModule, Transport } from "@nestjs/microservices"; +import { ClientsModule, Transport } from '@nestjs/microservices'; @Module({ imports: [ ClientsModule.register([ { - name: "PAY-CENTER", + name: 'PAY-CENTER', transport: Transport.GRPC, options: { url: `${process.env.PAY_CENTER_SERVICE}:${process.env.PAY_CENTER_SERVICE_GRPC_PORT}`, - package: ["pay"], - protoPath: [ - join(process.cwd(), "proto/vendor/pay-hera/payment.proto"), - ], + package: ['pay'], + protoPath: [join(process.cwd(), 'proto/vendor/pay-hera/payment.proto')], }, }, ]), diff --git a/src/pay/payment.resolver.ts b/src/pay/payment.resolver.ts index ff5d93b..c8ab1de 100644 --- a/src/pay/payment.resolver.ts +++ b/src/pay/payment.resolver.ts @@ -1,22 +1,19 @@ -import { Args, Query, Resolver, Context } from "@nestjs/graphql"; -import { UseInterceptors } from "@nestjs/common"; -import { GrpcMetadataInterceptor } from "../interceptor/grpc-metadata.interceptor"; -import { NullToZeroInterceptor } from "../interceptor/null-to-zero.interceptor"; -import { OperationTypeInterceptor } from "../interceptor/operation-type.interceptor"; +import { UseInterceptors } from '@nestjs/common'; +import { Args, Query, Resolver, Context } from '@nestjs/graphql'; -import { PaymentService } from "./payment.service"; +import { NullToZeroInterceptor } from '../interceptor/null-to-zero.interceptor'; +import { GrpcMetadataInterceptor } from '../interceptor/grpc-metadata.interceptor'; +import { OperationTypeInterceptor } from '../interceptor/operation-type.interceptor'; + +import { PaymentService } from './payment.service'; @Resolver() -@UseInterceptors( - GrpcMetadataInterceptor, - NullToZeroInterceptor, - OperationTypeInterceptor -) +@UseInterceptors(GrpcMetadataInterceptor, NullToZeroInterceptor, OperationTypeInterceptor) export class PaymentResolver { constructor(private readonly paymentService: PaymentService) {} - @Query("WechatBankList") - async WechatBankList(@Args("input") input: any, @Context() context: any) { + @Query('WechatBankList') + async WechatBankList(@Args('input') input: any, @Context() context: any) { return this.paymentService.WechatBankList(input, context); } } diff --git a/src/pay/payment.service.ts b/src/pay/payment.service.ts index 0299956..a05b8b5 100644 --- a/src/pay/payment.service.ts +++ b/src/pay/payment.service.ts @@ -1,18 +1,19 @@ -import { BaseGrpcService } from "@/common/base.grpc.service"; -import { Injectable, Inject } from "@nestjs/common"; -import { ClientGrpc } from "@nestjs/microservices"; +import { Injectable, Inject } from '@nestjs/common'; +import { ClientGrpc } from '@nestjs/microservices'; + +import { BaseGrpcService } from '@/common/base.grpc.service'; @Injectable() export class PaymentService extends BaseGrpcService { - constructor(@Inject("PAY-CENTER") private readonly client: ClientGrpc) { + constructor(@Inject('PAY-CENTER') private readonly client: ClientGrpc) { super(); } onModuleInit() { - this.payService = this.client.getService<any>("PaymentService"); + this.payService = this.client.getService<any>('PaymentService'); } async WechatBankList(input: any, context: any) { - return this.callGrpcMethod("payService", "WechatBankList", input, context); + return this.callGrpcMethod('payService', 'WechatBankList', input, context); } } -- GitLab