Authored by ccbikai

增强API调用

... ... @@ -15,8 +15,6 @@ const Timer = require('./timer');
const config = require('../config/common');
const api = config.domains.api;
const serviceApi = config.domains.service;
const searchApi = config.domains.search;
class Http {
... ... @@ -73,7 +71,7 @@ class Http {
if (config.useCache && cacheOption) {
return this._requestFromCache(options, true);
}
return Promise.reject({
return Promise.resolve({
code: 500,
message: '接口调用失败'
});
... ... @@ -113,7 +111,7 @@ class Http {
return this._requestFromAPI(options, true, reqId);
}
return Promise.reject({
return Promise.resolve({
code: 500,
message: '接口调用失败'
});
... ... @@ -181,12 +179,5 @@ class ServiceAPI extends Http {
}
}
class SearchAPI extends Http {
constructor() {
super(searchApi);
}
}
exports.API = API;
exports.ServiceAPI = ServiceAPI;
exports.SearchAPI = SearchAPI;
... ...