feat(legacy): implement hand configs api

This commit is contained in:
Eli Yip 2025-06-03 09:40:58 +08:00
parent 43070cf76b
commit 185646dbd2
No known key found for this signature in database
GPG Key ID: C98B69D4CF7D7EC5

View File

@ -36,3 +36,29 @@ func (s *LegacyServer) handleInterfaces(c *gin.Context) {
Data: responseData,
})
}
// handleHandConfigs 获取手型配置处理函数
func (s *LegacyServer) handleHandConfigs(c *gin.Context) {
allHandConfigs := s.mapper.GetAllHandConfigs()
result := make(map[string]any)
for _, ifName := range config.Config.AvailableInterfaces {
if handConfig, exists := allHandConfigs[ifName]; exists {
result[ifName] = map[string]any{
"handType": handConfig.HandType,
"handId": handConfig.HandId,
}
} else {
// 返回默认配置
result[ifName] = map[string]any{
"handType": "right",
"handId": define.HAND_TYPE_RIGHT,
}
}
}
c.JSON(http.StatusOK, define.ApiResponse{
Status: "success",
Data: result,
})
}