const jsdom = require("jsdom"); const { JSDOM } = jsdom; const { window } = new JSDOM(''); const $ = require('jquery')(window); const fs = require('fs'); const _ = require('underscore'); const moveBatch = require('../app/views/static/js/biz/move_batch.js'); let arguments = process.argv.splice(2); let tempPath = arguments[0]; let dataStr = fs.readFileSync(tempPath, 'utf-8'); let data = JSON.parse(dataStr); let item = data['item']; let mallId = data['mallId']; let fullCateList = data['fullCateList']; let topCatsList = data['topCatsList']; let rewriteCids = data['rewriteCids']; let moveSetting = data['moveSetting']; let isFastMode = data['isFastMode']; let matchSourceCategoryMap = data['sourceCategoryMap']['matchSourceCategoryMap']; let mallInvalidCids = data['mallInvalidCids']; const dump = console.log; console.log = function() {}; moveBatch.setEnv($, window, _); let newItem = moveBatch.matchCateCid(item, mallId, fullCateList, mallInvalidCids, topCatsList, rewriteCids, moveSetting, matchSourceCategoryMap, isFastMode); console.log = dump; let returnData = { 'cid' : newItem['cid'], 'path' : newItem['path'], }; let itemJson = JSON.stringify(returnData); console.log(itemJson);