fix:出版时间转时间戳,空或早于1970则传0

This commit is contained in:
97694732@qq.com 2026-06-06 11:31:45 +08:00
parent 93edb339fa
commit 571c5110ee

View File

@ -2134,6 +2134,19 @@ export default {
// //
var timestamp = String(Math.floor(Date.now() / 1000)) var timestamp = String(Math.floor(Date.now() / 1000))
// 1970-01-01 0
var pubTimeStr = this.noIsbnPrintTime || ''
var pubTimestamp = '0'
if (pubTimeStr) {
var parts = pubTimeStr.split('-')
if (parts.length >= 2) {
var d = new Date(parseInt(parts[0], 10), parseInt(parts[1], 10) - 1, 1)
var ts = Math.floor(d.getTime() / 1000)
if (ts >= 0) { pubTimestamp = String(ts) }
}
}
const params = { const params = {
app_key: 'psi', app_key: 'psi',
client_id: 'psi', client_id: 'psi',
@ -2145,7 +2158,7 @@ export default {
f_book_name: '', f_book_name: '',
author: this.noIsbnAuthor || '', author: this.noIsbnAuthor || '',
publisher: this.noIsbnPublisher || '', publisher: this.noIsbnPublisher || '',
publication_time: this.noIsbnPrintTime || '', publication_time: pubTimestamp,
binding_layout: '', binding_layout: '',
fix_price: this.noIsbnPrice ? String(Math.round(parseFloat(this.noIsbnPrice) * 100)) : '', fix_price: this.noIsbnPrice ? String(Math.round(parseFloat(this.noIsbnPrice) * 100)) : '',
page_count: '0', page_count: '0',