Files
hfb_sys/backend/internal/model/cs_manual_entry.go
T
yml2213 e027f88fbb feat(csmanualentry): 手动录单支持收号出号分组
- 录单记录新增组别(收号/出号),唯一约束放宽为编号+组别,同一编号两组各可登记一次
- 操作人选项支持组别标记,录单选中后自动带出组别
- 列表新增组别列与筛选,今日统计按收号/出号分列
2026-11-06 14:02:28 +08:00

50 lines
2.5 KiB
Go

package model
import "time"
// 录单组别取值。
const (
CSManualEntryGroupCollect = "collect" // 收号
CSManualEntryGroupSell = "sell" // 出号
)
// CSManualEntry 客服手动录单记录。
// 客服在后台手动登记一个编号(如 202610120013),该编号与其登录账号绑定,
// 记录组别(收号/出号)、平台、操作人、登记时间等,供后续查询与按客服统计今日录单量。
// 同一编号允许收号、出号两组各登记一次,唯一键为 (entry_no, entry_group)。
// platform / operator 存名称快照:后台删掉选项也不影响历史记录展示。
type CSManualEntry struct {
ID uint64 `gorm:"primaryKey" json:"id"`
EntryNo string `gorm:"size:64;not null;uniqueIndex:uk_cs_manual_entries_entry_no_group,priority:1" json:"entry_no"`
EntryGroup string `gorm:"size:16;not null;default:'collect';uniqueIndex:uk_cs_manual_entries_entry_no_group,priority:2;index" json:"entry_group"`
Platform string `gorm:"size:64;not null;default:'';index" json:"platform"`
Operator string `gorm:"size:64;not null;default:'';index" json:"operator"`
AdminID uint64 `gorm:"not null;index" json:"admin_id"`
AdminName string `gorm:"size:64;not null;default:''" json:"admin_name"`
AdminUsername string `gorm:"size:64;not null;default:''" json:"admin_username"`
Remark string `gorm:"size:255;not null;default:''" json:"remark"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (CSManualEntry) TableName() string {
return "cs_manual_entries"
}
// CSManualEntryOption 客服手动录单的可选项配置(平台 / 操作人)。
// 仅作为录单表单的下拉数据源,记录里保存的是名称快照。
// 操作人选项可通过 group_tag 标记所属组别(收号/出号),录单时用于自动带出组别。
type CSManualEntryOption struct {
ID uint64 `gorm:"primaryKey" json:"id"`
Type string `gorm:"size:16;not null;uniqueIndex:uk_cs_manual_entry_options_type_name,priority:1" json:"type"`
Name string `gorm:"size:64;not null;uniqueIndex:uk_cs_manual_entry_options_type_name,priority:2" json:"name"`
GroupTag string `gorm:"size:16;not null;default:''" json:"group_tag"`
SortOrder int `gorm:"not null;default:0" json:"sort_order"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (CSManualEntryOption) TableName() string {
return "cs_manual_entry_options"
}