api_func_ip.go 477 B

123456789101112131415161718192021222324
  1. package route
  2. import (
  3. "encoding/json"
  4. "opennamu/route/tool"
  5. )
  6. func Api_func_ip(call_arg []string) string {
  7. other_set := map[string]string{}
  8. json.Unmarshal([]byte(call_arg[0]), &other_set)
  9. db := tool.DB_connect()
  10. defer db.Close()
  11. ip_data := tool.IP_parser(db, other_set["data"], other_set["ip"])
  12. new_data := make(map[string]interface{})
  13. new_data["response"] = "ok"
  14. new_data["data"] = ip_data
  15. json_data, _ := json.Marshal(new_data)
  16. return string(json_data)
  17. }