You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import request from '@/utils/request.js'
import { appLog, flushLogs } from '@/utils/appLog.js'
const maskPhoneForLog = (phone) => {
const text = String(phone || '').trim()
if (!text) return ''
if (text.length < 7) return `${text.slice(0, 1)}***`
return `${text.slice(0, 3)}****${text.slice(-4)}`
}
// 实名制采集保存pad.ticket -> POST /save-cjxx
export const saveSmzcjxx = (params = {}) => {
const body = {
rxsfzBdxh: params.rxsfzBdxh,
sjhm: params.sjhm,
}
if (params.dzyx) body.dzyx = params.dzyx
if (params.lxdh) body.lxdh = params.lxdh
appLog(
'info',
'[smz] saveSmzcjxx 请求',
`rxsfzBdxh=${body.rxsfzBdxh || ''}`,
`sjhm=${maskPhoneForLog(body.sjhm)}`,
`hasDzyx=${Boolean(body.dzyx)}`,
`hasLxdh=${Boolean(body.lxdh)}`
)
flushLogs()
return request({
tag: 'pad.ticket',
path: '/save-cjxx',
method: 'POST',
body
})
.then((result) => {
appLog(
'info',
'[smz] saveSmzcjxx 返回',
`success=${result?.success}`,
`code=${result?.code}`,
`mess=${result?.mess || result?.msg || ''}`,
result
)
flushLogs()
return result
})
.catch((error) => {
appLog('error', '[smz] saveSmzcjxx 请求失败', error)
flushLogs()
throw error
})
}