Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchentong committed Oct 29, 2024
1 parent 5c02dbb commit 0ca7e86
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion server/api/import/index.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default defineEventHandler(async (event) => {
const document = await getDocument(new Uint8Array(binaryString)).promise

const data = await extractDataFromPDF(document, channel)

if (data.username && data.account && data.batch && data.idNumber) {
await importDBFromData(data)
}
Expand Down
4 changes: 2 additions & 2 deletions server/services/extract.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function extractUserFromAliPay(document: PDFDocumentProxy) {
const name = nameMatch ? nameMatch[1] : ''

// 提取证件号码
const idNumberMatch = content.match(/(?<=证件号码:)(\d{18})/)
const idNumberMatch = content.match(/(?<=证件号码:)(\d{18}|\d{17}[X|x])/)
const idNumber = idNumberMatch ? idNumberMatch[1] : ''

// 提取支付宝账号
Expand Down Expand Up @@ -128,7 +128,7 @@ async function extractUserFromWxPay(document: PDFDocumentProxy) {
const name = nameMatch ? nameMatch[1] : ''

// 提取证件号码
const idNumberMatch = content.match(/(?<=居民身份证:)(\d{18})/)
const idNumberMatch = content.match(/(?<=居民身份证:)(\d{18}|\d{17}[X|x])/)
const idNumber = idNumberMatch ? idNumberMatch[1] : ''

// 提取微信账号
Expand Down
4 changes: 3 additions & 1 deletion server/services/import.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@ async function createTransactions(batch: string, channel: TransactionChannelEnum
merchantNo: item.merchantNo,
batchId: batch,
})),
)
).onConflictDoNothing({
target: TransactionSchema.transactionNo,
})
}

0 comments on commit 0ca7e86

Please sign in to comment.