feat: update dict

This commit is contained in:
王念超
2024-06-13 18:20:03 +08:00
parent 4a5bce7ce6
commit 30c50515ca
201 changed files with 13185569 additions and 10 deletions

1
js_node/failDict.txt Normal file
View File

@@ -0,0 +1 @@
[]

View File

@@ -788,25 +788,37 @@ const childrenEnglish = [{
const newDicts = [...chinaExam, ...internationalExam, ...childrenEnglish,]
function c() {
async function sleep(val) {
return new Promise(resolve => {
setTimeout(resolve, val)
})
}
async function c() {
let dict = newDicts[0]
let url = `../public/dicts/${dict.language}/${dict.type}/${dict.translateLanguage}/${dict.url}`;
let str = fs.readFileSync(url, "utf8");
let list = JSON.parse(str)
let s = list.map(v => v.word)
dict.words = s
console.log('s', dict)
dict.words = list.map(v => v.word)
console.log('名字', dict.name)
await sleep(5000)
axios({
url: 'http://localhost/index.php/v1/support/addDict',
method: 'post',
data: dict
url: 'http://localhost/index.php/v1/support/addDict', method: 'post', data: dict
}).then(r => {
if (!r.data.success) {
fail(v.word)
if (r.data.success) {
console.log('成功', r.data.data)
fs.writeFileSync('./failDict.txt', JSON.stringify(r.data.data, null, 2));
fs.writeFileSync(`./uploadDict/${dict.url}`, JSON.stringify(dict, null, 2));
fs.unlink(url, (err) => {
if (err) throw err;
console.log(dict.name, '已删除');
});
} else {
console.log('失败1', r.data.msg)
}
}).catch(r => {
fail(v.word)
console.log('失败2', r)
})
}