|
|
@@ -16,12 +16,6 @@ const ApiKey2 = 'RHJGV1paR1BFWjlFbCtnakUza2xJdz09'
|
|
|
const name3 = 'unsnap30942'
|
|
|
const ApiKey3 = 'UzVzWkFWekZCeXF1U1RxcFlXRGdWdz09'
|
|
|
|
|
|
-const user = [
|
|
|
- { name: name1, ApiKey: ApiKey1 },
|
|
|
- { name: name2, ApiKey: ApiKey2 },
|
|
|
- { name: name3, ApiKey: ApiKey3 }
|
|
|
-]
|
|
|
-
|
|
|
const durianInstance = axios.create({
|
|
|
baseURL: 'http://8.218.211.187/out/ext_api/',
|
|
|
headers: {
|
|
|
@@ -31,13 +25,23 @@ const durianInstance = axios.create({
|
|
|
})
|
|
|
|
|
|
export class durian extends GetNumberService {
|
|
|
- source: RcsNumberSource = RcsNumberSource.durian
|
|
|
+ source: RcsNumberSource
|
|
|
+
|
|
|
+ name: string
|
|
|
+ ApiKey: string
|
|
|
+
|
|
|
+ constructor(name: string, ApiKey: string, source: RcsNumberSource) {
|
|
|
+ super()
|
|
|
+ this.name = name
|
|
|
+ this.ApiKey = ApiKey
|
|
|
+ this.source = source
|
|
|
+ }
|
|
|
|
|
|
async getNumber(country: string, num?: number): Promise<GetNumberResponse> {
|
|
|
const res = await durianInstance.get('getMobile', {
|
|
|
params: {
|
|
|
- name: name1,
|
|
|
- ApiKey: ApiKey1,
|
|
|
+ name: this.name,
|
|
|
+ ApiKey: this.ApiKey,
|
|
|
cuy: country.toUpperCase(),
|
|
|
pid,
|
|
|
num: 1,
|
|
|
@@ -80,8 +84,8 @@ export class durian extends GetNumberService {
|
|
|
async releaseNumber(number: string) {
|
|
|
const { data } = await durianInstance.get('passMobile', {
|
|
|
params: {
|
|
|
- name: name1,
|
|
|
- ApiKey: ApiKey1,
|
|
|
+ name: this.name,
|
|
|
+ ApiKey: this.ApiKey,
|
|
|
pn: number,
|
|
|
pid
|
|
|
}
|
|
|
@@ -96,8 +100,8 @@ export class durian extends GetNumberService {
|
|
|
async retriveMessage(orderId: string, num?: number): Promise<string> {
|
|
|
const { data } = await durianInstance.get('getMsg', {
|
|
|
params: {
|
|
|
- name: name1,
|
|
|
- ApiKey: ApiKey1,
|
|
|
+ name: this.name,
|
|
|
+ ApiKey: this.ApiKey,
|
|
|
pn: orderId,
|
|
|
pid: pid,
|
|
|
serial: 2
|
|
|
@@ -111,8 +115,8 @@ export class durian extends GetNumberService {
|
|
|
async blockNumber(number: string) {
|
|
|
const { data } = await durianInstance.get('addBlack', {
|
|
|
params: {
|
|
|
- name: name1,
|
|
|
- ApiKey: ApiKey1,
|
|
|
+ name: this.name,
|
|
|
+ ApiKey: this.ApiKey,
|
|
|
pn: number,
|
|
|
pid: pid
|
|
|
}
|
|
|
@@ -127,8 +131,8 @@ export class durian extends GetNumberService {
|
|
|
async cacheNumber(country: string, size: number) {
|
|
|
const res = await durianInstance.get('getMobile', {
|
|
|
params: {
|
|
|
- name: name1,
|
|
|
- ApiKey: ApiKey1,
|
|
|
+ name: this.name,
|
|
|
+ ApiKey: this.ApiKey,
|
|
|
cuy: country.toUpperCase(),
|
|
|
pid,
|
|
|
num: 10,
|