2025-04-11 12:15:45 +00:00
|
|
|
|
package bus_models
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"go-admin/app/admin/models"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
AESKey = "3ca176c2d9d0273695f48c55c3170e32d204e125ac06c050c94e0fcec01679ed"
|
|
|
|
|
ShowCount = 100 // 前端展示手机号数量
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type SmsTask struct {
|
|
|
|
|
models.Model
|
|
|
|
|
|
2025-04-18 10:08:14 +00:00
|
|
|
|
CooperativeNumber string `gorm:"column:cooperative_number"` // 合作商编号
|
|
|
|
|
CooperativeName string `gorm:"column:cooperative_name"` // 合作商名称
|
|
|
|
|
BatchID string `gorm:"column:batch_id"` // 批次ID
|
|
|
|
|
ImportID string `gorm:"column:import_id"` // 导入记录ID(UUID,可为空)
|
|
|
|
|
SmsContent string `gorm:"column:sms_content"` // 短信内容
|
|
|
|
|
SmsContentCost int `gorm:"column:sms_content_cost"` // 短信内容消耗条数
|
|
|
|
|
TotalPhoneCount int `gorm:"column:total_phone_count"` // 手机号总数
|
|
|
|
|
TotalSmsCount int `gorm:"column:total_sms_count"` // 短信计费条数(条数 * 手机数)
|
|
|
|
|
Status int `gorm:"column:status"` // 任务状态(0待发送 1发送中 2已完成 3失败 4取消)
|
|
|
|
|
InterceptFailCount int `gorm:"column:intercept_fail_count"` // 拦截失败数量
|
|
|
|
|
ChannelFailCount int `gorm:"column:channel_fail_count"` // 通道失败数量
|
|
|
|
|
ScheduleTime *time.Time `gorm:"schedule_time"` // 计划发送时间(定时时间)
|
2025-04-11 12:15:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsTaskBatch struct {
|
|
|
|
|
models.Model
|
|
|
|
|
|
2025-04-18 10:08:14 +00:00
|
|
|
|
TaskID uint64 `gorm:"column:task_id"` // 关联任务ID
|
|
|
|
|
BatchID string `gorm:"column:batch_id"` // 批次ID
|
|
|
|
|
CooperativeNumber string `gorm:"column:cooperative_number"` // 合作商编号
|
|
|
|
|
CooperativeName string `gorm:"column:cooperative_name"` // 合作商名称
|
|
|
|
|
ImportID string `gorm:"column:import_id"` // 导入记录ID(UUID,可为空)
|
|
|
|
|
Num int `gorm:"column:num"` // 本次批次编号
|
|
|
|
|
PhoneCount int `gorm:"column:phone_count"` // 本批手机号数量
|
|
|
|
|
SmsCount int `gorm:"column:sms_count"` // 本批短信条数
|
|
|
|
|
SmsContent string `gorm:"column:sms_content"` // 短信内容
|
|
|
|
|
Status int `gorm:"column:status"` // 状态(0待发 1发送中 2已完成 3失败 4取消)
|
|
|
|
|
InterceptFailCount int `gorm:"column:intercept_fail_count"` // 拦截失败数量
|
|
|
|
|
ChannelFailCount int `gorm:"column:channel_fail_count"` // 通道发送失败数量
|
|
|
|
|
ScheduleTime *time.Time `gorm:"schedule_time"` // 计划发送时间(定时时间)
|
2025-04-11 12:15:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsSendRecord struct {
|
|
|
|
|
models.Model
|
|
|
|
|
|
2025-04-18 10:08:14 +00:00
|
|
|
|
TaskID uint64 `gorm:"column:task_id"` // 任务ID
|
|
|
|
|
TaskBatchID uint64 `gorm:"column:task_batch_id"` // 批次任务ID
|
|
|
|
|
BatchID string `gorm:"column:batch_id"` // 批次ID
|
|
|
|
|
CooperativeNumber string `gorm:"column:cooperative_number"` // 合作商编号
|
|
|
|
|
CooperativeName string `gorm:"column:cooperative_name"` // 合作商名称
|
|
|
|
|
Phone string `gorm:"column:phone"` // 手机号码
|
|
|
|
|
SmsContent string `gorm:"column:sms_content"` // 发送内容
|
|
|
|
|
ReceiveTime *time.Time `gorm:"column:receive_time"` // 回执时间
|
|
|
|
|
Status int `gorm:"column:status"` // 任务状态(1 已发送 2 发送失败)
|
|
|
|
|
SmsCode string `gorm:"column:sms_code"` // 发送状态码
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SensitiveWord 敏感词
|
|
|
|
|
type SensitiveWord struct {
|
|
|
|
|
models.Model
|
|
|
|
|
|
|
|
|
|
Word string `json:"word" gorm:"not null;uniqueIndex:uq_word;column:word;comment:敏感词"`
|
|
|
|
|
Category string `json:"category,omitempty" gorm:"column:category;comment:分类"` // Category can be optional.
|
|
|
|
|
Description string `json:"description,omitempty" gorm:"column:description;comment:描述"` // Description can be optional.
|
|
|
|
|
IsEnabled bool `json:"is_enabled" gorm:"default:1;column:is_enabled;comment:是否启用"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsUplinkLog struct {
|
|
|
|
|
models.Model
|
|
|
|
|
|
|
|
|
|
PhoneNumber string `gorm:"column:phone_number;type:varchar(20);not null" json:"phone_number"` // 手机号
|
|
|
|
|
ReplyContent string `gorm:"column:reply_content;type:text;not null" json:"reply_content"` // 回复内容
|
|
|
|
|
BatchID string `gorm:"column:batch_id;type:varchar(64);not null" json:"batch_id"` // 下行短信批次 ID
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsSignatureRealname struct {
|
|
|
|
|
models.Model
|
|
|
|
|
|
|
|
|
|
CooperativeNumber string `gorm:"column:cooperative_number"` // 合作商编号
|
|
|
|
|
CooperativeName string `gorm:"column:cooperative_name"` // 合作商名称
|
|
|
|
|
Signature string `json:"signature"` // 签名
|
|
|
|
|
SignatureSource string `json:"signature_source"` // 签名来源
|
|
|
|
|
CompanyName string `json:"company_name"` // 企业名称
|
|
|
|
|
CompanyCreditCode string `json:"company_credit_code"` // 企业信用代码
|
|
|
|
|
ResponsibleName string `json:"responsible_name"` // 责任人名称
|
|
|
|
|
ResponsibleIDType int `json:"responsible_id_type"` // 责任人证件类型
|
|
|
|
|
ResponsibleIDNumber string `json:"responsible_id_number"` // 责任人证件号
|
|
|
|
|
BusinessType int `json:"business_type"` // 业务类型
|
|
|
|
|
UsageCategory int `json:"usage_category"` // 用途类别
|
|
|
|
|
UsageDetail string `json:"usage_detail"` // 具体用途
|
|
|
|
|
AgentName string `json:"agent_name"` // 经办人名称
|
|
|
|
|
AgentIDType int `json:"agent_id_type"` // 经办人证件类型
|
|
|
|
|
AgentIDNumber string `json:"agent_id_number"` // 经办人证件号
|
|
|
|
|
SmsTemplate string `json:"sms_template"` // 短信模板
|
|
|
|
|
IsActive int `json:"is_active"` // 是否有效(0 无效;1 有效)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SmsContact 通讯录
|
|
|
|
|
type SmsContact struct {
|
|
|
|
|
models.Model
|
|
|
|
|
|
|
|
|
|
CooperativeNumber string `gorm:"column:cooperative_number"` // 合作商编号
|
|
|
|
|
CooperativeName string `gorm:"column:cooperative_name"` // 合作商名称
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
PhoneNumber string `json:"phone_number"`
|
|
|
|
|
Gender string `json:"gender"`
|
|
|
|
|
Birthday *time.Time `json:"birthday"`
|
|
|
|
|
Company string `json:"company"`
|
|
|
|
|
Address string `json:"address"`
|
|
|
|
|
Remark string `json:"remark"`
|
2025-04-11 12:15:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type MassImportPhoneResp struct {
|
|
|
|
|
List []string `json:"list"` // 加密后的数据
|
|
|
|
|
ImportSerialNumber string `json:"import_serial_number"` // 导入excel返回的编号
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SendSmsReq struct {
|
2025-04-18 10:08:14 +00:00
|
|
|
|
Data string `json:"data"` // 加密数据
|
2025-04-11 12:15:45 +00:00
|
|
|
|
PhoneList []string `json:"phone_list"` // 手机号码列表
|
|
|
|
|
ImportSerialNumber string `json:"import_serial_number"` // 导入excel返回的编号
|
|
|
|
|
SmsContent string `json:"sms_content"` // 短信内容
|
2025-04-18 10:08:14 +00:00
|
|
|
|
SendTime string `json:"send_time"` // 发送时间(定时设置)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ExportMessPhoneReq struct {
|
|
|
|
|
Data string `json:"data"` // 加密数据
|
|
|
|
|
PhoneList []string `json:"phone_list"` // 手机号码列表
|
|
|
|
|
ImportSerialNumber string `json:"import_serial_number"` // 导入excel返回的编号
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ExportMessPhoneResp struct {
|
|
|
|
|
ExportUrl string `json:"export_url"` // 下载链接
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type CheckSensitiveWordsReq struct {
|
|
|
|
|
Content string `json:"content" binding:"required"` // 短信内容
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type CheckSensitiveWordsResponse struct {
|
|
|
|
|
HasSensitiveWords bool `json:"has_sensitive_words"` // 是否检测到敏感词:true 检测到; false 未检测到
|
|
|
|
|
SensitiveWords []string `json:"sensitive_words"` // 敏感词
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SmsTaskQueryRequest 请求参数结构体(带分页)
|
|
|
|
|
type SmsTaskQueryRequest struct {
|
|
|
|
|
BatchID string `json:"batch_id"` // 批次ID
|
|
|
|
|
StartTime string `json:"start_time"` // 格式:2006-01-02 15:04:05
|
|
|
|
|
EndTime string `json:"end_time"` // 格式:2006-01-02 15:04:05
|
|
|
|
|
MinTotalSms int `json:"min_total_sms"` // 最小短信计费条数
|
|
|
|
|
MinPhoneCount int `json:"min_phone_count"` // 最小手机号总数
|
|
|
|
|
Status *int `json:"status"` // 状态(可选)
|
|
|
|
|
Page int `json:"page"` // 页码,从 1 开始
|
|
|
|
|
PageSize int `json:"page_size"` // 每页条数
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SmsTaskQueryResponse 响应结构体(带分页)
|
|
|
|
|
type SmsTaskQueryResponse struct {
|
|
|
|
|
List []SmsTask `json:"list"` // 数据列表
|
|
|
|
|
Total int64 `json:"total"` // 总条数
|
|
|
|
|
Page int `json:"page"` // 当前页码
|
|
|
|
|
PageSize int `json:"page_size"` // 每页条数
|
|
|
|
|
TotalPage int `json:"total_page"` // 总页数
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsSendRecordQueryReq struct {
|
|
|
|
|
BatchID string `json:"batch_id"`
|
|
|
|
|
Phone string `json:"phone"`
|
|
|
|
|
StartTime string `json:"start_time"`
|
|
|
|
|
EndTime string `json:"end_time"`
|
|
|
|
|
MinSegments int `json:"min_segments"`
|
|
|
|
|
SmsCode string `json:"sms_code"`
|
|
|
|
|
Page int `json:"page"` // 页码,从 1 开始
|
|
|
|
|
PageSize int `json:"page_size"` // 每页条数
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsSendRecordQueryResp struct {
|
|
|
|
|
List []SmsSendRecord `json:"list"`
|
|
|
|
|
Total int64 `json:"total"` // 总条数
|
|
|
|
|
Page int `json:"page"` // 当前页码
|
|
|
|
|
PageSize int `json:"page_size"` // 每页条数
|
|
|
|
|
TotalPage int `json:"total_page"` // 总页数
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetPhonesByBatchIDReq 请求结构体
|
|
|
|
|
type GetPhonesByBatchIDReq struct {
|
|
|
|
|
BatchID string `json:"batch_id" binding:"required"` // 批次ID
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetPhonesByBatchIDResp 响应结构体
|
|
|
|
|
type GetPhonesByBatchIDResp struct {
|
|
|
|
|
Phones []string `json:"phones"` // 手机号列表
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsTaskScheduledQueryRequest struct {
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
StartTime string `json:"start_time"` // 查询开始时间(schedule_time)
|
|
|
|
|
EndTime string `json:"end_time"` // 查询结束时间(schedule_time)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsUplinkQueryRequest struct {
|
|
|
|
|
PhoneNumber string `json:"phone_number"` // 手机号
|
|
|
|
|
SendID uint64 `json:"send_id"` // 下行ID
|
|
|
|
|
UplinkID uint64 `json:"uplink_id"` // 上行ID
|
|
|
|
|
ReplyContent string `json:"reply_content"` // 回复内容关键字
|
|
|
|
|
StartTime string `json:"start_time"` // 接收开始时间
|
|
|
|
|
EndTime string `json:"end_time"` // 接收结束时间
|
|
|
|
|
Page int `json:"page"` // 分页页码
|
|
|
|
|
PageSize int `json:"page_size"` // 每页数量
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsUplinkRecordResponse struct {
|
|
|
|
|
UplinkID uint64 `json:"uplink_id"` // 上行ID
|
|
|
|
|
PhoneNumber string `json:"phone_number"` // 手机号
|
|
|
|
|
SendID uint64 `json:"send_id"` // 下行发送记录ID
|
|
|
|
|
SmsContent string `json:"sms_content"` // 下行发送内容
|
|
|
|
|
ReplyContent string `json:"reply_content"` // 上行回复内容
|
|
|
|
|
ReceiveTime time.Time `json:"receive_time"` // 上行接收时间
|
|
|
|
|
SendTime time.Time `json:"send_time"` // 下行发送时间
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SmsUplinkQueryResponse struct {
|
|
|
|
|
List []SmsUplinkRecordResponse `json:"list"`
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
TotalPage int64 `json:"total_page"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// BatchUpdateSmsContentRequest 批量修改短信内容请求
|
|
|
|
|
type BatchUpdateSmsContentRequest struct {
|
|
|
|
|
TaskIDs []uint64 `json:"task_ids"` // 任务ID列表
|
|
|
|
|
SmsContent string `json:"sms_content"` // 新的短信内容
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type BatchUpdateRequest struct {
|
|
|
|
|
TaskIDs []uint64 `json:"task_ids"` // 任务ID列表
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type BatchResetScheduleTimeRequest struct {
|
|
|
|
|
TaskIDs []uint64 `json:"task_ids"` // 任务ID列表
|
|
|
|
|
ScheduleTime string `json:"schedule_time"` // 新定时时间
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DeleteSignatureRealnameRequest struct {
|
|
|
|
|
IDs []uint `json:"ids" binding:"required"` // 要删除的记录ID列表
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SignatureRealnameQuery struct {
|
|
|
|
|
Signature string `json:"signature"`
|
|
|
|
|
CooperativeName string `json:"cooperative_name"`
|
|
|
|
|
CompanyName string `json:"company_name"`
|
|
|
|
|
CompanyCreditCode string `json:"company_credit_code"`
|
|
|
|
|
ResponsibleName string `json:"responsible_name"`
|
|
|
|
|
UsageCategory int `json:"usage_category"`
|
|
|
|
|
IsActive int `json:"is_active"`
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SignatureRealnameQueryResp struct {
|
|
|
|
|
List []SmsSignatureRealname `json:"list"`
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
TotalPage int64 `json:"total_page"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ContactQuery 请求结构体
|
|
|
|
|
type ContactQuery struct {
|
|
|
|
|
Name string `form:"name"` // 模糊搜索
|
|
|
|
|
PhoneNumber string `form:"phone_number"` // 模糊搜索
|
|
|
|
|
Page int `form:"page"`
|
|
|
|
|
PageSize int `form:"page_size"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ContactQueryResp 响应结构体
|
|
|
|
|
type ContactQueryResp struct {
|
|
|
|
|
List []SmsContact `json:"list"`
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
TotalPage int64 `json:"total_page"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ContactDeleteRequest struct {
|
|
|
|
|
ContactIDs []uint `json:"contact_ids" binding:"required"` // 要删除的记录ID列表
|
2025-04-11 12:15:45 +00:00
|
|
|
|
}
|