|
|
@@ -38,6 +38,17 @@ function QLTools(url, clientId, clientSecret) {
|
|
|
return typeof require == "function" && !this.isJSBox();
|
|
|
}
|
|
|
|
|
|
+ adapterStatus(response) {
|
|
|
+ if (response) {
|
|
|
+ if (response.status) {
|
|
|
+ response["statusCode"] = response.status
|
|
|
+ } else if (response.statusCode) {
|
|
|
+ response["status"] = response.statusCode
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return response
|
|
|
+ }
|
|
|
+
|
|
|
get(options, callback = () => { }) {
|
|
|
if (this.isQuanX()) {
|
|
|
if (typeof options == "string") options = {
|
|
|
@@ -164,12 +175,10 @@ function QLTools(url, clientId, clientSecret) {
|
|
|
|
|
|
|
|
|
async login(){
|
|
|
- this.log('######1');
|
|
|
let result = await this.getToken();
|
|
|
if(!result){
|
|
|
return false;
|
|
|
}
|
|
|
- this.log('######2');
|
|
|
if(result.code == 200){
|
|
|
let data = result.data;
|
|
|
this.auth = `${data.token_type} ${data.token}`;
|
|
|
@@ -183,14 +192,10 @@ function QLTools(url, clientId, clientSecret) {
|
|
|
let options = {
|
|
|
url: url,
|
|
|
};
|
|
|
- this.log(url);
|
|
|
return new Promise(resolve => {
|
|
|
- this.log('###getToken###1');
|
|
|
this.get(options, async (error, response, data) => {
|
|
|
try {
|
|
|
- this.log('###getToken###2');
|
|
|
error && this.log(error);
|
|
|
- this.log(data);
|
|
|
let result = JSON.parse(data);
|
|
|
resolve(result);
|
|
|
} catch (error) {
|