first commit
This commit is contained in:
7
api/index.js
Normal file
7
api/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export { authApi } from './modules/auth.js';
|
||||
export { assetApi } from './modules/asset.js';
|
||||
export { deviceApi } from './modules/device.js';
|
||||
export { exchangeApi } from './modules/exchange.js';
|
||||
export { orderApi } from './modules/order.js';
|
||||
export { realnameApi } from './modules/realname.js';
|
||||
export { walletApi } from './modules/wallet.js';
|
||||
35
api/modules/asset.js
Normal file
35
api/modules/asset.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import request from '@/utils/request.js';
|
||||
|
||||
export const assetApi = {
|
||||
getInfo(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/asset/info',
|
||||
method: 'GET',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
getPackageHistory(identifier, page, page_size, params = {}) {
|
||||
return request({
|
||||
url: '/api/c/v1/asset/package-history',
|
||||
method: 'GET',
|
||||
data: { identifier, page, page_size, ...params }
|
||||
});
|
||||
},
|
||||
|
||||
getPackages(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/asset/packages',
|
||||
method: 'GET',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
refresh(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/asset/refresh',
|
||||
method: 'POST',
|
||||
data: { identifier }
|
||||
});
|
||||
}
|
||||
};
|
||||
50
api/modules/auth.js
Normal file
50
api/modules/auth.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import request from '@/utils/request.js';
|
||||
|
||||
export const authApi = {
|
||||
verifyAsset(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/auth/verify-asset',
|
||||
method: 'POST',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
wechatLogin(asset_token, code) {
|
||||
return request({
|
||||
url: '/api/c/v1/auth/wechat-login',
|
||||
method: 'POST',
|
||||
data: { asset_token, code }
|
||||
});
|
||||
},
|
||||
|
||||
sendCode(phone, scene) {
|
||||
return request({
|
||||
url: '/api/c/v1/auth/send-code',
|
||||
method: 'POST',
|
||||
data: { phone, scene }
|
||||
});
|
||||
},
|
||||
|
||||
bindPhone(phone, code) {
|
||||
return request({
|
||||
url: '/api/c/v1/auth/bind-phone',
|
||||
method: 'POST',
|
||||
data: { phone, code }
|
||||
});
|
||||
},
|
||||
|
||||
changePhone(old_phone, old_code, new_phone, new_code) {
|
||||
return request({
|
||||
url: '/api/c/v1/auth/change-phone',
|
||||
method: 'POST',
|
||||
data: { old_phone, old_code, new_phone, new_code }
|
||||
});
|
||||
},
|
||||
|
||||
logout() {
|
||||
return request({
|
||||
url: '/api/c/v1/auth/logout',
|
||||
method: 'POST'
|
||||
});
|
||||
}
|
||||
};
|
||||
43
api/modules/device.js
Normal file
43
api/modules/device.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import request from '@/utils/request.js';
|
||||
|
||||
export const deviceApi = {
|
||||
getCards(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/device/cards',
|
||||
method: 'GET',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
factoryReset(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/device/factory-reset',
|
||||
method: 'POST',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
reboot(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/device/reboot',
|
||||
method: 'POST',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
switchCard(identifier, target_iccid) {
|
||||
return request({
|
||||
url: '/api/c/v1/device/switch-card',
|
||||
method: 'POST',
|
||||
data: { identifier, target_iccid }
|
||||
});
|
||||
},
|
||||
|
||||
setWifi(identifier, ssid, password, enabled = true) {
|
||||
return request({
|
||||
url: '/api/c/v1/device/wifi',
|
||||
method: 'POST',
|
||||
data: { identifier, ssid, password, enabled }
|
||||
});
|
||||
}
|
||||
};
|
||||
19
api/modules/exchange.js
Normal file
19
api/modules/exchange.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import request from '@/utils/request.js';
|
||||
|
||||
export const exchangeApi = {
|
||||
getPending(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/exchange/pending',
|
||||
method: 'GET',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
submitShippingInfo(id, recipient_name, recipient_phone, recipient_address) {
|
||||
return request({
|
||||
url: `/api/c/v1/exchange/${id}/shipping-info`,
|
||||
method: 'POST',
|
||||
data: { recipient_name, recipient_phone, recipient_address }
|
||||
});
|
||||
}
|
||||
};
|
||||
27
api/modules/order.js
Normal file
27
api/modules/order.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request.js';
|
||||
import { APP_TYPE } from '@/utils/env.js';
|
||||
|
||||
export const orderApi = {
|
||||
getList(identifier, page, page_size, payment_status) {
|
||||
return request({
|
||||
url: '/api/c/v1/orders',
|
||||
method: 'GET',
|
||||
data: { identifier, page, page_size, payment_status }
|
||||
});
|
||||
},
|
||||
|
||||
getDetail(id) {
|
||||
return request({
|
||||
url: `/api/c/v1/orders/${id}`,
|
||||
method: 'GET'
|
||||
});
|
||||
},
|
||||
|
||||
create(identifier, package_ids) {
|
||||
return request({
|
||||
url: '/api/c/v1/orders/create',
|
||||
method: 'POST',
|
||||
data: { identifier, package_ids, app_type: APP_TYPE }
|
||||
});
|
||||
}
|
||||
};
|
||||
11
api/modules/realname.js
Normal file
11
api/modules/realname.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import request from '@/utils/request.js';
|
||||
|
||||
export const realnameApi = {
|
||||
getLink(identifier, iccid) {
|
||||
return request({
|
||||
url: '/api/c/v1/realname/link',
|
||||
method: 'GET',
|
||||
data: { identifier, iccid }
|
||||
});
|
||||
}
|
||||
};
|
||||
44
api/modules/wallet.js
Normal file
44
api/modules/wallet.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request.js';
|
||||
import { APP_TYPE } from '@/utils/env.js';
|
||||
|
||||
export const walletApi = {
|
||||
getDetail(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/wallet/detail',
|
||||
method: 'GET',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
recharge(identifier, amount, payment_method) {
|
||||
return request({
|
||||
url: '/api/c/v1/wallet/recharge',
|
||||
method: 'POST',
|
||||
data: { identifier, amount, payment_method, app_type: APP_TYPE }
|
||||
});
|
||||
},
|
||||
|
||||
rechargeCheck(identifier) {
|
||||
return request({
|
||||
url: '/api/c/v1/wallet/recharge-check',
|
||||
method: 'GET',
|
||||
data: { identifier }
|
||||
});
|
||||
},
|
||||
|
||||
getRecharges(identifier, page, page_size, status) {
|
||||
return request({
|
||||
url: '/api/c/v1/wallet/recharges',
|
||||
method: 'GET',
|
||||
data: { identifier, page, page_size, status }
|
||||
});
|
||||
},
|
||||
|
||||
getTransactions(identifier, page, page_size, params = {}) {
|
||||
return request({
|
||||
url: '/api/c/v1/wallet/transactions',
|
||||
method: 'GET',
|
||||
data: { identifier, page, page_size, ...params }
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user