2
0

api_func_level.go 560 B

123456789101112131415161718192021222324252627
  1. package route
  2. import (
  3. "opennamu/route/tool"
  4. )
  5. func Api_func_level(config tool.Config) string {
  6. db := tool.DB_connect()
  7. defer tool.DB_close(db)
  8. other_set := map[string]string{}
  9. json.Unmarshal([]byte(config.Other_set), &other_set)
  10. ip := config.IP
  11. if _, exist := other_set["ip"]; exist {
  12. ip = other_set["ip"]
  13. }
  14. level := tool.Get_level(db, ip)
  15. new_data := make(map[string]any)
  16. new_data["response"] = "ok"
  17. new_data["data"] = level
  18. json_data, _ := json.Marshal(new_data)
  19. return string(json_data)
  20. }