fix: 离线证到期重签空邮箱撞唯一索引

复用 customer_id/同名客户,禁止重复插入空 email;重签前端带回原客户。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Logan.LiandCursor committed 2026-08-12 21:49:55 +08:00
1 parent bac72e6945
commit f26e787cfc
4 files changed
+62 -24

No files matched your search

+10 -5
View File
@@ -135,7 +135,7 @@ const issueVisible = ref(false)
const issuing = ref(false)
const formRef = ref(null)
const form = reactive({
device_id: '', email: '', customer_name: '', product_code: 'opsxshell',
device_id: '', email: '', customer_name: '', customer_id: 0, product_code: 'opsxshell',
plan_type: 'yearly', duration_days: 365, notes: '',
})
const result = ref(null)
@@ -167,7 +167,7 @@ async function loadData() {
function openIssue() {
Object.assign(form, {
device_id: '', email: '', customer_name: '', product_code: 'opsxshell',
device_id: '', email: '', customer_name: '', customer_id: 0, product_code: 'opsxshell',
plan_type: 'yearly', duration_days: 365, notes: '',
})
result.value = null
@@ -177,8 +177,9 @@ function openIssue() {
function reissue(row) {
Object.assign(form, {
device_id: row.device_id || '',
email: '',
email: row.customer_email || '',
customer_name: row.customer_name || '',
customer_id: row.customer_id || 0,
product_code: 'opsxshell',
plan_type: row.is_trial ? 'trial' : 'yearly',
duration_days: row.is_trial ? 180 : 365,
@@ -193,7 +194,7 @@ async function submitIssue() {
if (!valid) return
issuing.value = true
try {
const res = await issueOfflineLicense({
const payload = {
device_id: form.device_id.trim(),
email: form.email.trim() || undefined,
customer_name: form.customer_name.trim() || undefined,
@@ -201,7 +202,11 @@ async function submitIssue() {
duration_days: form.duration_days,
notes: form.notes,
product_code: form.product_code.trim() || 'opsxshell',
})
}
if (form.customer_id > 0) {
payload.customer_id = form.customer_id
}
const res = await issueOfflineLicense(payload)
result.value = res.data
loadData()
ElMessage.success('已签发(请复制序列号;列表仅显示短码)')