feat: 网关只读资产改为数据表,只读资产只允许查询类调用
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m36s

- 新增 tb_gateway_readonly_card(卡 ICCID / 设备 IMEI)与开关 JUNHONG_GATEWAY_READONLY_ENABLED,
  替换环境变量名单 JUNHONG_GATEWAY_READONLY_ICCIDS
- 只读资产只放行查卡状态、查实名、查流量、查设备信息、查设备槽位、同步设备状态;
  停机、复机、限速、实名认证链接与设备写操作在网关出口本地拦截;查表失败按拦截;不缓存
- 测试环境部署开启只读模式;新增技术方案与清理顺序文档

Change: add-gateway-readonly-prod-import

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
邹进
2026-10-29 17:55:52 +09:00
parent a7428c7924
commit 5cf67b98de
19 changed files with 536 additions and 41 deletions

View File

@@ -0,0 +1,24 @@
package model
import "time"
// 网关只读资产卡号类型。
const (
GatewayReadonlyTypeICCID = "iccid"
GatewayReadonlyTypeIMEI = "imei"
)
// GatewayReadonlyCard 网关只读资产:表中的卡与设备只允许查询类网关调用。
type GatewayReadonlyCard struct {
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Identifier string `gorm:"column:identifier;type:varchar(64);not null;uniqueIndex:uk_gateway_readonly_card_identifier" json:"identifier"`
IdentifierType string `gorm:"column:identifier_type;type:varchar(16);not null" json:"identifier_type"`
Source string `gorm:"column:source;type:varchar(64);not null;default:''" json:"source"`
Remark string `gorm:"column:remark;type:varchar(255);not null;default:''" json:"remark"`
CreatedAt time.Time `gorm:"column:created_at;not null;default:now()" json:"created_at"`
}
// TableName 指定表名。
func (GatewayReadonlyCard) TableName() string {
return "tb_gateway_readonly_card"
}