UpFile.go 782 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package controllers
  2. import (
  3. "AIOTCOER/lib"
  4. "AIOTCOER/models/Product"
  5. beego "github.com/beego/beego/v2/server/web"
  6. )
  7. type UpFileController struct {
  8. beego.Controller
  9. }
  10. // 列表 -
  11. func (c *UpFileController) UpFileToken() {
  12. ProductTyper := Product.ProductType{
  13. T_ProductID:c.GetString("T_ProductID"),
  14. }
  15. if !ProductTyper.Read() {
  16. c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "ProductID E!"}
  17. c.ServeJSON()
  18. return
  19. }
  20. // 验证 T_uuid
  21. T_uuid := lib.Take_one(c.Ctx.GetCookie("T_uuid"), c.GetString("T_uuid"))
  22. if ProductTyper.T_uuid != T_uuid {
  23. c.Data["json"] = lib.JSONR{Code: lib.Error, Msg: "T_uuid!"}
  24. c.ServeJSON()
  25. return
  26. }
  27. c.Data["json"] = lib.JSONR{Code: 200, Msg: "ok!", Data: lib.UploadToken(c.GetString("T_suffix"))}
  28. c.ServeJSON()
  29. return
  30. }