api_func_alarm_post.go 556 B

12345678910111213141516171819202122232425
  1. package route
  2. import (
  3. "opennamu/route/tool"
  4. jsoniter "github.com/json-iterator/go"
  5. )
  6. func Api_func_alarm_post(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. tool.Send_alarm(db, other_set["from"], other_set["to"], other_set["data"])
  13. return_data := make(map[string]interface{})
  14. return_data["response"] = "ok"
  15. json_data, _ := json.Marshal(return_data)
  16. return string(json_data)
  17. }