feat: 新增数据库迁移,重命名 device_no 为 virtual_no,新增 iot_card.virtual_no 和 package.virtual_ratio 字段
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m3s

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-03-14 18:27:28 +08:00
parent b5147d1acb
commit b9c3875c08
77 changed files with 5832 additions and 2393 deletions

View File

@@ -35,20 +35,6 @@ func (h *IotCardHandler) ListStandalone(c *fiber.Ctx) error {
return response.SuccessWithPagination(c, result.List, result.Total, result.Page, result.PageSize)
}
func (h *IotCardHandler) GetByICCID(c *fiber.Ctx) error {
iccid := c.Params("iccid")
if iccid == "" {
return errors.New(errors.CodeInvalidParam, "ICCID不能为空")
}
result, err := h.service.GetByICCID(c.UserContext(), iccid)
if err != nil {
return err
}
return response.Success(c, result)
}
func (h *IotCardHandler) AllocateCards(c *fiber.Ctx) error {
var req dto.AllocateStandaloneCardsRequest
if err := c.BodyParser(&req); err != nil {
@@ -126,51 +112,6 @@ func (h *IotCardHandler) BatchSetSeriesBinding(c *fiber.Ctx) error {
return response.Success(c, result)
}
// GetGatewayStatus 查询卡实时状态
func (h *IotCardHandler) GetGatewayStatus(c *fiber.Ctx) error {
iccid := c.Params("iccid")
if iccid == "" {
return errors.New(errors.CodeInvalidParam, "ICCID不能为空")
}
resp, err := h.service.GatewayQueryCardStatus(c.UserContext(), iccid)
if err != nil {
return err
}
return response.Success(c, resp)
}
// GetGatewayFlow 查询流量使用情况
func (h *IotCardHandler) GetGatewayFlow(c *fiber.Ctx) error {
iccid := c.Params("iccid")
if iccid == "" {
return errors.New(errors.CodeInvalidParam, "ICCID不能为空")
}
resp, err := h.service.GatewayQueryFlow(c.UserContext(), iccid)
if err != nil {
return err
}
return response.Success(c, resp)
}
// GetGatewayRealname 查询实名认证状态
func (h *IotCardHandler) GetGatewayRealname(c *fiber.Ctx) error {
iccid := c.Params("iccid")
if iccid == "" {
return errors.New(errors.CodeInvalidParam, "ICCID不能为空")
}
resp, err := h.service.GatewayQueryRealnameStatus(c.UserContext(), iccid)
if err != nil {
return err
}
return response.Success(c, resp)
}
// GetRealnameLink 获取实名认证链接
func (h *IotCardHandler) GetRealnameLink(c *fiber.Ctx) error {
iccid := c.Params("iccid")
@@ -185,31 +126,3 @@ func (h *IotCardHandler) GetRealnameLink(c *fiber.Ctx) error {
return response.Success(c, link)
}
// StopCard 停止卡服务
func (h *IotCardHandler) StopCard(c *fiber.Ctx) error {
iccid := c.Params("iccid")
if iccid == "" {
return errors.New(errors.CodeInvalidParam, "ICCID不能为空")
}
if err := h.service.GatewayStopCard(c.UserContext(), iccid); err != nil {
return err
}
return response.Success(c, nil)
}
// StartCard 恢复卡服务
func (h *IotCardHandler) StartCard(c *fiber.Ctx) error {
iccid := c.Params("iccid")
if iccid == "" {
return errors.New(errors.CodeInvalidParam, "ICCID不能为空")
}
if err := h.service.GatewayStartCard(c.UserContext(), iccid); err != nil {
return err
}
return response.Success(c, nil)
}