Authored by 郭成尧

cors

... ... @@ -345,6 +345,12 @@ const keyId = (req, res, next) => {
* 搜索品牌下的商品
*/
const searchBrandGoods = (req, res, next) => {
let allowOrigin = _.get(req, 'headers.origin', null) ?
req.headers.origin : req.protocol + '://' + req.headers.host;
res.setHeader('Access-Control-Allow-Origin', allowOrigin);
res.setHeader('Access-Control-Allow-Credentials', 'true');
co(function* () {
let goodListApi = yield searchModel.getBrandGoods(req.query);
... ... @@ -367,6 +373,12 @@ const searchBrandGoods = (req, res, next) => {
* 搜索店铺下的商品
*/
const searchShopGoods = (req, res, next) => {
let allowOrigin = _.get(req, 'headers.origin', null) ?
req.headers.origin : req.protocol + '://' + req.headers.host;
res.setHeader('Access-Control-Allow-Origin', allowOrigin);
res.setHeader('Access-Control-Allow-Credentials', 'true');
co(function* () {
let goodListApi = yield searchModel.getShopGoods(req.query);
... ...