erp2goods.js 516 Bytes
'use strict';

const helpers = global.yoho.helpers;

const mRoot = '../models';
const service = require(`${mRoot}/erp2goods-service`);

const find = (req, res, next) => {
    let skn = req.query.skn || '';
    let sku = req.query.sku || '';

    service.find({
        skn: skn,
        sku: sku
    }).then((result) => {
        if (result.url) {
            return res.redirect(helpers.urlFormat(result.url, null, 'item'));
        }

        return next();
    }).catch(next);

};

module.exports = {
    find
};