Files
Logan.LiandCursor 4c46088f4f feat: 客户关联产品并支持按产品圈选通知群体
新增客户-产品多对多关联,列表可按产品筛选并复制邮箱;发证/下单自动回填历史关联。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 21:58:35 +08:00

30 lines
1.0 KiB
Go

package model
import (
"time"
"gorm.io/gorm"
)
// Customer 客户模型 // Logan.Li
type Customer struct {
ID uint `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"size:100;not null"`
Company string `json:"company" gorm:"size:200"`
Email string `json:"email" gorm:"size:100;uniqueIndex"`
Phone string `json:"phone" gorm:"size:20"`
Address string `json:"address" gorm:"size:500"`
Notes string `json:"notes" gorm:"type:text"`
Status int `json:"status" gorm:"default:1"` // 1: 启用, 0: 禁用
Licenses []License `json:"licenses,omitempty" gorm:"foreignKey:CustomerID"`
Products []Product `json:"products,omitempty" gorm:"many2many:customer_products;"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty" gorm:"index"`
}
// TableName 指定表名 // Logan.Li
func (Customer) TableName() string {
return "customers"
}