mirror of
https://github.com/earthjasonlin/zzz-signal-search-export.git
synced 2024-11-25 22:50:22 +08:00
Compare commits
5 Commits
f1e3b76d85
...
dd098fcd08
Author | SHA1 | Date | |
---|---|---|---|
dd098fcd08 | |||
0cdc7662f7 | |||
2814ed211b | |||
2f14a4d320 | |||
0e4f3599c9 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zzz-signal-search-export",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.9",
|
||||
"main": "./dist/electron/main/main.js",
|
||||
"author": "earthjasonlin <https://git.loliquq.cn/earthjasonlin>",
|
||||
"homepage": "https://github.com/earthjasonlin/zzz-signal-search-export",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"ui.button.directUpdate": "Direct update",
|
||||
"ui.button.files": "Export Files",
|
||||
"ui.button.excel": "Export Excel",
|
||||
"ui.button.srgf": "Export JSON",
|
||||
"ui.button.uigf": "Export UIGF (Beta)",
|
||||
"ui.button.url": "Input URL",
|
||||
"ui.button.setting": "Settings",
|
||||
"ui.button.option": "Option",
|
||||
@ -99,8 +99,9 @@
|
||||
"excel.customFont": "Arial",
|
||||
"excel.filePrefix": "Zenless Zone Zero Signal Search Log",
|
||||
"excel.fileType": "Excel file",
|
||||
"srgf.fileType": "Zenless Zone Zero Gacha Log Format file (SRGF)",
|
||||
"uigf.fileType": "Uniformed Interchangeable GachaLog Format v4.0 (Beta)",
|
||||
"ui.extra.cacheClean": "1. Confirm whether the search history in the game has been opened, and if the error \"User authentication expired\" still appears, try the following steps \n2. Close the game window of Zenless Zone Zero \n3. Click the \"Open Web Cache Folder\" button above to open the \"Cache\" folder \n4. Delete the \"Cache_Data\" folder \n5. Start the Zenless Zone Zero game and open the search history page in the game \n6. Close this dialog and click the \"Update Data\" button",
|
||||
"ui.extra.findCacheFolder": "If the \"Open cache folder\" button does not respond, you can manually find the game's web cache folder. The directory is \"Your game installation path/ZenlessZoneZero_Data/webCaches/Cache/\"",
|
||||
"ui.extra.urlCopied": "URL Copied"
|
||||
"ui.extra.urlCopied": "URL Copied",
|
||||
"ui.uigf.title": "Please select the UID(s) you want to export"
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
"ui.button.directUpdate": "直接更新",
|
||||
"ui.button.files": "导出文件",
|
||||
"ui.button.excel": "导出Excel",
|
||||
"ui.button.srgf":"导出JSON",
|
||||
"ui.button.uigf":"导出UIGF (Beta)",
|
||||
"ui.button.url": "输入URL",
|
||||
"ui.button.setting": "设置",
|
||||
"ui.button.option": "选项",
|
||||
@ -98,8 +98,9 @@
|
||||
"excel.customFont": "微软雅黑",
|
||||
"excel.filePrefix": "绝区零调频记录",
|
||||
"excel.fileType": "Excel文件",
|
||||
"srgf.fileType":"绝区零调频记录格式文件(SRGF)",
|
||||
"uigf.fileType":"统一可交换抽卡记录标准 v4.0(Beta)",
|
||||
"ui.extra.cacheClean": "1. 确认是否已经打开游戏内的抽卡历史记录,如果仍然出现“身份认证已过期”的错误,再尝试下面的步骤\n2. 关闭绝区零的游戏窗口\n3. 点击上方的“打开缓存文件夹”按钮,打开Cache文件夹\n4. 删除Cache_Data文件夹\n5. 启动绝区零游戏,打开游戏内抽卡历史记录页面\n6. 关闭这个对话框,再点击“更新数据”按钮",
|
||||
"ui.extra.findCacheFolder": "如果点“打开缓存文件夹”按钮没有反应,可以手动找到游戏的网页缓存文件夹,目录为“你的游戏安装路径/ZenlessZoneZero_Data/webCaches/Cache/”",
|
||||
"ui.extra.urlCopied": "URL已复制"
|
||||
"ui.extra.urlCopied": "URL已复制",
|
||||
"ui.uigf.title": "请选择要导出的UID"
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
"ui.button.directUpdate": "直接更新",
|
||||
"ui.button.files": "導出文件",
|
||||
"ui.button.excel": "導出Excel",
|
||||
"ui.button.srgf":"導出JSON",
|
||||
"ui.button.uigf":"導出UIGF (Beta)",
|
||||
"ui.button.url": "輸入URL",
|
||||
"ui.button.setting": "設置",
|
||||
"ui.button.option": "選項",
|
||||
@ -97,8 +97,9 @@
|
||||
"excel.customFont": "微軟雅黑",
|
||||
"excel.filePrefix": "絕區零調頻記錄",
|
||||
"excel.fileType": "Excel文件",
|
||||
"srgf.fileType":"絕區零調頻記錄格式文件(SRGF)",
|
||||
"uigf.fileType":"統一可交換抽卡記錄標準 v4.0(Beta)",
|
||||
"ui.extra.cacheClean": "1. 確認是否已經打開遊戲內的抽卡歷史記錄,如果仍然出現「身份認證已過期」的錯誤,再嘗試下面的步驟\n2. 關閉絕區零的遊戲窗口\n3. 點擊上方的「打開緩存文件夾」按鈕,打開Cache文件夾\n4. 刪除Cache_Data文件夾\n5. 啟動絕區零遊戲,打開遊戲內抽卡歷史記錄頁面\n6. 關閉這個對話框,再點擊「更新數據」按鈕",
|
||||
"ui.extra.findCacheFolder": "如果點「打開緩存文件夾」按鈕沒有反應,可以手動找到遊戲的網頁緩存文件夾,目錄為「你的遊戲安裝路徑/ZenlessZoneZero_Data/webCaches/Cache/」",
|
||||
"ui.extra.urlCopied": "URL已復製"
|
||||
"ui.extra.urlCopied": "URL已復製",
|
||||
"ui.uigf.title": "請選擇要導出的UID"
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
const { app, ipcMain, dialog } = require('electron')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const getData = require('./getData').getData
|
||||
const { version } = require('../../package.json')
|
||||
const i18n = require('./i18n')
|
||||
|
||||
const getTimeString = () => {
|
||||
return new Date().toLocaleString('sv').replace(/[- :]/g, '').slice(0, -2)
|
||||
}
|
||||
|
||||
const formatDate = (date) => {
|
||||
let y = date.getFullYear()
|
||||
let m = `${date.getMonth()+1}`.padStart(2, '0')
|
||||
let d = `${date.getDate()}`.padStart(2, '0')
|
||||
return `${y}-${m}-${d} ${date.toLocaleString('zh-cn', { hour12: false }).slice(-8)}`
|
||||
}
|
||||
|
||||
const start = async () => {
|
||||
const { dataMap, current } = await getData()
|
||||
const data = dataMap.get(current)
|
||||
if (!data.result.size) {
|
||||
throw new Error('数据为空')
|
||||
}
|
||||
const result = {
|
||||
info: {
|
||||
uid: data.uid,
|
||||
lang: data.lang,
|
||||
export_time: formatDate(new Date()),
|
||||
export_timestamp: Math.ceil(Date.now() / 1000),
|
||||
export_app: 'zzz-signal-search-export',
|
||||
export_app_version: `v${version}`,
|
||||
region_time_zone: data.region_time_zone,
|
||||
srgf_version: 'v1.0'
|
||||
},
|
||||
list: []
|
||||
}
|
||||
const listTemp = []
|
||||
for (let [type, arr] of data.result) {
|
||||
arr.forEach(log => {
|
||||
listTemp.push({
|
||||
gacha_id: log.gacha_id,
|
||||
gacha_type: log.gacha_type,
|
||||
item_id: log.item_id,
|
||||
count: '1',
|
||||
time: log.time,
|
||||
name: log.name,
|
||||
item_type: log.item_type,
|
||||
rank_type: log.rank_type,
|
||||
id: log.id
|
||||
})
|
||||
})
|
||||
}
|
||||
listTemp.sort((a, b) => Number(BigInt(a.id) - BigInt(b.id)))
|
||||
listTemp.forEach(item => {
|
||||
result.list.push({
|
||||
...item
|
||||
})
|
||||
})
|
||||
const filePath = dialog.showSaveDialogSync({
|
||||
defaultPath: path.join(app.getPath('downloads'), `SRGF_${data.uid}_${getTimeString()}`),
|
||||
filters: [
|
||||
{ name: i18n.srgf.fileType, extensions: ['json'] }
|
||||
]
|
||||
})
|
||||
if (filePath) {
|
||||
await fs.ensureFile(filePath)
|
||||
await fs.writeFile(filePath, JSON.stringify(result))
|
||||
}
|
||||
}
|
||||
|
||||
ipcMain.handle('EXPORT_SRGF_JSON', async () => {
|
||||
await start()
|
||||
})
|
91
src/main/UIGFJson.js
Normal file
91
src/main/UIGFJson.js
Normal file
@ -0,0 +1,91 @@
|
||||
const { app, ipcMain, dialog } = require('electron')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const getData = require('./getData').getData
|
||||
const { name, version } = require('../../package.json')
|
||||
const i18n = require('./i18n')
|
||||
const { exit } = require('process')
|
||||
|
||||
const getTimeString = () => {
|
||||
return new Date().toLocaleString('sv').replace(/[- :]/g, '').slice(0, -2)
|
||||
}
|
||||
|
||||
const formatDate = (date) => {
|
||||
let y = date.getFullYear()
|
||||
let m = `${date.getMonth()+1}`.padStart(2, '0')
|
||||
let d = `${date.getDate()}`.padStart(2, '0')
|
||||
return `${y}-${m}-${d} ${date.toLocaleString('zh-cn', { hour12: false }).slice(-8)}`
|
||||
}
|
||||
|
||||
const start = async (uids) => {
|
||||
const result = {
|
||||
info: {
|
||||
export_timestamp: Math.ceil(Date.now() / 1000),
|
||||
export_app: `${name}`,
|
||||
export_app_version: `v${version}`,
|
||||
version: "v4.0"
|
||||
},
|
||||
nap: []
|
||||
}
|
||||
const { dataMap, current } = await getData()
|
||||
let fulldata = []
|
||||
uids.forEach(uid => {
|
||||
fulldata.push(dataMap.get(uid))
|
||||
})
|
||||
if (!fulldata.length) {
|
||||
throw new Error('数据为空')
|
||||
}
|
||||
const serverTimeZone = new Map([
|
||||
["prod_gf_cn", 8]
|
||||
])
|
||||
fulldata.forEach(data => {
|
||||
let timezone
|
||||
timezone = serverTimeZone.get(data.region)
|
||||
if(!timezone) {
|
||||
throw new Error('不支持此服务器')
|
||||
}
|
||||
const listTemp = []
|
||||
for (let [type, arr] of data.result) {
|
||||
arr.forEach(log => {
|
||||
listTemp.push({
|
||||
gacha_id: log.gacha_id,
|
||||
gacha_type: log.gacha_type,
|
||||
item_id: log.item_id,
|
||||
count: log.count,
|
||||
time: log.time,
|
||||
name: log.name,
|
||||
item_type: log.item_type,
|
||||
rank_type: log.rank_type,
|
||||
id: log.id
|
||||
})
|
||||
})
|
||||
}
|
||||
listTemp.sort((a, b) => Number(BigInt(a.id) - BigInt(b.id)))
|
||||
let dataTemp = {
|
||||
uid: data.uid,
|
||||
timezone: timezone,
|
||||
lang: data.lang,
|
||||
list: []
|
||||
}
|
||||
listTemp.forEach(item => {
|
||||
dataTemp.list.push({
|
||||
...item
|
||||
})
|
||||
})
|
||||
result.nap.push(dataTemp)
|
||||
})
|
||||
const filePath = dialog.showSaveDialogSync({
|
||||
defaultPath: path.join(app.getPath('downloads'), fulldata.length > 1 ? `UIGF_${getTimeString()}` : `UIGF_${fulldata[0].uid}_${getTimeString()}`),
|
||||
filters: [
|
||||
{ name: i18n.uigf.fileType, extensions: ['json'] }
|
||||
]
|
||||
})
|
||||
if (filePath) {
|
||||
await fs.ensureFile(filePath)
|
||||
await fs.writeFile(filePath, JSON.stringify(result))
|
||||
}
|
||||
}
|
||||
|
||||
ipcMain.handle('EXPORT_UIGF_JSON', async (event, uids) => {
|
||||
await start(uids)
|
||||
})
|
@ -58,6 +58,13 @@ const readData = async () => {
|
||||
const data = await readJSON(dataPath, name)
|
||||
data.typeMap = new Map(data.typeMap) || defaultTypeMap
|
||||
data.result = new Map(data.result)
|
||||
data.result.forEach((value, key) => {
|
||||
value.forEach(item => {
|
||||
if (!('count' in item)) {
|
||||
item.count = "1";
|
||||
}
|
||||
});
|
||||
});
|
||||
if (data.uid) {
|
||||
dataMap.set(data.uid, data)
|
||||
}
|
||||
@ -423,8 +430,8 @@ const fetchData = async (urlOverride) => {
|
||||
for (const type of gachaType) {
|
||||
const { list, uid, region, region_time_zone } = await getGachaLogs(type, queryString)
|
||||
const logs = list.map((item) => {
|
||||
const { id, item_id, item_type, name, rank_type, time, gacha_id, gacha_type } = item
|
||||
return { id, item_id, item_type, name, rank_type, time, gacha_id, gacha_type }
|
||||
const { id, item_id, item_type, name, rank_type, time, gacha_id, gacha_type, count} = item
|
||||
return { id, item_id, item_type, name, rank_type, time, gacha_id, gacha_type, count }
|
||||
})
|
||||
logs.reverse()
|
||||
typeMap.set(type.key, type.name)
|
||||
|
@ -66,7 +66,7 @@ const parseText = (text, data) => {
|
||||
}
|
||||
|
||||
const mainProps = [
|
||||
'symbol', 'ui', 'log', 'excel',"srgf"
|
||||
'symbol', 'ui', 'log', 'excel',"uigf"
|
||||
]
|
||||
|
||||
const i18n = new Proxy(raw, {
|
||||
|
@ -4,7 +4,7 @@ const { disableProxy, proxyStatus } = require('./module/system-proxy')
|
||||
require('./getData')
|
||||
require('./bridge')
|
||||
require('./excel')
|
||||
require('./SRGFJson')
|
||||
require('./UIGFJson')
|
||||
const { getUpdateInfo } = require('./update/index')
|
||||
|
||||
const isDev = !app.isPackaged
|
||||
|
@ -11,7 +11,7 @@
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item command="excel">{{ui.button.excel}}</el-dropdown-item>
|
||||
<el-dropdown-item command="srgf-json">{{ui.button.srgf}}</el-dropdown-item>
|
||||
<el-dropdown-item command="uigf-json">{{ui.button.uigf}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@ -91,7 +91,7 @@ import Setting from './components/Setting.vue'
|
||||
import gachaDetail from './gachaDetail'
|
||||
import { version } from '../../package.json'
|
||||
import gachaType from '../gachaType.json'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
const state = reactive({
|
||||
status: 'init',
|
||||
@ -238,18 +238,47 @@ const saveExcel = async () => {
|
||||
await ipcRenderer.invoke('SAVE_EXCEL')
|
||||
}
|
||||
|
||||
const exportSRGFJSON = () => {
|
||||
ipcRenderer.invoke('EXPORT_SRGF_JSON')
|
||||
const exportUIGFJSON = () => {
|
||||
let uidList = []
|
||||
dataMap.value.forEach(item => {
|
||||
uidList.push(item.uid)
|
||||
})
|
||||
|
||||
ElMessageBox({
|
||||
title: state.i18n.ui.uigf.title,
|
||||
message: `
|
||||
<div>
|
||||
${uidList.map(uid => `
|
||||
<div>
|
||||
<input type="checkbox" id="${uid}" value="${uid}" />
|
||||
<label for="${uid}">${uid}</label>
|
||||
</div>
|
||||
`).join('')}
|
||||
</div>
|
||||
`,
|
||||
dangerouslyUseHTMLString: true,
|
||||
showCancelButton: true,
|
||||
confirmButtonText: state.i18n.ui.common.ok,
|
||||
cancelButtonText: state.i18n.ui.common.cancel,
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
const selected_uids = uidList.filter(uid => document.getElementById(uid).checked);
|
||||
ipcRenderer.invoke('EXPORT_UIGF_JSON', selected_uids);
|
||||
}
|
||||
done();
|
||||
}
|
||||
}).then(() => {
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
const exportCommand = (type) => {
|
||||
if (type === 'excel') {
|
||||
saveExcel()
|
||||
} else if (type === 'srgf-json') {
|
||||
exportSRGFJSON()
|
||||
} else if (type === 'uigf-json') {
|
||||
exportUIGFJSON()
|
||||
}
|
||||
}
|
||||
|
||||
const openCacheFolder = async () => {
|
||||
await ipcRenderer.invoke('OPEN_CACHE_FOLDER')
|
||||
}
|
||||
|
@ -48,7 +48,8 @@
|
||||
</el-form>
|
||||
<h3 class="text-lg my-4">{{about.title}}</h3>
|
||||
<p class="text-gray-600 text-xs mt-1">{{about.license}}</p>
|
||||
<p class="text-gray-600 text-xs mt-1 pb-6">Github: <a @click="openGithub" class="cursor-pointer text-blue-400">https://github.com/earthjasonlin/zzz-signal-search-export</a></p>
|
||||
<p class="text-gray-600 text-xs mt-1">GitHub: <a @click="openGithub" class="cursor-pointer text-blue-400">https://github.com/earthjasonlin/zzz-signal-search-export</a></p>
|
||||
<p class="text-gray-600 text-xs mt-1 pb-6">UIGF: <a @click="openUIGF" class="cursor-pointer text-blue-400">https://uigf.org/</a></p>
|
||||
<el-dialog v-model="state.showDataDialog" :title="common.dataManage" width="90%">
|
||||
<div class="">
|
||||
<el-table :data="gachaDataInfo" border stripe>
|
||||
@ -130,6 +131,7 @@ const disableProxy = async () => {
|
||||
}
|
||||
|
||||
const openGithub = () => shell.openExternal('https://github.com/earthjasonlin/zzz-signal-search-export')
|
||||
const openUIGF = () => shell.openExternal('https://uigf.org/')
|
||||
const openLink = (link) => shell.openExternal(link)
|
||||
|
||||
const deleteData = async (uid, action) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user