Authored by 陈峰

commit

... ... @@ -34,23 +34,30 @@ const request = async({url, method, reqParams = {}, context}) => {
'User-Agent': 'yoho/nodejs'
};
if (apiInfo.service) {
return await serviceApi.get(`${apiInfo.api}${apiInfo.path}`, params, {
cache: cache,
code: 200,
headers
});
} else if (apiInfo.ufo) {
return await ufoAPI[method](`${apiInfo.path || ''}`, params, {
cache: cache,
code: 200,
headers
});
} else {
return await yohoApi[method](`${apiInfo.path || ''}`, params, {
code: 200,
cache: cache,
headers
try {
if (apiInfo.service) {
return await serviceApi.get(`${apiInfo.api}${apiInfo.path}`, params, {
cache: cache,
code: 200,
headers
});
} else if (apiInfo.ufo) {
return await ufoAPI[method](`${apiInfo.path || ''}`, params, {
cache: cache,
code: 200,
headers
});
} else {
return await yohoApi[method](`${apiInfo.path || ''}`, params, {
code: 200,
cache: cache,
headers
});
}
} catch (error) {
return Promise.reject({
code: error.code || 500,
message: error.message || '服务器错误'
});
}
};
... ...
... ... @@ -9,7 +9,7 @@
<span class="unit">码</span>
</div>
<div class="middle">
<p class="size-store">¥{{value.goodsInfo.goodPrice}},{{value.goodsInfo.storageNum}}个库存</p>
<p class="size-store">¥{{value.goodsInfo.price}},{{value.goodsInfo.storageNum}}个库存</p>
<p class="low-price">当前最低价¥{{value.goodsInfo.leastPrice}}</p>
</div>
<div class="right">
... ...
... ... @@ -71,11 +71,11 @@ module.exports = async(req, res, next) => {
return res.json({
code: 400
});
} catch (e) {
logger.error(e);
} catch (error) {
logger.error(error);
return res.json({
code: 400,
message: e
code: error.code || 500,
message: error.message || '服务器错误'
});
}
};
... ...