api_func_ip_post.go 661 B

1234567891011121314151617181920212223242526272829303132333435
  1. package route
  2. import (
  3. "encoding/json"
  4. "strconv"
  5. "opennamu/route/tool"
  6. )
  7. func Api_func_ip_post(call_arg []string) string {
  8. other_set := map[string]string{}
  9. json.Unmarshal([]byte(call_arg[0]), &other_set)
  10. db := tool.DB_connect()
  11. defer db.Close()
  12. ip_data := map[string]string{}
  13. for for_a := 1; ; for_a++ {
  14. for_a_str := strconv.Itoa(for_a)
  15. if val, ok := other_set["data_"+for_a_str]; ok {
  16. ip_data[val] = tool.IP_parser(db, val, other_set["ip"])
  17. } else {
  18. break
  19. }
  20. }
  21. new_data := make(map[string]interface{})
  22. new_data["response"] = "ok"
  23. new_data["data"] = ip_data
  24. json_data, _ := json.Marshal(new_data)
  25. return string(json_data)
  26. }