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

@@ -304,8 +304,12 @@ func (s *LicenseService) ExportCSV(q ListQuery) (string, error) {
// toLicenseResponse 模型转响应 DTO // Logan.Li
func toLicenseResponse(l model.License) dto.LicenseResponse {
customerName := ""
customerEmail := ""
if l.Customer.ID > 0 {
customerName = l.Customer.Name
if !strings.HasSuffix(l.Customer.Email, "@local.invalid") {
customerEmail = l.Customer.Email
}
}
productName := ""
if l.Product.ID > 0 {
@@ -332,6 +336,7 @@ func toLicenseResponse(l model.License) dto.LicenseResponse {
DeviceID: deviceID,
CustomerID: l.CustomerID,
CustomerName: customerName,
CustomerEmail: customerEmail,
ProductID: l.ProductID,
ProductName: productName,
Status: l.Status,