refactor: remove Subject field from Conversation model and related logic, replace with CustomerName

This commit is contained in:
mlogclub
2026-04-27 19:22:40 +08:00
parent 2d2d2d2051
commit 3a9bc4914a
24 changed files with 49 additions and 64 deletions
+11
View File
@@ -1,6 +1,8 @@
package services
import (
"crypto/md5"
"encoding/hex"
"log/slog"
"cs-agent/internal/models"
@@ -154,6 +156,15 @@ func buildExternalCustomerName(externalInfo openidentity.ExternalInfo) string {
return "访客" + hashUUID(externalInfo.ExternalID)
}
func hashUUID(uuid string) string {
if uuid == "" {
return "unknown"
}
h := md5.Sum([]byte(uuid))
return hex.EncodeToString(h[:])[:8]
}
func (s *customerService) CreateCustomer(req request.CreateCustomerRequest, operator *dto.AuthPrincipal) (*models.Customer, error) {
if operator == nil {
return nil, errorsx.Unauthorized("未登录或登录已过期")