广告涉及的mq都放这里
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.
 
 
 
 
 
 

35 rivejä
665 B

  1. package mw
  2. import (
  3. "applet/app/e"
  4. "applet/app/utils"
  5. "bytes"
  6. "fmt"
  7. "github.com/gin-gonic/gin"
  8. "io/ioutil"
  9. )
  10. // CheckSign is 中间件 用来检查签名
  11. func CheckSign(c *gin.Context) {
  12. bools := utils.SignCheck(c)
  13. if bools == false {
  14. e.OutErr(c, 400, e.NewErr(400, "签名校验错误,请求失败"))
  15. return
  16. }
  17. c.Next()
  18. }
  19. func CheckBody(c *gin.Context) {
  20. if utils.GetApiVersion(c) > 0 {
  21. body, _ := ioutil.ReadAll(c.Request.Body)
  22. fmt.Println(string(body))
  23. if string(body) != "" {
  24. str := utils.ResultAesDecrypt(c, string(body))
  25. if str != "" {
  26. c.Request.Body = ioutil.NopCloser(bytes.NewBuffer([]byte(str)))
  27. }
  28. }
  29. }
  30. c.Next()
  31. }