You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pdd-order-api/shell/match_cate_cid.js

41 lines
1.2 KiB
JavaScript

11 months ago
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const { window } = new JSDOM('<html><head></head><body></body></html>');
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);