提取接口添加IP与实名验证; SendSms 添加调试模式验证码发送跳过逻辑

This commit is contained in:
2025-04-21 19:01:23 +08:00
parent 806dca928f
commit 089e2b7590
4 changed files with 36 additions and 28 deletions

View File

@@ -28,6 +28,17 @@ func CreateChannel(c *fiber.Ctx) error {
if err != nil {
return err
}
// 获取用户信息
user, err := q.User.
Where(q.User.ID.Eq(authContext.Payload.Id)).
Take()
if err != nil {
return err
}
if user.IDToken == "" {
return fiber.NewError(fiber.StatusForbidden, "账号未实名")
}
count, err := q.Whitelist.Where(
q.Whitelist.UserID.Eq(authContext.Payload.Id),
q.Whitelist.Host.Eq(c.IP()),
@@ -36,7 +47,7 @@ func CreateChannel(c *fiber.Ctx) error {
return err
}
if count == 0 {
return fiber.NewError(fiber.StatusForbidden, fmt.Sprintf("forbidden %s", c.IP()))
return fiber.NewError(fiber.StatusForbidden, fmt.Sprintf("非白名单IP %s", c.IP()))
}
req := new(CreateChannelReq)