mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-04-25 05:56:57 +08:00
增加库存功能
This commit is contained in:
parent
9dbe2184dd
commit
77da3cf339
@ -117,7 +117,7 @@ export async function generateDescription(desIndex = 0): Promise<string> {
|
||||
url: 'https://api.openai-proxy.com/v1/chat/completions',
|
||||
method: 'post',
|
||||
headers: {
|
||||
Authorization: `Bearer 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`
|
||||
Authorization: `Bearer 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`
|
||||
},
|
||||
data: {
|
||||
max_tokens: 1024,
|
||||
|
@ -21,6 +21,11 @@ export async function getLink(options) {
|
||||
log('等待升级plus按钮出现')
|
||||
await page.waitForTimeout(500)
|
||||
|
||||
await page.evaluate(() => {
|
||||
const $mark = document.querySelector("body > div.absolute.inset-0")
|
||||
if ($mark) $mark.remove()
|
||||
})
|
||||
|
||||
log('开始点击升级plus按钮')
|
||||
await page.click('.gold-new-button')
|
||||
|
||||
|
@ -2,6 +2,8 @@ import { ipcMain } from 'electron'
|
||||
import { getLink } from './getLink'
|
||||
import { validate } from './validate'
|
||||
import { batchApplication } from './batchApplication'
|
||||
import { chunk } from 'lodash'
|
||||
import { sleep } from '../tools'
|
||||
|
||||
const parseAccount = text => text.split('\n').filter(Boolean).map(v => {
|
||||
v = v.split(/(——|-)+/).filter(v => !['-', '——'].includes(v))
|
||||
@ -10,18 +12,22 @@ const parseAccount = text => text.split('\n').filter(Boolean).map(v => {
|
||||
|
||||
ipcMain.handle('gpt-link', async (event, arg) => {
|
||||
const { text } = arg
|
||||
const accounts = parseAccount(text)
|
||||
// 进程数
|
||||
const processNum = 2
|
||||
const totalArr = parseAccount(text)
|
||||
const accounts = chunk(totalArr, Math.ceil(totalArr.length / processNum))
|
||||
|
||||
async function run (accounts) {
|
||||
for(let i = 0; i < accounts.length; i++) {
|
||||
const [user, pass] = accounts[i]
|
||||
const link = await getLink({ user, pass, index: i, id: user, ...arg })
|
||||
console.log('process', i, user, link)
|
||||
}
|
||||
}
|
||||
const links = []
|
||||
for(let i = 0; i < accounts.length; i++) {
|
||||
const [user, pass] = accounts[i]
|
||||
const link = await getLink({ user, pass, index: i, id: user, ...arg })
|
||||
links.push({
|
||||
i,
|
||||
user,
|
||||
link
|
||||
})
|
||||
console.log('process', i, user, link)
|
||||
if (i !== 0) await sleep(2000)
|
||||
run(accounts[i])
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -326,7 +326,7 @@ const login = {
|
||||
|
||||
// log('准备进入 google 登录页')
|
||||
const [response] = await Promise.all([
|
||||
page.waitForNavigation({ timeout: 10000 }),
|
||||
page.waitForNavigation({ timeout: 0 }),
|
||||
page.click('button')
|
||||
])
|
||||
// log('已进入 google 登录页')
|
||||
@ -340,7 +340,7 @@ const login = {
|
||||
log('准备输入账号')
|
||||
await page.type('#username', env.GUSER)
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.waitForNavigation({ timeout: 0 }),
|
||||
page.keyboard.press('Enter')
|
||||
])
|
||||
|
||||
|
@ -60,11 +60,11 @@ export async function link_7day(options) {
|
||||
|
||||
async function test() {
|
||||
const url = 'https://checkout.stripe.com/c/pay/cs_live_a1MXhrEYuI3qJEjw85zmuIxjFsgswafv0xlcxUGAOIeyiGJBGLA56mvRto#fidkdWxOYHwnPyd1blppbHNgWjxITDJsdEROY3Y1NjZpNTc8Q1RMU3ZTNicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl'
|
||||
const liao = {"bank":"4833160230060672","cvc":"04/26","date":"722","name":"Zackary Wais","address":"1200LakeshoreaveApt8G","city":"Oakland","postalCode":"94606","nation":"US"}
|
||||
const liao = {"bank":"4833160230060672","cvc":"727","date":"04/26","name":"Zackary Wais","address":"1200LakeshoreaveApt8G","city":"Oakland","postalCode":"94606","nation":"US"}
|
||||
const user = 'neletegcongder@mail.com'
|
||||
|
||||
const { page, browser } = await browserAndPage()
|
||||
await page.goto(url)
|
||||
await page.goto(url, { waitUntil: 'domcontentloaded' })
|
||||
await recharge({ browser, page, user, liao })
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
"axios": "^1.4.0",
|
||||
"chrome-launcher": "^0.15.2",
|
||||
"fake-useragent": "^1.0.1",
|
||||
"lodash": "^4.17.21",
|
||||
"mockjs": "^1.1.0",
|
||||
"naive-ui": "^2.34.4",
|
||||
"proxy-chain": "^2.3.0",
|
||||
|
149
src/App.vue
149
src/App.vue
@ -2,21 +2,31 @@
|
||||
import { ipcRenderer } from 'electron'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { useClipboard, useLocalStorage } from '@vueuse/core'
|
||||
import Business from './Business.vue'
|
||||
|
||||
const input = useLocalStorage('accountInput', 'pollcribracacom@mail.com-----XAxeEgy34j')
|
||||
// const input = ref('126vdsjmgyanpgqrvb@ddmvp.icu----EOJ2NgPfS')
|
||||
// const input = ref('traceetakashi6274@gmail.com----kedaraditi0214----kedaraditi4760@hotmail.com')
|
||||
|
||||
const accountArr = computed(() => {
|
||||
const text = input.value.split('\n').filter(Boolean).map(v => {
|
||||
return v.split(/(——|-)+/).filter(v => !['-', '——'].includes(v))
|
||||
})
|
||||
return text
|
||||
})
|
||||
|
||||
const result = ref('')
|
||||
const liao = useLocalStorage('result', '')
|
||||
|
||||
const list = ref<any[]>([])
|
||||
const localLis = useLocalStorage('list', list)
|
||||
list.value = localLis.value
|
||||
const list = useLocalStorage('list', [] as any[])
|
||||
const listInstock = ref([] as any[])
|
||||
listInstock.value = list.value.filter(v => v.instock === true)
|
||||
|
||||
const filterInput = ref('')
|
||||
|
||||
const renderList = computed(() => {
|
||||
// 成功的排在前面
|
||||
return list.value.sort((a, b) => {
|
||||
let data = list.value.sort((a, b) => {
|
||||
if (a.type === 'success' && b.type !== 'success') {
|
||||
return -1
|
||||
} else if (a.type !== 'success' && b.type === 'success') {
|
||||
@ -24,9 +34,51 @@ const renderList = computed(() => {
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}).filter(v => v.instock !== true)
|
||||
|
||||
if (filterInput.value) {
|
||||
data = data.filter(v => {
|
||||
return v.user.startsWith(filterInput.value)
|
||||
})
|
||||
}
|
||||
|
||||
return data
|
||||
})
|
||||
|
||||
|
||||
const remainingData = computed(() => {
|
||||
return accountArr.value.filter((item, i) => {
|
||||
const user = item[0]
|
||||
const target = list.value.find((v) => v.user === user)
|
||||
if (target && target.type === 'success') {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
})
|
||||
|
||||
function copyRemaining() {
|
||||
const text = remainingData.value.map(v => `${v[0]}----${v[1]}`).join('\n')
|
||||
copyText(text)
|
||||
}
|
||||
|
||||
const remainingColumns = [{
|
||||
title: '序列',
|
||||
render: (row, index) => h('span', undefined, index + 1),
|
||||
width: 60
|
||||
},
|
||||
{
|
||||
title: '邮箱',
|
||||
key: '0',
|
||||
width: 300
|
||||
},
|
||||
{
|
||||
title: '密码',
|
||||
key: '1',
|
||||
width: 220
|
||||
},
|
||||
]
|
||||
|
||||
ipcRenderer.on('progress', (event, args) => {
|
||||
const { user } = args
|
||||
const target = list.value.find((item) => item.user === user)
|
||||
@ -85,7 +137,7 @@ function gptResultHandler() {
|
||||
}
|
||||
|
||||
const listSuccess = computed(() => {
|
||||
return list.value.filter((item) => item.type === 'success')
|
||||
return list.value.filter((item) => item.instock !== true && item.type === 'success')
|
||||
})
|
||||
|
||||
function copyAllSuccess() {
|
||||
@ -103,8 +155,7 @@ function copyFailHandler() {
|
||||
}
|
||||
|
||||
function clearLocalHandler() {
|
||||
list.value = []
|
||||
localLis.value = []
|
||||
list.value = list.value.filter(v => v.instock === true)
|
||||
}
|
||||
|
||||
const { copy } = useClipboard()
|
||||
@ -124,6 +175,8 @@ function applicationResult() {
|
||||
ipcRenderer.invoke('gpt-batch-4.0-result', { text: input.value })
|
||||
}
|
||||
|
||||
const showBusiness = ref(false)
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '序列',
|
||||
@ -173,6 +226,12 @@ const columns = [
|
||||
? <NButton text type="primary" onClick={() => copyText(`${row.user}\n${row.result}`)}>复制链接</NButton>
|
||||
: null
|
||||
}
|
||||
|
||||
{row.type === 'success'
|
||||
? <NButton text type="primary" onClick={() => row.instock = true}>标记入库</NButton>
|
||||
: null
|
||||
}
|
||||
|
||||
{row.ident === 'poe-link' && row.type !== 'success' && !row.loading
|
||||
? <NButton text type="primary" onClick={() => getLink(`${row.user}----${row.pass}----${row.auxiliary}`)}>再次提链</NButton>
|
||||
: null
|
||||
@ -190,13 +249,52 @@ const columns = [
|
||||
}
|
||||
]
|
||||
|
||||
function getLiao() {
|
||||
let liaoObj
|
||||
const liaoColumns = [
|
||||
{
|
||||
key: 'bank',
|
||||
title: '银行'
|
||||
},
|
||||
{
|
||||
key: 'cvc',
|
||||
title: 'cvc'
|
||||
},
|
||||
{
|
||||
key: 'date',
|
||||
title: '日期'
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
title: '名字'
|
||||
},
|
||||
{
|
||||
key: 'address',
|
||||
title: '地址'
|
||||
},
|
||||
{
|
||||
key: 'city',
|
||||
title: '城市'
|
||||
},
|
||||
{
|
||||
key: 'postalCode',
|
||||
title: '邮政编码'
|
||||
},
|
||||
{
|
||||
key: 'nation',
|
||||
title: '国家'
|
||||
}
|
||||
]
|
||||
|
||||
const liaoData = computed(() => {
|
||||
if (liao.value) {
|
||||
const [_1, bank, cvc, cardExpiry, name, address, city, _2, postalCode, nation] = liao.value.split('|').map(v => v.trim())
|
||||
liaoObj = { bank, cvc, date: cardExpiry, name, address, city, postalCode, nation }
|
||||
copy(JSON.stringify(liaoObj))
|
||||
return { bank, cvc, date: cardExpiry, name, address, city, postalCode, nation }
|
||||
}
|
||||
return {}
|
||||
})
|
||||
|
||||
function getLiao() {
|
||||
let liaoObj = liaoData.value
|
||||
copy(JSON.stringify(liaoObj))
|
||||
return liaoObj
|
||||
}
|
||||
|
||||
@ -217,14 +315,16 @@ function handler(proxyType, name) {
|
||||
<template>
|
||||
<div>
|
||||
<div class="left" flex-1>
|
||||
<p>帐密</p>
|
||||
<p>帐密: {{ accountArr.length }}</p>
|
||||
<textarea class="textarea w-full min-w-100 max-w-94vw" v-model="input" rows="20" />
|
||||
|
||||
<p>liao:</p>
|
||||
<NSpace>
|
||||
<NInput class="textarea w-full min-w-100 max-w-94vw" v-model:value="liao" />
|
||||
<div flex items-center>
|
||||
<p>liao:</p>
|
||||
<NInput class="textarea w-full min-w-100 max-w-94vw flex-1 mr-3" v-model:value="liao" />
|
||||
<NButton @click="getLiao">复制</NButton>
|
||||
</NSpace>
|
||||
</div>
|
||||
|
||||
<NDataTable v-if="liaoData.bank" :data="[liaoData]" :scroll-x="1000" :columns="liaoColumns" />
|
||||
|
||||
<div>
|
||||
<div flex gap-3 mt-3 items-center>
|
||||
@ -259,14 +359,21 @@ function handler(proxyType, name) {
|
||||
<n-button type="primary" dashed @click="copyAllSuccess">复制全部成功 {{ listSuccess.length }}个</n-button>
|
||||
<n-button type="error" dashed @click="copyFailHandler">复制全部失败 {{ listFail.length }}个</n-button>
|
||||
<n-button type="error" dashed @dblclick="clearLocalHandler">清除记录(双击)</n-button>
|
||||
</n-space>
|
||||
<NDataTable :data="list" :columns="columns" :scroll-x="1000">
|
||||
</NDataTable>
|
||||
<n-button type="info" dashed @click="showBusiness = true">库存</n-button>
|
||||
|
||||
<div w-full h-40></div>
|
||||
<n-input v-model:value="filterInput" clearable />
|
||||
</n-space>
|
||||
<NDataTable :data="renderList" :columns="columns" :scroll-x="1000" />
|
||||
</div>
|
||||
|
||||
<pre>{{ renderList }}</pre>
|
||||
<div flex items-center gap-4>
|
||||
<p>剩余:{{ remainingData.length }}</p>
|
||||
<NButton type="primary" @click="copyRemaining">复制</NButton>
|
||||
</div>
|
||||
<NDataTable :data="remainingData" :columns="remainingColumns"></NDataTable>
|
||||
|
||||
<Business v-if="showBusiness" @close="showBusiness = false" :data="list"/>
|
||||
<div h-10></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
108
src/Business.vue
Normal file
108
src/Business.vue
Normal file
@ -0,0 +1,108 @@
|
||||
<script lang="tsx" setup>
|
||||
import { useLocalStorage } from '@vueuse/core';
|
||||
|
||||
const emits = defineEmits(['close'])
|
||||
const { data } = defineProps<{
|
||||
data: any[]
|
||||
}>()
|
||||
|
||||
const show = ref(true)
|
||||
|
||||
watch(show, () => {
|
||||
if (!show.value) emits('close')
|
||||
})
|
||||
|
||||
const key = useLocalStorage('modal_ident', '')
|
||||
const keys = computed(() => {
|
||||
return data.map((item) => item.ident)
|
||||
})
|
||||
const input = ref('')
|
||||
|
||||
const list = computed(() => {
|
||||
// 未卖
|
||||
const unsold = data.filter((item) => {
|
||||
return item.sold !== true
|
||||
}).sort((a, b) => b.soldTime - a.soldTime)
|
||||
// 已卖
|
||||
const sold = data.filter((item) => {
|
||||
return item.sold === true
|
||||
}).sort((a, b) => b.soldTime - a.soldTime)
|
||||
const newData = [...unsold, ...sold]
|
||||
|
||||
return newData.filter((item) => {
|
||||
return item.instock === true && item.ident === key.value && (input.value ? item.user.startsWith(input.value) : true)
|
||||
})
|
||||
})
|
||||
|
||||
// 标记已卖
|
||||
function handleMarkSold(row) {
|
||||
row.sold = true
|
||||
row.soldTime = Date.now()
|
||||
}
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '序列',
|
||||
render: (row, index) => h('span', undefined, index + 1),
|
||||
width: 60
|
||||
},
|
||||
{
|
||||
title: '邮箱',
|
||||
key: 'user',
|
||||
width: 220,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
key: 'info',
|
||||
width: 80,
|
||||
render: (row) => {
|
||||
return <n-space>
|
||||
{row.sold === true
|
||||
? <n-tag type="info">已卖</n-tag>
|
||||
: <n-tag type="success">未卖</n-tag>
|
||||
}
|
||||
</n-space>
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '结果',
|
||||
key: 'result',
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'right',
|
||||
render: (row: any) => {
|
||||
return <n-space>
|
||||
{row.sold !== true
|
||||
? <n-button text type="primary" onClick={() => handleMarkSold(row)}>标记已卖</n-button>
|
||||
: null
|
||||
}
|
||||
</n-space>
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NModal v-model:show="show">
|
||||
<n-card class="w-90%! max-w-1000px!" title="库存" :bordered="false" size="huge" role="dialog" aria-modal="true">
|
||||
<n-input placeholder="搜索邮箱" v-model:value="input" />
|
||||
<n-tabs type="line" animated v-model:value="key">
|
||||
<n-tab-pane v-for="(item, index) in keys" :key="index" :name="item" />
|
||||
</n-tabs>
|
||||
|
||||
<NDataTable :data="list" :columns="columns" :scroll-x="1000"></NDataTable>
|
||||
<template #header-extra>
|
||||
<span px-3 class="cursor-pointer" @click="emits('close')">X</span>
|
||||
</template>
|
||||
<!-- <pre>{{ data }}</pre> -->
|
||||
</n-card>
|
||||
</NModal>
|
||||
</template>
|
5
src/components.d.ts
vendored
5
src/components.d.ts
vendored
@ -11,10 +11,15 @@ declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
|
||||
NButton: typeof import('naive-ui')['NButton']
|
||||
NCard: typeof import('naive-ui')['NCard']
|
||||
NDataTable: typeof import('naive-ui')['NDataTable']
|
||||
NDropdown: typeof import('naive-ui')['NDropdown']
|
||||
NInput: typeof import('naive-ui')['NInput']
|
||||
NModal: typeof import('naive-ui')['NModal']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTabPane: typeof import('naive-ui')['NTabPane']
|
||||
NTabs: typeof import('naive-ui')['NTabs']
|
||||
NTag: typeof import('naive-ui')['NTag']
|
||||
TheButton: typeof import('./components/TheButton.vue')['default']
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user