api_func_ban.go 599 B

123456789101112131415161718192021222324252627
  1. package route
  2. import (
  3. "opennamu/route/tool"
  4. jsoniter "github.com/json-iterator/go"
  5. )
  6. func Api_func_ban(call_arg []string) string {
  7. var json = jsoniter.ConfigCompatibleWithStandardLibrary
  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 := tool.Get_user_ban(db, other_set["ip"], other_set["type"])
  13. new_data := make(map[string]interface{})
  14. new_data["response"] = "ok"
  15. new_data["ban"] = ip_data[0]
  16. new_data["ban_type"] = ip_data[1]
  17. json_data, _ := json.Marshal(new_data)
  18. return string(json_data)
  19. }