System.go 879 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package controllers
  2. import (
  3. "AIOTCOER/conf"
  4. "AIOTCOER/lib"
  5. "AIOTCOER/logs"
  6. beego "github.com/beego/beego/v2/server/web"
  7. )
  8. type SystemController struct {
  9. beego.Controller
  10. }
  11. // 列表 -
  12. func (c *SystemController) RunTime() {
  13. lib.PullHandleTime.Mu.RLock()
  14. c.Data["json"] = lib.JSONR{Code: 200, Msg: "ok!", Data: lib.PullHandleTime.Num}
  15. lib.PullHandleTime.Mu.RUnlock()
  16. c.ServeJSON()
  17. return
  18. }
  19. // 列表 -
  20. func (c *SystemController) SystemConfig() {
  21. if c.GetString("AdminTokey") != conf.Config_AdminTokey {
  22. c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "AdminTokey E!"}
  23. c.ServeJSON()
  24. return
  25. }
  26. AddProduct, err := c.GetBool("AddProduct")
  27. if err == nil {
  28. conf.Config_AddProductType = AddProduct
  29. logs.Println("Config_AddProductType",AddProduct)
  30. }
  31. c.Data["json"] = lib.JSONR{Code: 200, Msg: "ok!", Data: lib.PullHandleTime.Num}
  32. c.ServeJSON()
  33. return
  34. }