Add: Try to get the device ID from the request parameters

This commit is contained in:
EUForest 2025-11-08 17:05:52 +08:00
parent b7eafd0892
commit d7aa9a44b7

View File

@ -35,8 +35,11 @@ func (l *DeviceWsConnectLogic) DeviceWsConnect(c *gin.Context) error {
value := l.ctx.Value(constant.CtxKeyIdentifier) value := l.ctx.Value(constant.CtxKeyIdentifier)
if value == nil || value.(string) == "" { if value == nil || value.(string) == "" {
l.Errorf("DeviceWsConnectLogic DeviceWsConnect identifier is empty") value, _ = c.GetQuery("identifier")
return errors.Wrapf(xerr.NewErrCode(xerr.InvalidParams), "identifier is empty") if value == nil || value.(string) == "" {
l.Errorf("DeviceWsConnectLogic DeviceWsConnect identifier is empty")
return errors.Wrapf(xerr.NewErrCode(xerr.InvalidParams), "identifier is empty")
}
} }
identifier := value.(string) identifier := value.(string)
_, err := l.svcCtx.UserModel.FindOneDeviceByIdentifier(l.ctx, identifier) _, err := l.svcCtx.UserModel.FindOneDeviceByIdentifier(l.ctx, identifier)