Explorar o código

feat(phone-list): 支持平台 C 的手机号码筛查

wui hai 10 meses
pai
achega
e17d74f8f5

+ 4 - 1
src/phone-list/phone-list.controller.ts

@@ -136,7 +136,10 @@ export class PhoneListController {
                         finalPhones = await this.phoneListService.screenPhoneNumber(file, parseInt(id))
                         break
                     case 'B':
-                        finalPhones = await this.phoneListService.screenPhoneNumberV2(file, parseInt(id))
+                        finalPhones = await this.phoneListService.screenPhoneNumberV2(file, parseInt(id), 1)
+                        break
+                    case 'C':
+                        finalPhones = await this.phoneListService.screenPhoneNumberV2(file, parseInt(id), 2)
                         break
                     default:
                         throw new InternalServerErrorException('暂不支持该平台')

+ 16 - 4
src/phone-list/phone-list.service.ts

@@ -23,15 +23,24 @@ const axiosInstance = axios.create({
     }
 })
 
-const appId = 'GftmoIruy8mkX4Z5'
-const secret = 'mayzg1xAsHoNaPuF5bXEkpqkAF6vPaRN'
-const publicKey = `-----BEGIN PUBLIC KEY-----
+const appId_sz = 'GftmoIruy8mkX4Z5'
+const secret_sz = 'mayzg1xAsHoNaPuF5bXEkpqkAF6vPaRN'
+const publicKey_sz = `-----BEGIN PUBLIC KEY-----
 MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIzEZG2iwnFrvOLVCtI7F
 SsMKmVx/
 BtY2iVgDNGt1PfgSwFMfHhwJ28fvO+FuuA7SlmmwLEw3KqjRiuUXrnh
 ph0CAwEAAQ==
 -----END PUBLIC KEY-----`
 
+const appId_xs = 'E91kBs3VKmS7Aepp'
+const secret_xs = 'YAAk0H2JN6vwNzD3wwHh1xfZdRkFWp3r'
+const publicKey_xs = `-----BEGIN PUBLIC KEY-----
+MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAOPBRF3HaQ0djP16AuA2d
+eyOjnjCugJ+/
+ixOby6SgVxLiJQf2sbgDJKUg84UUpf2EJx7wMcO9zboLmxsSMVYGp8C
+AwEAAQ==
+-----END PUBLIC KEY-----`
+
 const axiosInstanceV2 = axios.create({
     baseURL: 'http://8.218.211.187/screenApi/',
     headers: {
@@ -207,7 +216,10 @@ export class PhoneListService {
         return phones
     }
 
-    async screenPhoneNumberV2(file: Express.Multer.File, listId: number): Promise<string[]> {
+    async screenPhoneNumberV2(file: Express.Multer.File, listId: number, flag: number): Promise<string[]> {
+        const appId = flag === 1 ? appId_sz : appId_xs
+        const secret = flag === 1 ? secret_sz : secret_xs
+        const publicKey = flag === 1 ? publicKey_sz : publicKey_xs
         const fileRes = await this.fileService.upload(file)
         if (!fileRes.url) {
             throw new ServiceUnavailableException(`File upload error!`)