api_func_auth.go 648 B

12345678910111213141516171819202122232425262728
  1. package route
  2. import (
  3. "opennamu/route/tool"
  4. jsoniter "github.com/json-iterator/go"
  5. )
  6. func Api_func_auth(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. auth_name := tool.Get_user_auth(db, other_set["ip"])
  13. auth_info := tool.Get_auth_group_info(db, auth_name)
  14. return_data := make(map[string]interface{})
  15. return_data["response"] = "ok"
  16. return_data["name"] = auth_name
  17. return_data["info"] = auth_info
  18. json_data, _ := json.Marshal(return_data)
  19. return string(json_data)
  20. }