api_func_acl.go 604 B

12345678910111213141516171819202122232425
  1. package route
  2. import (
  3. "opennamu/route/tool"
  4. )
  5. func Api_func_acl(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. new_data := make(map[string]any)
  15. new_data["response"] = "ok"
  16. new_data["data"] = tool.Check_acl(db, other_set["name"], other_set["topic_number"], other_set["tool"], ip)
  17. json_data, _ := json.Marshal(new_data)
  18. return string(json_data)
  19. }