荣耀坪山闸机远控app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

59 lines
1.3 KiB

  1. package main
  2. import (
  3. "log"
  4. "net/http"
  5. "rh1/utils"
  6. "rh1/route"
  7. "strconv"
  8. "fmt"
  9. )
  10. func main() {
  11. //utils.WriteStructDataToJsonFile();
  12. config := utils.DeserializeJson2()
  13. //utils.UpdateUserData(utils.Userdata{Name:"admin1", Pwd:"123456"})
  14. http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("./template/assets"))))
  15. http.HandleFunc("/login", route.Login)
  16. http.HandleFunc("/changePwd", route.ChangePwd)
  17. http.HandleFunc("/", route.Index)
  18. http.HandleFunc("/index", route.Index)
  19. http.HandleFunc("/handleAct", route.RemoteHandle)
  20. http.HandleFunc("/devList", route.DevList)
  21. /*origData := "hello" // 待加密的数据
  22. log.Println("原文:", string(origData))
  23. now := time.Now()
  24. log.Println(now)
  25. kk := now.Format("20060102")
  26. log.Println(kk)
  27. log.Println("------------------ECB模式 --------------------")
  28. encrypted2 := aes.EncryptDES_ECB(origData, kk)
  29. log.Println("密文(hex):", encrypted2)
  30. log.Println("密文(base64):", base64.StdEncoding.EncodeToString([]byte(encrypted2)))
  31. decrypted2 := aes.DecryptDES_ECB(encrypted2, kk)
  32. log.Println("解密结果:", string(decrypted2))*/
  33. err := http.ListenAndServe(":"+strconv.Itoa(config.Port), nil)
  34. if err != nil {
  35. log.Fatal(err)
  36. }
  37. fmt.Printf("start successful. Port: %d", config.Port)
  38. }