-
-
Save zencodex/2d2097f20b87d1ec7339c10e50cdabd8 to your computer and use it in GitHub Desktop.
相关api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import request from '../request' | |
import crypto from './crypto' | |
export default { | |
sendCode(mobile) { | |
return request.request({ | |
url: 'api/sms/verify-code', | |
method: 'post', | |
data: { | |
mobile, | |
}, | |
auth: false, | |
}) | |
}, | |
wxLogin(code) { | |
return request.request({ | |
url: 'api/wechat/mix/code/login', | |
method: 'post', | |
data: { | |
code, | |
}, | |
auth: false, | |
}) | |
}, | |
appleLogin(token) { | |
return request.request({ | |
url: 'api/auth/apple/oauth', | |
method: 'post', | |
data: { | |
token, | |
}, | |
auth: false, | |
}) | |
}, | |
smsLogin(data) { | |
return request.request({ | |
url: 'api/auth/sms/login', | |
method: 'post', | |
data, | |
auth: false, | |
}) | |
}, | |
getUserInfo() { | |
return request.request({ | |
url: 'api/vip/info' | |
}) | |
}, | |
unbind(provider) { | |
return request.request({ | |
url: 'api/auth/oauth/unbind?provider=' + provider, | |
}) | |
}, | |
wxBind(code) { | |
return request.request({ | |
url: 'api/wechat/mix/code/login', | |
method: 'post', | |
data: { | |
code, | |
is_bind: true, | |
}, | |
}) | |
}, | |
appleBind(token) { | |
return request.request({ | |
url: 'api/auth/apple/oauth', | |
method: 'post', | |
data: { | |
token, | |
is_bind: true, | |
}, | |
}) | |
}, | |
getMessages(messageTime) { | |
return request.request({ | |
url: 'api/messages?t=' + messageTime, | |
}) | |
}, | |
getHistory(page = 1, perPage = 20) { | |
return request.request({ | |
url: `api/process/video/history`, | |
data: { | |
page, | |
perPage, | |
}, | |
}) | |
}, | |
getRandomBg() { | |
return request.request({ | |
url: 'api/process/random-background-image', | |
}) | |
}, | |
getProcessPresets(env) { | |
return request.request({ | |
url: `api/v3/process/presets`, | |
data: { | |
env, | |
}, | |
}).then(res => { | |
crypto.init(res.ak) | |
return res | |
}) | |
}, | |
getBgList(page, perPage = 10) { | |
return request.request({ | |
url: `api/process/background-images`, | |
data: { | |
page, | |
perPage, | |
}, | |
}) | |
}, | |
upload(options) { | |
return request.upload({ | |
url: `api/file/upload`, | |
...options, | |
}) | |
}, | |
getCommand(data) { | |
data = crypto.crypto(data) | |
return request.request({ | |
url: `api/v3/offline/video/command`, | |
method: 'post', | |
data, | |
}).then(res => { | |
res.command = crypto.decrypto(res.command) | |
return res | |
// res = this.decryptAes(res) | |
// return JSON.parse(res) | |
}).catch(err => { | |
getApp().globalData.sentry.captureException(err, { extra: data }) | |
}) | |
}, | |
// aesTest(data) { | |
// data = this.getSign(data) | |
// return request.request({ | |
// url: `api/aes_test`, | |
// method: 'post', | |
// data, | |
// }).then(res => { | |
// console.log(999999, res) | |
// // res = this.decryptAes(res) | |
// // return JSON.parse(res) | |
// }).catch(res => { | |
// console.log(8888888, res) | |
// res = this.decryptAes(res) | |
// console.log('errr:', res) | |
// }) | |
// }, | |
updateResult(id, data) { | |
return request.request({ | |
url: `api/offline/video/status/${id}`, | |
method: 'post', | |
data, | |
}) | |
}, | |
activate(data) { | |
return request.request({ | |
url: `api/codes/active`, | |
method: 'post', | |
data, | |
}) | |
}, | |
getProducts() { | |
return request.request({ | |
url: `api/vipcard/products`, | |
method: 'get', | |
}) | |
}, | |
payWithWechat(productId) { | |
return request.request(({ | |
url: `api/vipcard/pay/wechat/${productId}`, | |
method: 'get', | |
})) | |
}, | |
payWithApple(productId) { | |
return request.request(({ | |
url: `api/vipcard/pay/apple/${productId}`, | |
method: 'get', | |
})) | |
}, | |
appleValidate(data) { | |
return request.request(({ | |
url: `api/vipcard/pay/apple/validate`, | |
data, | |
method: 'post', | |
})) | |
}, | |
userRemove() { | |
return request.request(({ | |
url: `api/auth/user/remove`, | |
data: {}, | |
method: 'post', | |
})) | |
}, | |
videoSpider(parseUrl) { | |
let data = {url: parseUrl} | |
data = crypto.crypto(data) | |
return request.request({ | |
url: 'api/video-spider/parse', | |
method: 'post', | |
data | |
}).then(res=>{ | |
res = crypto.decrypto(res.data) | |
return res?JSON.parse(res):res | |
}) | |
}, | |
env() { | |
return request.request(({ | |
url: 'api/runtime/env', | |
method: 'get', | |
})).then(res=>{ | |
crypto.init(res.ak) | |
return res | |
}) | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment