2
0

api_func_auth.go 677 B

1234567891011121314151617181920212223242526272829
  1. package route
  2. import (
  3. "opennamu/route/tool"
  4. )
  5. func Api_func_auth(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. auth_name := tool.Get_user_auth(db, ip)
  15. auth_info := tool.Get_auth_group_info(db, auth_name)
  16. return_data := make(map[string]any)
  17. return_data["response"] = "ok"
  18. return_data["name"] = auth_name
  19. return_data["info"] = auth_info
  20. json_data, _ := json.Marshal(return_data)
  21. return string(json_data)
  22. }