import moment from 'moment'; import commonModel from '../../model/commonModel.js'; import hanzi from '../../model/hanzi.js'; import config from '../../config/index.js'; import _ from 'lodash'; import axios from 'axios'; import { Encrypt, Decrypt } from '../../util/crypto/index.js'; import { stringUtils } from '../../util/stringClass.js'; import WXBizDataCrypt from '../../util/WXBizDataCrypt.js'; import { globalCache } from '../../util/GlobalCache.js'; import constantClass from '../../util/constant/index.js'; import gm from 'gm'; import fs from 'fs'; import { promises as fsPromises } from 'fs'; import COS from 'cos-nodejs-sdk-v5'; const imageMagick = gm.subClass({ imageMagick: true }); export async function HanziLogin(ctx) { let param = ctx.request.body; if (param.param) { const paramStr = Decrypt(param.param, config.urlSecrets.aes_key, config.urlSecrets.aes_iv); //console.log("paramStr:"+paramStr); param = JSON.parse(paramStr); } const code = param.Code; //console.log("code:"+code); const url = `https://api.weixin.qq.com/sns/jscode2session?appid=${config.wx.hanzi_appid}&secret=${config.wx.hanzi_appsecret}&js_code=${code}&grant_type=authorization_code`; let result = await axios.get(url) .then(res => { const json = res.data; //console.log("json:"+json); if (json && json.openid) { param.OpenID = json.openid; param.sessionKey = json.session_key; if (json.unionid) param.UnionID = json.unionid; return {errcode: 10000}; } else { return json; } }) .catch(err => { return {errcode: 101, errStr: err}; }); if (result.errcode == 10000) { delete param.Code; if (param.sessionKey && param.iv && param.encryptedData){ //console.log("param.sessionKey:"+param.sessionKey); const pc = new WXBizDataCrypt(config.wx.hanzi_appid, param.sessionKey); const dataUnionID = pc.decryptData(param.encryptedData , param.iv); //console.log(dataUnionID); param.UnionID = dataUnionID.unionId; } delete param.sessionKey; delete param.iv; delete param.encryptedData; //todo //param.OpenID="o4UHq4gaNlHfdTWxgl3fTgC1mFsI"; let userList = await hanzi.GetUsersInfo(param); if (userList.length > 0) { param.LastLoginTime = new Date(); const time1 = moment(userList[0].ProductServiceTime).format('YYYY-MM-DD HH:mm:ss'); const time3 = moment().format('YYYY-MM-DD HH:mm:ss'); if (time1 < time3) param.IsMember = 0; delete param.Introducer; delete param.UserSource; delete param.SourceID; //console.log(param.NickName); if (param.NickName == "陌生用户") { delete param.NickName; delete param.AvatarUrl; delete param.Language; delete param.Gender; delete param.City; delete param.Province; delete param.Country; } await hanzi.UpdateUsers(param); userList = await hanzi.GetUsersInfo(param); } else { param.NickName = "陌生用户"; param.AvatarUrl = "../images/userface_default.png"; param.CreateTime = new Date(); param.LastLoginTime = param.CreateTime; param.ProductServiceTime = param.CreateTime; const inseredID = await hanzi.AddUsers(param); userList = await hanzi.GetUsersInfo(param); } delete userList[0].OpenID; delete userList[0].UnionID; //产品支付是否显示 if (param.ProgramVersion) { let param2 = { ProgramID: 106, Version: param.ProgramVersion, }; let result3 = await commonModel.GetProductVersionList(param2); if (result3) { if ((param2.Version == result3[0].Version && result3[0].IsShowPay <= 0) || param2.Version > result3[0].Version) { userList[0].IsShow = result3[0].IsShowPay; } else { userList[0].IsShow = 1; } //针对iphone测试用户,永远是无支付状态 if (userList[0].Brand == 'iPhone' && userList[0].WXLanguage == 'en-US' && userList[0].UserSource == '1001' && userList[0].IsPay == 0) { userList[0].IsShow = 0; } //针对微信测试用户,永远是无支付状态 if ((userList[0].UserSource=='1001' && userList[0].System=="iOS 10.0.1") || (!userList[0].UserSource && (!userList[0].LastUserSource || userList[0].LastUserSource>10000)) || userList[0].NickName.indexOf("dgztest")>=0){ userList[0].IsShow=-1; } if (userList[0].IsMember===1) userList[0].IsShow=1; } } result = {errcode: 10000, result: userList[0]}; } ctx.body = result; } //新增汉字记录 export async function AddHanziRecord(ctx) { const param = ctx.request.body; const inseredID = await hanzi.AddHanziRecord(param); ctx.body = {errcode: 10000, result: inseredID}; } //更新汉字记录 export async function UpdateHanziRecord(ctx) { const param = ctx.request.body; await hanzi.UpdateHanziRecord(param); ctx.body = {errcode: 10000}; } //新增或删除汉字完成结果 export async function UpdateHanziFinished(ctx) { const param = ctx.request.body; if (param.Style == "undefined") param.Style = ""; if (param.IsFinished) { delete param.IsFinished; if (param.UserID) { await hanzi.AddHanziFinished(param); } } else { delete param.IsFinished; if (param.UserID) { await hanzi.DeleteHanziFinished(param); } } ctx.body = {errcode: 10000}; } //得到用户完成记录 export async function GetHanziFinishedData(ctx) { const param = { UserID: ctx.query.UserID || 0, }; if (param.UserID=="undefined") param.UserID=0; const result = await hanzi.GetHanziFinishedData(param); if (result && result.length > 0) ctx.body = {"errcode": 10000, result: result}; else ctx.body = {"errcode": 10000}; } //得到汉字数据(1.6.9以后识字小程序持续使用) export async function GetHanziAll0124(ctx) { const param = { UpdateTime: ctx.query.UpdateTime, HasEnglish: ctx.query.HasEnglish || false, HasHanziWrite: ctx.query.HasHanziWrite || false, }; const updateTimeList = await commonModel.GetDataUpdateStatus(); const updateTime = moment(updateTimeList[5].UpdateTime).format('YYYY.MM.DD HH:mm:ss'); if (param.UpdateTime != updateTime) { let result = globalCache.get("GetHanziAll"); if (result == 0) { result = { UpdateTime: updateTime, } let readList = []; const arrBooks = await hanzi.GetHanziBooks(); const arrUnits = await hanzi.GetHanziUnits(); const arrWords = await hanzi.GetHanziWords(); const arr = []; for (let i = 0; i < arrBooks.length; i++) { arrBooks[i].Units = []; if (arrBooks[i].ID >= 61 && arrBooks[i].ID <= 72) { if (arrBooks[i].ID == 71) arrBooks[i].ID = 23; if (arrBooks[i].ID == 72) arrBooks[i].ID = 24; for (let j = 0; j < arrUnits.length; j++) { if (arrBooks[i].ID == arrUnits[j].HanziBookID) { arrUnits[j].Words = []; for (let n = 0; n < arrUnits[j].Example.length; n++) { const word = arrUnits[j].Example[n]; for (let k = 0; k < arrWords.length; k++) { if (word == arrWords[k].Name) { delete arrWords[k].HanziUnitID; arrUnits[j].Words.push(arrWords[k]); break; } } } delete arrUnits[j].HanziBookID; arrUnits[j].Title = arrUnits[j].Example.substr(0,4); arrBooks[i].Units.push(arrUnits[j]); } } if (arrBooks[i].ID == 23) arrBooks[i].ID = 71; if (arrBooks[i].ID == 24) arrBooks[i].ID = 72; arr.push(arrBooks[i]); } } readList = arr; readList = JSON.stringify(readList); readList = Encrypt(readList, config.urlSecrets.aes_key, config.urlSecrets.aes_iv); result.List = readList; globalCache.set("GetHanziAll", result, config.BufferMemoryTimeHigh); console.log("缓存"); } ctx.body = {"errcode": 10000, result: result}; } else { const result = { String: globalCache.get("BaiduToken"), } ctx.body = {"errcode": 10000, result: result}; } } //得到汉字数据(2.1.60)后使用 export async function GetHanziAll3(ctx) { const param = { UpdateTime: ctx.query.UpdateTime, }; const updateTimeList = await commonModel.GetDataUpdateStatus(); const updateTime = moment(updateTimeList[5].UpdateTime).format('YYYY.MM.DD HH:mm:ss'); if (param.UpdateTime != updateTime) { let result = globalCache.get("GetHanziAll3"); if (result == 0) { result = { UpdateTime: updateTime, } let readList = []; const arrBooks = await hanzi.GetHanziBooks(); const arrUnits = await hanzi.GetHanziUnits(); const arrWords = await hanzi.GetHanziWords(); const arrAncientList = await hanzi.GetAncientChineseProse({IsList:0}); const arrAncientChineseProseSentenct = await hanzi.GetAncientChineseProseSentence({}); const arr = []; for (let i = 0; i < arrBooks.length; i++) { arrBooks[i].Units = []; for (let j = 0; j < arrUnits.length; j++) { if (arrBooks[i].ID == arrUnits[j].HanziBookID) { arrUnits[j].Words = []; //早期识字 if (arrUnits[j].HanziBookID <= 12) { } //写字 else if (arrUnits[j].HanziBookID >= 13 && arrUnits[j].HanziBookID <= 24) { const words = arrUnits[j].Example; for(let m = 0; m < words.length; m++) { for (let k = 0; k < arrWords.length; k++) { if (words[m] == arrWords[k].Name) { arrUnits[j].Words.push(arrWords[k].Name); arrUnits[j].Words = _.union(arrUnits[j].Words); } } } } //词语 else if (arrUnits[j].HanziBookID >= 43 && arrUnits[j].HanziBookID <= 60) { const words = arrUnits[j].Example.split(","); for(let m = 0; m < words.length; m++) { arrUnits[j].Words.push(words[m]); } } //新识字 else if (arrUnits[j].HanziBookID >= 61 && arrUnits[j].HanziBookID <= 72) { const words = arrUnits[j].Example; for(let m = 0; m < words.length; m++) { for (let k = 0; k < arrWords.length; k++) { if (words[m] == arrWords[k].Name) { arrUnits[j].Words.push(arrWords[k].Name); arrUnits[j].Words = _.union(arrUnits[j].Words); } } } } //文言文 else if (arrUnits[j].HanziBookID == 73) { for(let n = 0; n < arrAncientList.length; n++) { if (arrUnits[j].Name == arrAncientList[n].Word) { arrUnits[j].Words.push(arrAncientList[n].Definitions); } } } //小古文 else if (arrUnits[j].HanziBookID == 86) { for(let n = 0; n < arrAncientChineseProseSentenct.length; n++) { if (arrUnits[j].Name == arrAncientChineseProseSentenct[n].Unit) { for(let m = 0; m < arrAncientChineseProseSentenct[n].Count; m++) arrUnits[j].Words.push(""); } } } delete arrUnits[j].HanziBookID; delete arrUnits[j].Example; delete arrUnits[j].OrderID; delete arrUnits[j].IsLocked; delete arrUnits[j].UnitType; arrBooks[i].Units.push(arrUnits[j]); } } arr.push(arrBooks[i]); } readList = arr; readList = JSON.stringify(readList); readList = Encrypt(readList, config.urlSecrets.aes_key, config.urlSecrets.aes_iv); result.List = readList; globalCache.set("GetHanziAll3", result, config.BufferMemoryTimeHigh); console.log("缓存"); } ctx.body = {"errcode": 10000, result: result}; } else { const result = { String: globalCache.get("BaiduToken"), } ctx.body = {"errcode": 10000, result: result}; } } //得到一册书的字词数据 export async function GetHanziByBookID(ctx) { const param = ctx.request.body; let result = globalCache.get("GetHanziByBookID?BookID="+param.BookID); if (result == 0) { const arrUnits = await hanzi.GetHanziUnits(param); const arrWords = await hanzi.GetHanziWords(); for (let j = 0; j < arrUnits.length; j++) { arrUnits[j].Words = []; //写字 if (arrUnits[j].HanziBookID >= 13 && arrUnits[j].HanziBookID <= 24) { const words = arrUnits[j].Example; for(let m = 0; m < words.length; m++) { for (let k = 0; k < arrWords.length; k++) { if (words[m] == arrWords[k].Name) { arrUnits[j].Words.push(arrWords[k].Name); arrUnits[j].Words = _.union(arrUnits[j].Words); } } } } //词语 else if (arrUnits[j].HanziBookID >= 43 && arrUnits[j].HanziBookID <= 60) { const words = arrUnits[j].Example.split(","); for(let m = 0; m < words.length; m++) { arrUnits[j].Words.push(words[m]); } } //新识字 else if (arrUnits[j].HanziBookID >= 61 && arrUnits[j].HanziBookID <= 72) { const words = arrUnits[j].Example; for(let m = 0; m < words.length; m++) { for (let k = 0; k < arrWords.length; k++) { if (words[m] == arrWords[k].Name) { arrUnits[j].Words.push(arrWords[k].Name); arrUnits[j].Words = _.union(arrUnits[j].Words); } } } } delete arrUnits[j].HanziBookID; delete arrUnits[j].OrderID; delete arrUnits[j].Example; delete arrUnits[j].UnitType; delete arrUnits[j].IsLocked; } result = arrUnits; globalCache.set("GetHanziByBookID?BookID="+param.BookID, result, config.BufferMemoryTimeHigh); console.log("缓存"); } ctx.body = {"errcode": 10000, result: result}; } //得到英语数据(2.1.60)后使用 export async function GetSoundErrorArr(ctx) { const param = { UpdateTime: ctx.query.UpdateTime, }; const updateTimeList = await commonModel.GetDataUpdateStatus(); const updateTime = moment(updateTimeList[7].UpdateTime).format('YYYY.MM.DD HH:mm:ss'); if (param.UpdateTime != updateTime) { const result = { List: await constantClass.GetSoundErrorArr(), UpdateTime: updateTime }; ctx.body = {"errcode": 10000, result: result}; } else { ctx.body = {"errcode": 10000}; } } //得到汉字详细数据 export async function GetHanziDetail(ctx) { const param = { ID: ctx.query.ID || 0, Type: "all", }; if (param.ID && param.ID > 0) { let result = globalCache.get("GetHanziDetail?ID=" + param.ID); if (result == 0) { const arrWords = await hanzi.GetHanziWords(param); result = JSON.parse(arrWords[0].Details); for (let i = 0; i < result.PinYin.length; i++) { let item = result.PinYin[i].explain; item = stringUtils.ReplaceAllString(item, "
", ""); item = stringUtils.ReplaceAllString(item, "", ""); item = stringUtils.ReplaceAllString(item, "", ""); item = stringUtils.ReplaceAllString(item, "\r", ""); item = stringUtils.ReplaceAllString(item, "\n", ""); const arr = item.split("
"); arr.pop(); result.PinYin[i].explain = arr; } globalCache.set("GetHanziDetail?ID=" + param.ID, result, config.BufferMemoryTimeHigh); } ctx.body = {"errcode": 10000, result: result}; } else { ctx.body = {"errcode": 10000}; } } //得到单元汉字数据 export async function GetHanziUnitWords(ctx) { const param = { UnitID: ctx.query.UnitID || 0, TestType: ctx.query.TestType || "read", }; let result = globalCache.get("GetHanziUnitWords?UnitID=" + param.UnitID + "&TestType=" + param.TestType); if (result == 0) { const unitInfo = await hanzi.GetHanziUnitInfo(param); //词语部分 if (unitInfo && unitInfo.length > 0 && unitInfo[0].UnitType == 2) { const words = await hanzi.GetHanziUnitByID(param); if (words[0] && words[0].Example) { let words1 = words[0].Example.split(",").join("','"); param.Words = words1; result = await hanzi.GetMiaoguoLiteracyWords(param); let temp = ""; let arrTemp = []; for (let i = 0; i < result.length; i++) { if (temp != result[i].Word && result[i].JSONString) { const json = JSON.parse(result[i].JSONString); const obj = {}; obj.ID = i + 1; let qustion, answer, tags; if (param.TestType == "read") { qustion = result[i].Word; if (process.env.NODE_ENV == 'development') console.log(qustion); answer = "[读 src='" + result[i].Word + "']" + json.CHN.PinYin[0].pinyin + "[/读]\n\n"; answer += json.CHN.PinYin[0].explain; tags = "怎么念"; obj.FontSize = 108; } else { qustion = "[读 src='" + result[i].Word + "']" + json.CHN.PinYin[0].pinyin + "[/读]\n"; answer = result[i].Word + "\n\n"; if (json.CHN.KaitiArr) { for (let j = 0; j < json.CHN.KaitiArr.length; j++) { answer += "[图 w='650' h='650']" + json.CHN.KaitiArr[j] + "[/图]\n"; } } answer += json.CHN.PinYin[0].explain; tags = "怎么写"; } obj.Word = result[i].Word; obj.ReadString = result[i].Word; obj.Content = []; obj.Content.push({ContentType: 0, Content: tags}); obj.Content.push({ContentType: 1, Content: qustion}); obj.Content.push({ContentType: 2, Content: answer}); obj.Content.push({ContentType: 3, Content: ""}); arrTemp.push(obj); } temp = result[i].Word; } result = arrTemp; } } //文言文部分 else if (unitInfo && unitInfo.length > 0 && unitInfo[0].UnitType == 4) { const words = await hanzi.GetHanziUnitByID(param); const arrAncientList = await hanzi.GetAncientChineseProse({IsList: 0}); if (words[0] && words[0].Name) { result = []; for (let i = 0; i < arrAncientList.length; i++) { if (arrAncientList[i].Word == words[0].Name) { let qustion, answer, tags; qustion = arrAncientList[i].ExampleSentence; qustion = stringUtils.ReplaceAllString(qustion, arrAncientList[i].Word, "[光]" + arrAncientList[i].Word + "[/光]"); const readString = "“" + arrAncientList[i].Word + "”字在这里的意思是" + arrAncientList[i].Definitions; answer = "[读 src='" + readString + "']" + arrAncientList[i].Definitions + "[/读]\n\n"; if (arrAncientList[i].ExampleDefinitions.indexOf("译文") < 0) answer += "译文:"; answer += arrAncientList[i].ExampleDefinitions; tags = "文言文字释义"; const obj = {}; obj.Word = "【" + arrAncientList[i].Word + "】" + arrAncientList[i].Definitions; obj.ReadString = readString; obj.Content = []; obj.Content.push({ContentType: 0, Content: tags}); obj.Content.push({ContentType: 1, Content: qustion}); obj.Content.push({ContentType: 2, Content: answer}); obj.Content.push({ContentType: 3, Content: ""}); result.push(obj); } } } } //小古文部分 else if (unitInfo && unitInfo.length > 0 && unitInfo[0].UnitType == 3) { const words = await hanzi.GetHanziUnitByID(param); const resultList = await hanzi.GetAncientChineseProseSentence({Unit: words[0].Name}); if (words[0] && words[0].Name) { result = []; for (let i = 0; i < resultList.length; i++) { let qustion, answer, tags; if (param.TestType == "read") { qustion = resultList[i].Question; answer = "[光]" + resultList[i].Sentence + "[/光]\n\n"; answer += "含义\n• "; answer += resultList[i].Paraphrase + "\n\n"; if (resultList[i].Explain) { answer += "详解\n• "; answer += resultList[i].Explain + "\n\n"; } if (resultList[i].Idiom) { answer += "句中包含的成语\n• "; answer += resultList[i].Idiom + "\n\n"; } if (resultList[i].SentenceFragment) { answer += "原文片段\n• "; answer += resultList[i].SentenceFragment + "\n\n"; } if (resultList[i].Source) { answer += "出自\n• "; answer += "《" + resultList[i].Source + "》 "; if (resultList[i].Author) answer += resultList[i].Author + " "; if (resultList[i].Dynasty) answer += "(" + resultList[i].Dynasty + ")"; answer += "\n\n"; } tags = "接下文"; } else { qustion = resultList[i].Paraphrase; answer = "[光]" + resultList[i].Sentence + "[/光]\n\n"; if (resultList[i].Explain) { answer += "详解\n• "; answer += resultList[i].Explain + "\n\n"; } if (resultList[i].Idiom) { answer += "句中包含的成语\n• "; answer += resultList[i].Idiom + "\n\n"; } if (resultList[i].SentenceFragment) { answer += "原文片段\n• "; answer += resultList[i].SentenceFragment + "\n\n"; } if (resultList[i].Source) { answer += "出自\n• "; answer += "《" + resultList[i].Source + "》 "; if (resultList[i].Author) answer += resultList[i].Author + " "; if (resultList[i].Dynasty) answer += "(" + resultList[i].Dynasty + ")"; answer += "\n\n"; } tags = "说古文"; } const obj = {}; obj.Word = resultList[i].Sentence; obj.Content = []; obj.Content.push({ContentType: 0, Content: tags}); obj.Content.push({ContentType: 1, Content: qustion}); obj.Content.push({ContentType: 2, Content: answer}); obj.Content.push({ContentType: 3, Content: ""}); result.push(obj); } } } globalCache.set("GetHanziUnitWords?UnitID=" + param.UnitID + "&TestType=" + param.TestType, result, config.BufferMemoryTimeHigh); } ctx.body = {"errcode": 10000, result: result}; } //添加自定义汉字 export async function AddHanziCustom(ctx) { const param = ctx.request.body; let userCustom = await hanzi.GetUsersUnitCustomList(param); if (userCustom && userCustom.length>0){ await hanzi.UpdateHanziCustom(param); } else { await hanzi.AddHanziCustom(param); } ctx.body = {"errcode": 10000}; } //得到自定义汉字列表 export async function GetHanziCustomList(ctx) { const param = { UserID: ctx.query.UserID || 0, }; if (param.UserID=="undefined") param.UserID=0; let result = await hanzi.GetHanziCustomList(param); if (result && result.length > 0) { for (let n = 0; n < result.length; n++) { result[n].List = result[n].UnitCustom; result[n].ID = result[n].UnitID; delete result[n].CreateTime; delete result[n].UnitCustom; delete result[n].UserID; delete result[n].UnitID; } ctx.body = {"errcode": 10000, result: result}; } else ctx.body = {"errcode": 10000, result: []}; } //得到测试汉字列表 export async function GetHanziTestList(ctx) { const param = { Type: "random" }; const result = await hanzi.GetHanziWords(param); if (result && result.length > 0) { let arr = [], arrChild = []; let temp = 0; for (let i = 0; i < result.length; i++) { if (temp > 0 && temp != result[i].HanziUnitID) { arr.push(arrChild); arrChild=[]; } arrChild.push(result[i]); temp = result[i].HanziUnitID; } arr.push(arrChild); const arrResult = []; for (let i = 0; i < arr.length; i++) { //console.log(arr[i].length); const arrTemp = stringUtils.RandomArray(arr[i]); for (let j = 0; j < 3; j++) { //console.log(arrTemp[j].ID); if (arrTemp && arrTemp[j] && arrTemp[j].PinyinTest) { arrTemp[j].PinyinTest = JSON.parse(arrTemp[j].PinyinTest); const arr1 = []; if (arrTemp[j].PinyinTest.easy.length > 0) { arr1.push(arrTemp[j].PinyinTest.easy); arr1.push(arrTemp[j].PinyinTest.easy); } if (arrTemp[j].PinyinTest.normal.length > 0) { arr1.push(arrTemp[j].PinyinTest.normal); arr1.push(arrTemp[j].PinyinTest.normal); arr1.push(arrTemp[j].PinyinTest.normal); } const num = stringUtils.Random(0, arr1.length - 1); //if (arr1[num]==undefined) { // console.log(num); // console.log(arr1); //} const arr3 = arr1[num]; const arr2 = []; if (arr3[0]) arr2.push({ options: arr3[0] }); if (arr3[1]) arr2.push({ options: arr3[1] }); if (arr3[2]) arr2.push({ options: arr3[2] }); arr2.push({ options: arrTemp[j].PinyinTest.answer, "IsAnswer": true }); arrTemp[j].PinyinTest = stringUtils.RandomArray(arr2); arrResult.push(arrTemp[j]); } } } ctx.body = { errcode: 10000, result: arrResult }; } else { ctx.body = { errcode: 10000, result: [] }; } } //得到非课本汉字数据 export async function SearchHanzi(ctx) { const param = { Word: ctx.query.Word, }; const result = await hanzi.GetHanziWordsByWord(param); if (result && result.length > 0) { if (result[0].HasImage==0) buildHanziKaishu(param.Word); result[0].WordUrl="https://hanzi-1253256735.file.myqcloud.com/images/hanzi"+param.Word+".jpg"; result[0].IsNew=false; ctx.body = {"errcode": 10000, result: result[0]}; } else { const hanzi1 = encodeURI(param.Word); const url = "http://localhost:"+config.port+"/api/GetLiteracyData?Word=" + hanzi1; const result2 = await axios.get(url) .then(function (response) { const obj = response.data; const data = obj.result; const arrTemp = []; if (data.CombineWords && data.CombineWords.length>0) arrTemp.push(data.CombineWords[0]); let pinyin = ""; for(let i=0; i