Sfoglia il codice sorgente

Update RcsNumberService to save and update RcsNumber entity

- Modify the RcsNumberService to save and update the RcsNumber entity with the provided message and status.
- Add a new column "stockFlag" to the RcsNumber entity.
- Implement the "updateStockFlag" method in the RcsNumberService.

Refactor USACodeApiService to comment out WebSocket connection

- Comment out the WebSocket connection in the onModuleInit method of the USACodeApiService.

Add recharge_ratio sys-config

- Add a new sys-config entry named "recharge_ratio" with the value of 7.05.

Update TaskService to set default e2ee value

- Update the TaskService to set the default value of e2ee to 1 if it is not found in the operator config.

Update yarn.lock file

- Update the yarn.lock file with the latest dependencies.
xiongzhu 1 anno fa
parent
commit
eaf9f34cb7

+ 7 - 3
src/rcs-number/rcs-number.service.ts

@@ -294,14 +294,18 @@ export class RcsNumberService {
                 if (msg) {
                     number.status = RcsNumberStatus.SUCCESS
                     number.message = msg
+                    const update: Partial<RcsNumber> = {
+                        status: RcsNumberStatus.SUCCESS,
+                        message: msg
+                    }
                     if (number.from.includes('cloud')) {
                         if (number.orderId.slice(-4) === '0033') {
-                            number.from = RcsNumberSource.cloud033
+                            update.from = RcsNumberSource.cloud033
                         } else if (number.orderId.slice(-4) === '0034') {
-                            number.from = RcsNumberSource.cloud034
+                            update.from = RcsNumberSource.cloud034
                         }
                     }
-                    await this.rcsNumberRepository.save(number)
+                    await this.rcsNumberRepository.update(number.id, update)
                 }
             } catch (e) {}
         })

+ 31 - 31
src/rcs-number/usacode-api-service.ts

@@ -19,39 +19,39 @@ export class USACodeApiService implements OnModuleInit {
     ) {}
 
     onModuleInit() {
-        const ws = new WebSocket('wss://panel.hellomeetyou.com/api/ws')
+        // const ws = new WebSocket('wss://panel.hellomeetyou.com/api/ws')
 
-        ws.on('open', () => {
-            Logger.log('Connected WS Server', 'USACodeApiService')
-            ws.send(
-                JSON.stringify([
-                    {
-                        jsonrpc: '2.0',
-                        method: 'subscribe',
-                        params: {
-                            apiKey: 'Z0ik3OMblJznryPSWTCOmSOm'
-                        }
-                    },
-                    {
-                        jsonrpc: '2.0',
-                        method: 'getSubscribedUserIds',
-                        id: randomUUID()
-                    }
-                ])
-            )
-        })
+        // ws.on('open', () => {
+        //     Logger.log('Connected WS Server', 'USACodeApiService')
+        //     ws.send(
+        //         JSON.stringify([
+        //             {
+        //                 jsonrpc: '2.0',
+        //                 method: 'subscribe',
+        //                 params: {
+        //                     apiKey: 'Z0ik3OMblJznryPSWTCOmSOm'
+        //                 }
+        //             },
+        //             {
+        //                 jsonrpc: '2.0',
+        //                 method: 'getSubscribedUserIds',
+        //                 id: randomUUID()
+        //             }
+        //         ])
+        //     )
+        // })
 
-        ws.on('message', (data) => {
-            Logger.log('Received message ' + data, 'USACodeApiService')
-            const message = JSON.parse(data.toString())
-            if (message instanceof Array) {
-                message.forEach((msg) => {
-                    this.messageSubject.next(msg)
-                })
-            } else {
-                this.messageSubject.next(message)
-            }
-        })
+        // ws.on('message', (data) => {
+        //     Logger.log('Received message ' + data, 'USACodeApiService')
+        //     const message = JSON.parse(data.toString())
+        //     if (message instanceof Array) {
+        //         message.forEach((msg) => {
+        //             this.messageSubject.next(msg)
+        //         })
+        //     } else {
+        //         this.messageSubject.next(message)
+        //     }
+        // })
 
         // setInterval(() => {
         //     ws.send(

+ 8 - 0
src/sys-config/sys-config.service.ts

@@ -95,6 +95,14 @@ export class SysConfigService implements OnModuleInit {
                 remark: 'E2EE超时时间'
             })
         }
