Authored by htoooth

add logger

@@ -4,7 +4,11 @@ import apiUrl from '../../../../config/api-domain' @@ -4,7 +4,11 @@ import apiUrl from '../../../../config/api-domain'
4 const request = require('axios'); 4 const request = require('axios');
5 5
6 function getBrand(shopId) { 6 function getBrand(shopId) {
7 - return request.get(apiUrl.brand, {shopsId:shopId}) 7 + return request.get(apiUrl.brand, {
  8 + params: {
  9 + shopsId:shopId
  10 + }
  11 + })
8 } 12 }
9 13
10 function getCategory(shopId, brandId, level , sortId) { 14 function getCategory(shopId, brandId, level , sortId) {
@@ -18,7 +22,9 @@ function getCategory(shopId, brandId, level , sortId) { @@ -18,7 +22,9 @@ function getCategory(shopId, brandId, level , sortId) {
18 Object.assign(opts, {sortId}); 22 Object.assign(opts, {sortId});
19 } 23 }
20 24
21 - return request.get(apiUrl.category, opts); 25 + return request.get(apiUrl.category, {
  26 + params: opts
  27 + });
22 } 28 }
23 29
24 export default { 30 export default {
@@ -30,11 +30,11 @@ module.exports = (req, res, next) => { @@ -30,11 +30,11 @@ module.exports = (req, res, next) => {
30 let allowApi = allowed(req.path); 30 let allowApi = allowed(req.path);
31 31
32 if (!allowApi) { 32 if (!allowApi) {
33 - logger.warn(`proxy ${req.method} fail`, `${req.path} can't find proxy url`); 33 + logger.error(`proxy [${req.method}] fail`, `${req.path} can't find proxy url`);
34 return next(); 34 return next();
35 } 35 }
36 36
37 - logger.info(`proxy ${req.method} successful ok`, `[${req.path}] => [${allowApi[1].url}]`); 37 + logger.info(`proxy [${req.method}] successful ok`, `[${req.path}] => [${allowApi[1].url}]`);
38 38
39 if (req.method.toLowerCase() === 'get') { 39 if (req.method.toLowerCase() === 'get') {
40 return api.get(allowApi[1].url, req.query).then(data => { 40 return api.get(allowApi[1].url, req.query).then(data => {