From 4f6c5c8bf85a970fbf48e5b3bef4cf5026ffe350 Mon Sep 17 00:00:00 2001 From: tone <3341154833@qq.com> Date: Wed, 7 May 2025 17:21:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BE=E5=BC=83=E7=9F=AD=E4=BF=A1=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tone-page-server/package.json | 2 + tone-page-server/pnpm-lock.yaml | 297 ++++++++++++++++++ .../src/notification/notification.module.ts | 6 +- .../notification/notification.service.spec.ts | 18 ++ .../src/notification/notification.service.ts | 38 +++ .../src/verification/verification.module.ts | 4 +- .../src/verification/verification.service.ts | 8 +- 7 files changed, 369 insertions(+), 4 deletions(-) create mode 100644 tone-page-server/src/notification/notification.service.spec.ts create mode 100644 tone-page-server/src/notification/notification.service.ts diff --git a/tone-page-server/package.json b/tone-page-server/package.json index bb8e001..5224c75 100644 --- a/tone-page-server/package.json +++ b/tone-page-server/package.json @@ -20,6 +20,8 @@ "test:e2e": "jest --config ./test/jest-e2e.json" }, "dependencies": { + "@alicloud/dysmsapi20170525": "4.1.0", + "@alicloud/openapi-client": "^0.4.14", "@nestjs/common": "^10.0.0", "@nestjs/config": "^4.0.2", "@nestjs/core": "^10.0.0", diff --git a/tone-page-server/pnpm-lock.yaml b/tone-page-server/pnpm-lock.yaml index 11fe871..fe53ee3 100644 --- a/tone-page-server/pnpm-lock.yaml +++ b/tone-page-server/pnpm-lock.yaml @@ -8,6 +8,12 @@ importers: .: dependencies: + '@alicloud/dysmsapi20170525': + specifier: 4.1.0 + version: 4.1.0 + '@alicloud/openapi-client': + specifier: ^0.4.14 + version: 0.4.14 '@nestjs/common': specifier: ^10.0.0 version: 10.4.17(class-transformer@0.5.1)(class-validator@0.14.2)(reflect-metadata@0.2.2)(rxjs@7.8.2) @@ -132,6 +138,60 @@ importers: packages: + '@alicloud/credentials@2.4.3': + resolution: {integrity: sha512-r2thNtthchTz/c8/HryGSey1vY0UZx2FkAvb+vd+j7xhD/v/KUwnp8RJNQKNG3E4kfs4wSx2bgDSkcPAiXHQLQ==} + + '@alicloud/darabonba-array@0.1.0': + resolution: {integrity: sha512-y4oM4O2uXiroUjfWBLEXRHMm1279rWpkWWNalF7DFQyO5awJ/e0d631prU4i10ytKzo8XJd12eCHmm3IOW85+g==} + + '@alicloud/darabonba-encode-util@0.0.1': + resolution: {integrity: sha512-Sl5vCRVAYMqwmvXpJLM9hYoCHOMsQlGxaWSGhGWulpKk/NaUBArtoO1B0yHruJf1C5uHhEJIaylYcM48icFHgw==} + + '@alicloud/darabonba-encode-util@0.0.2': + resolution: {integrity: sha512-mlsNctkeqmR0RtgE1Rngyeadi5snLOAHBCWEtYf68d7tyKskosXDTNeZ6VCD/UfrUu4N51ItO8zlpfXiOgeg3A==} + + '@alicloud/darabonba-map@0.0.1': + resolution: {integrity: sha512-2ep+G3YDvuI+dRYVlmER1LVUQDhf9kEItmVB/bbEu1pgKzelcocCwAc79XZQjTcQGFgjDycf3vH87WLDGLFMlw==} + + '@alicloud/darabonba-signature-util@0.0.4': + resolution: {integrity: sha512-I1TtwtAnzLamgqnAaOkN0IGjwkiti//0a7/auyVThdqiC/3kyafSAn6znysWOmzub4mrzac2WiqblZKFcN5NWg==} + + '@alicloud/darabonba-string@1.0.3': + resolution: {integrity: sha512-NyWwrU8cAIesWk3uHL1Q7pTDTqLkCI/0PmJXC4/4A0MFNAZ9Ouq0iFBsRqvfyUujSSM+WhYLuTfakQXiVLkTMA==} + + '@alicloud/dysmsapi20170525@4.1.0': + resolution: {integrity: sha512-oUmRp6DTI6gGNbrSQK4lW7EouHIB4C0DCbSEA121NvxHC9XKe4cqiPP2VDqgDQiIK43oiFaHKY3rj+IteOWekA==} + + '@alicloud/endpoint-util@0.0.1': + resolution: {integrity: sha512-+pH7/KEXup84cHzIL6UJAaPqETvln4yXlD9JzlrqioyCSaWxbug5FUobsiI6fuUOpw5WwoB3fWAtGbFnJ1K3Yg==} + + '@alicloud/gateway-pop@0.0.6': + resolution: {integrity: sha512-KF4I+JvfYuLKc3fWeWYIZ7lOVJ9jRW0sQXdXidZn1DKZ978ncfGf7i0LBfONGk4OxvNb/HD3/0yYhkgZgPbKtA==} + + '@alicloud/gateway-spi@0.0.8': + resolution: {integrity: sha512-KM7fu5asjxZPmrz9sJGHJeSU+cNQNOxW+SFmgmAIrITui5hXL2LB+KNRuzWmlwPjnuA2X3/keq9h6++S9jcV5g==} + + '@alicloud/openapi-client@0.4.14': + resolution: {integrity: sha512-NiMDBszCyiH5HI9vHbkDhhDbFF3gMEJDHuPc2cAP0queLtrjPfU+d6/uhGVt44B9oC0q6f6vaJgptQ99fxxfnQ==} + + '@alicloud/openapi-core@1.0.4': + resolution: {integrity: sha512-e9WK1lKiMOOziuLgNaYWv7FL50FyrcpO+idoLhNmFR7k0Fax4lPht5suBpTBr1PSINg5R1W3eOCm5vaUTrY4lg==} + + '@alicloud/openapi-util@0.3.2': + resolution: {integrity: sha512-EC2JvxdcOgMlBAEG0+joOh2IB1um8CPz9EdYuRfTfd1uP8Yc9D8QRUWVGjP6scnj6fWSOaHFlit9H6PrJSyFow==} + + '@alicloud/tea-typescript@1.8.0': + resolution: {integrity: sha512-CWXWaquauJf0sW30mgJRVu9aaXyBth5uMBCUc+5vKTK1zlgf3hIqRUjJZbjlwHwQ5y9anwcu18r48nOZb7l2QQ==} + + '@alicloud/tea-util@1.4.10': + resolution: {integrity: sha512-VEsXWP2dlJLvsY2THj+sH++zwxQRz3Y5BQ8EkfnFems36RkngQKYOLsoto5nR6ej1Gf6I+0IOgBXrkRdpNCQ1g==} + + '@alicloud/tea-util@1.4.9': + resolution: {integrity: sha512-S0wz76rGtoPKskQtRTGqeuqBHFj8BqUn0Vh+glXKun2/9UpaaaWmuJwcmtImk6bJZfLYEShDF/kxDmDJoNYiTw==} + + '@alicloud/tea-xml@0.0.3': + resolution: {integrity: sha512-+/9GliugjrLglsXVrd1D80EqqKgGpyA0eQ6+1ZdUOYCaRguaSwz44trX3PaxPu/HhIPJg9PsGQQ3cSLXWZjbAA==} + '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} @@ -323,6 +383,9 @@ packages: resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} + '@darabonba/typescript@1.0.3': + resolution: {integrity: sha512-/y2y6wf5TsxD7pCPIm0OvTC+5qV0Tk7HQYxwpIuWRLXQLB0CRDvr6qk4bR6rTLO/JglJa8z2uCGZsaLYpQNqFQ==} + '@eslint-community/eslint-utils@4.6.1': resolution: {integrity: sha512-KTsJMmobmbrFLe3LDh0PC2FXpcSYJt/MLjlkh/9LEnmKYLSYmT/0EW9JWANjeoemiuZrmogti0tW5Ch+qNUYDw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -699,9 +762,15 @@ packages: '@types/mime@1.3.5': resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==} + '@types/node@12.20.55': + resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + '@types/node@20.17.31': resolution: {integrity: sha512-quODOCNXQAbNf1Q7V+fI8WyErOCh0D5Yd31vHnKu4GkSztGQ7rlltAaqXhHhLl33tlVyUXs2386MkANSwgDn6A==} + '@types/node@22.15.14': + resolution: {integrity: sha512-BL1eyu/XWsFGTtDWOYULQEs4KR0qdtYfCxYAUYRoB7JP7h9ETYLgQTww6kH8Sj2C0pFGgrpM0XKv6/kbIzYJ1g==} + '@types/passport-jwt@4.0.1': resolution: {integrity: sha512-Y0Ykz6nWP4jpxgEUYq8NoVZeCQPo1ZndJLfapI249g1jHChvRfZRO/LS3tqu26YgAS/laI1qx98sYGz0IalRXQ==} @@ -735,6 +804,9 @@ packages: '@types/validator@13.15.0': resolution: {integrity: sha512-nh7nrWhLr6CBq9ldtw0wx+z9wKnnv/uTVLA9g/3/TcOYxbpOSZE+MhKPmWqU+K0NvThjhv12uD8MuqijB0WzEA==} + '@types/xml2js@0.4.14': + resolution: {integrity: sha512-4YnrRemBShWRO2QjvUin8ESA41rH+9nQGLUGZV/1IDhi3SL9OhdpNC/MrulTWuptXKwhx/aDxE7toV0f/ypIXQ==} + '@types/yargs-parser@21.0.3': resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} @@ -1689,6 +1761,9 @@ packages: resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} engines: {node: '>= 0.8'} + httpx@2.3.3: + resolution: {integrity: sha512-k1qv94u1b6e+XKCxVbLgYlOypVP9MPGpnN5G/vxFf6tDO4V3xpz3d6FUOY/s8NtPgaq5RBVVgSB+7IHpVxMYzw==} + human-signals@2.1.0: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} engines: {node: '>=10.17.0'} @@ -1724,6 +1799,9 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + ini@1.3.8: + resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + inquirer@8.2.6: resolution: {integrity: sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==} engines: {node: '>=12.0.0'} @@ -2016,6 +2094,9 @@ packages: keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + kitx@2.2.0: + resolution: {integrity: sha512-tBMwe6AALTBQJb0woQDD40734NKzb0Kzi3k7wQj9ar3AbP9oqhoVrdXPh7rk2r00/glIgd0YbToIUJsnxWMiIg==} + kleur@3.0.3: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} @@ -2174,6 +2255,12 @@ packages: resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} hasBin: true + moment-timezone@0.5.48: + resolution: {integrity: sha512-f22b8LV1gbTO2ms2j2z13MuPogNoh5UzxL3nzNAYKGraILnbGc9NEE6dyiiiLv46DGRb8A4kg8UKWLjPthxBHw==} + + moment@2.30.1: + resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} + ms@2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} @@ -2562,6 +2649,9 @@ packages: safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + sax@1.4.1: + resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==} + schema-utils@3.3.0: resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} engines: {node: '>= 10.13.0'} @@ -2639,6 +2729,9 @@ packages: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} + sm3@1.0.3: + resolution: {integrity: sha512-KyFkIfr8QBlFG3uc3NaljaXdYcsbRy1KrSfc4tsQV8jW68jAktGeOcifu530Vx/5LC+PULHT0Rv8LiI8Gw+c1g==} + source-map-support@0.5.13: resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} @@ -2980,6 +3073,9 @@ packages: undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} @@ -3085,6 +3181,14 @@ packages: resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + xml2js@0.6.2: + resolution: {integrity: sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==} + engines: {node: '>=4.0.0'} + + xmlbuilder@11.0.1: + resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==} + engines: {node: '>=4.0'} + xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} @@ -3114,6 +3218,146 @@ packages: snapshots: + '@alicloud/credentials@2.4.3': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + httpx: 2.3.3 + ini: 1.3.8 + kitx: 2.2.0 + transitivePeerDependencies: + - supports-color + + '@alicloud/darabonba-array@0.1.0': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + transitivePeerDependencies: + - supports-color + + '@alicloud/darabonba-encode-util@0.0.1': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + moment: 2.30.1 + transitivePeerDependencies: + - supports-color + + '@alicloud/darabonba-encode-util@0.0.2': + dependencies: + moment: 2.30.1 + + '@alicloud/darabonba-map@0.0.1': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + transitivePeerDependencies: + - supports-color + + '@alicloud/darabonba-signature-util@0.0.4': + dependencies: + '@alicloud/darabonba-encode-util': 0.0.1 + transitivePeerDependencies: + - supports-color + + '@alicloud/darabonba-string@1.0.3': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + transitivePeerDependencies: + - supports-color + + '@alicloud/dysmsapi20170525@4.1.0': + dependencies: + '@alicloud/openapi-core': 1.0.4 + '@darabonba/typescript': 1.0.3 + transitivePeerDependencies: + - supports-color + + '@alicloud/endpoint-util@0.0.1': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + kitx: 2.2.0 + transitivePeerDependencies: + - supports-color + + '@alicloud/gateway-pop@0.0.6': + dependencies: + '@alicloud/credentials': 2.4.3 + '@alicloud/darabonba-array': 0.1.0 + '@alicloud/darabonba-encode-util': 0.0.2 + '@alicloud/darabonba-map': 0.0.1 + '@alicloud/darabonba-signature-util': 0.0.4 + '@alicloud/darabonba-string': 1.0.3 + '@alicloud/endpoint-util': 0.0.1 + '@alicloud/gateway-spi': 0.0.8 + '@alicloud/openapi-util': 0.3.2 + '@alicloud/tea-typescript': 1.8.0 + '@alicloud/tea-util': 1.4.10 + transitivePeerDependencies: + - supports-color + + '@alicloud/gateway-spi@0.0.8': + dependencies: + '@alicloud/credentials': 2.4.3 + '@alicloud/tea-typescript': 1.8.0 + transitivePeerDependencies: + - supports-color + + '@alicloud/openapi-client@0.4.14': + dependencies: + '@alicloud/credentials': 2.4.3 + '@alicloud/gateway-spi': 0.0.8 + '@alicloud/openapi-util': 0.3.2 + '@alicloud/tea-typescript': 1.8.0 + '@alicloud/tea-util': 1.4.9 + '@alicloud/tea-xml': 0.0.3 + transitivePeerDependencies: + - supports-color + + '@alicloud/openapi-core@1.0.4': + dependencies: + '@alicloud/credentials': 2.4.3 + '@alicloud/gateway-pop': 0.0.6 + '@alicloud/gateway-spi': 0.0.8 + '@darabonba/typescript': 1.0.3 + transitivePeerDependencies: + - supports-color + + '@alicloud/openapi-util@0.3.2': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + '@alicloud/tea-util': 1.4.10 + kitx: 2.2.0 + sm3: 1.0.3 + transitivePeerDependencies: + - supports-color + + '@alicloud/tea-typescript@1.8.0': + dependencies: + '@types/node': 12.20.55 + httpx: 2.3.3 + transitivePeerDependencies: + - supports-color + + '@alicloud/tea-util@1.4.10': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + '@darabonba/typescript': 1.0.3 + kitx: 2.2.0 + transitivePeerDependencies: + - supports-color + + '@alicloud/tea-util@1.4.9': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + kitx: 2.2.0 + transitivePeerDependencies: + - supports-color + + '@alicloud/tea-xml@0.0.3': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + '@types/xml2js': 0.4.14 + xml2js: 0.6.2 + transitivePeerDependencies: + - supports-color + '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.8 @@ -3345,6 +3589,17 @@ snapshots: dependencies: '@jridgewell/trace-mapping': 0.3.9 + '@darabonba/typescript@1.0.3': + dependencies: + '@alicloud/tea-typescript': 1.8.0 + httpx: 2.3.3 + lodash: 4.17.21 + moment: 2.30.1 + moment-timezone: 0.5.48 + xml2js: 0.6.2 + transitivePeerDependencies: + - supports-color + '@eslint-community/eslint-utils@4.6.1(eslint@8.57.1)': dependencies: eslint: 8.57.1 @@ -3876,10 +4131,16 @@ snapshots: '@types/mime@1.3.5': {} + '@types/node@12.20.55': {} + '@types/node@20.17.31': dependencies: undici-types: 6.19.8 + '@types/node@22.15.14': + dependencies: + undici-types: 6.21.0 + '@types/passport-jwt@4.0.1': dependencies: '@types/jsonwebtoken': 9.0.7 @@ -3925,6 +4186,10 @@ snapshots: '@types/validator@13.15.0': {} + '@types/xml2js@0.4.14': + dependencies: + '@types/node': 20.17.31 + '@types/yargs-parser@21.0.3': {} '@types/yargs@17.0.33': @@ -5013,6 +5278,13 @@ snapshots: statuses: 2.0.1 toidentifier: 1.0.1 + httpx@2.3.3: + dependencies: + '@types/node': 20.17.31 + debug: 4.4.0 + transitivePeerDependencies: + - supports-color + human-signals@2.1.0: {} iconv-lite@0.4.24: @@ -5042,6 +5314,8 @@ snapshots: inherits@2.0.4: {} + ini@1.3.8: {} + inquirer@8.2.6: dependencies: ansi-escapes: 4.3.2 @@ -5548,6 +5822,10 @@ snapshots: dependencies: json-buffer: 3.0.1 + kitx@2.2.0: + dependencies: + '@types/node': 22.15.14 + kleur@3.0.3: {} leven@3.1.0: {} @@ -5669,6 +5947,12 @@ snapshots: dependencies: minimist: 1.2.8 + moment-timezone@0.5.48: + dependencies: + moment: 2.30.1 + + moment@2.30.1: {} + ms@2.0.0: {} ms@2.1.3: {} @@ -6012,6 +6296,8 @@ snapshots: safer-buffer@2.1.2: {} + sax@1.4.1: {} + schema-utils@3.3.0: dependencies: '@types/json-schema': 7.0.15 @@ -6118,6 +6404,8 @@ snapshots: slash@3.0.0: {} + sm3@1.0.3: {} + source-map-support@0.5.13: dependencies: buffer-from: 1.1.2 @@ -6399,6 +6687,8 @@ snapshots: undici-types@6.19.8: {} + undici-types@6.21.0: {} + universalify@2.0.1: {} unpipe@1.0.0: {} @@ -6516,6 +6806,13 @@ snapshots: imurmurhash: 0.1.4 signal-exit: 3.0.7 + xml2js@0.6.2: + dependencies: + sax: 1.4.1 + xmlbuilder: 11.0.1 + + xmlbuilder@11.0.1: {} + xtend@4.0.2: {} y18n@5.0.8: {} diff --git a/tone-page-server/src/notification/notification.module.ts b/tone-page-server/src/notification/notification.module.ts index 3b25acc..63624ca 100644 --- a/tone-page-server/src/notification/notification.module.ts +++ b/tone-page-server/src/notification/notification.module.ts @@ -1,4 +1,8 @@ import { Module } from '@nestjs/common'; +import { NotificationService } from './notification.service'; -@Module({}) +@Module({ + providers: [NotificationService], + exports: [NotificationService], +}) export class NotificationModule {} diff --git a/tone-page-server/src/notification/notification.service.spec.ts b/tone-page-server/src/notification/notification.service.spec.ts new file mode 100644 index 0000000..65bd59d --- /dev/null +++ b/tone-page-server/src/notification/notification.service.spec.ts @@ -0,0 +1,18 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { NotificationService } from './notification.service'; + +describe('NotificationService', () => { + let service: NotificationService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [NotificationService], + }).compile(); + + service = module.get(NotificationService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/tone-page-server/src/notification/notification.service.ts b/tone-page-server/src/notification/notification.service.ts new file mode 100644 index 0000000..cdcffeb --- /dev/null +++ b/tone-page-server/src/notification/notification.service.ts @@ -0,0 +1,38 @@ +import { Injectable } from '@nestjs/common'; + +@Injectable() +export class NotificationService { + + sendEmail(email: string, subject: string, content: string) { + + } + + /** + * @deprecated 短信签名暂未通过 + */ + async sendSMS(phone: string, type: 'login', code: string) { + // const config = new $OpenApi.Config({ + // accessKeyId: process.env.ALIYUN_ACCESS_KEY_ID, + // accessKeySecret: process.env.ALIYUN_ACCESS_KEY_SECRET, + // }) + // config.endpoint = 'dysmsapi.aliyuncs.com'; + // const client = new Client(config); + // const request = new $dysmsapi.SendSmsRequest({}); + // request.phoneNumbers = phone; + // request.signName = (() => { + // switch (type) { + // case 'login': + // return process.env.ALIYUN_SMS_LOGIN_SIGN_NAME; + // default: + // throw new Error('Unknown SMS type'); + // } + // })(); + // request.templateCode = code; + + // await client.sendSms(request).then(a => { + // console.log(a) + // }).catch(err => { + // console.error(err); + // }) + } +} diff --git a/tone-page-server/src/verification/verification.module.ts b/tone-page-server/src/verification/verification.module.ts index 54738ca..5fdd0d2 100644 --- a/tone-page-server/src/verification/verification.module.ts +++ b/tone-page-server/src/verification/verification.module.ts @@ -1,10 +1,12 @@ import { Module } from '@nestjs/common'; import { VerificationController } from './verification.controller'; import { VerificationService } from './verification.service'; +import { NotificationModule } from 'src/notification/notification.module'; @Module({ controllers: [VerificationController], providers: [VerificationService], exports: [VerificationService], + imports: [NotificationModule], }) -export class VerificationModule {} +export class VerificationModule { } diff --git a/tone-page-server/src/verification/verification.service.ts b/tone-page-server/src/verification/verification.service.ts index 7556c20..fdc5a24 100644 --- a/tone-page-server/src/verification/verification.service.ts +++ b/tone-page-server/src/verification/verification.service.ts @@ -1,8 +1,13 @@ import { Injectable } from '@nestjs/common'; +import { NotificationService } from 'src/notification/notification.service'; @Injectable() export class VerificationService { + constructor( + private readonly notificationService: NotificationService, + ) { } + private pool: Map