+        if (!(await this.sysConfigRepository.findOneBy({ name: 'recharge_ratio' }))) {
+            await this.sysConfigRepository.save({
+                name: 'recharge_ratio',
+                value: '7.05',
+                type: SysConfigType.Number,
+                remark: '充值比'
+            })
+        }
     }
 
     async findAll(req: PageRequest<SysConfig>) {

+ 1 - 1
src/task/task.service.ts

@@ -131,7 +131,7 @@ export class TaskService implements OnModuleInit {
         task.total = phones.length
         task.country = phoneList.country
         if (task.country) {
-            task.e2ee = (await this.operatorConfigService.findByCountry(task.country))?.e2ee || 0
+            task.e2ee = (await this.operatorConfigService.findByCountry(task.country))?.e2ee || 1
         }
         // 任务混淆
         if (task.confusion && task.confusion.includes('head') && task.confusion.includes('end')) {

+ 40 - 4
yarn.lock

@@ -2,6 +2,13 @@
 # yarn lockfile v1
 
 
+"@4a/cid@^0.1.0":
+  version "0.1.0"
+  resolved "https://registry.npmmirror.com/@4a/cid/-/cid-0.1.0.tgz#d90e32533ab847e678a5f189439e630b4a6c0365"
+  integrity sha512-4UBjjBfje4jypkWrJ9wcB2pHu74F/DZm/1PP5eBM0hAZioNWRUb8UjsGuxrm7cKC56sB2+usIbIo9eNC1HGzCA==
+  dependencies:
+    date-format "^3.0.0"
+
 "@aashutoshrathi/word-wrap@^1.2.3":
   version "1.2.6"
   resolved "https://registry.npmmirror.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
@@ -3176,6 +3183,11 @@ date-fns@^2.29.3:
   dependencies:
     "@babel/runtime" "^7.21.0"
 
+date-format@^3.0.0:
+  version "3.0.0"
+  resolved "https://registry.npmmirror.com/date-format/-/date-format-3.0.0.tgz#eb8780365c7d2b1511078fb491e6479780f3ad95"
+  integrity sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==
+
 date.js@^0.3.1:
   version "0.3.3"
   resolved "https://registry.npmmirror.com/date.js/-/date.js-0.3.3.tgz#ef1e92332f507a638795dbb985e951882e50bbda"
@@ -7439,7 +7451,16 @@ string-length@^4.0.1:
     char-regex "^1.0.2"
     strip-ansi "^6.0.0"
 
-"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
+"string-width-cjs@npm:string-width@^4.2.0":
+  version "4.2.3"
+  resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
+  integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
+  dependencies:
+    emoji-regex "^8.0.0"
+    is-fullwidth-code-point "^3.0.0"
+    strip-ansi "^6.0.1"
+
+"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
   version "4.2.3"
   resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
   integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -7471,7 +7492,14 @@ string_decoder@~1.1.1:
   dependencies:
     safe-buffer "~5.1.0"
 
-"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
+"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
+  version "6.0.1"
+  resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
+  integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
+  dependencies:
+    ansi-regex "^5.0.1"
+
+strip-ansi@^6.0.0, strip-ansi@^6.0.1:
   version "6.0.1"
   resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
   integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -8234,8 +8262,7 @@ wordwrap@^1.0.0:
   resolved "https://registry.npmmirror.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
   integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==
 
-"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
-  name wrap-ansi-cjs
+"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
   version "7.0.0"
   resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
   integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -8253,6 +8280,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
     string-width "^4.1.0"
     strip-ansi "^6.0.0"
 
+wrap-ansi@^7.0.0:
+  version "7.0.0"
+  resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
+  integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
+  dependencies:
+    ansi-styles "^4.0.0"
+    string-width "^4.1.0"
+    strip-ansi "^6.0.0"
+
 wrap-ansi@^8.1.0:
   version "8.1.0"
   resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"