scrm-go

qiniu_controller.go 777B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package global
  2. import (
  3. base_ctl "SCRM/controllers"
  4. "SCRM/enums"
  5. base_service "SCRM/service"
  6. "fmt"
  7. "github.com/astaxie/beego"
  8. )
  9. type QiNiuApiController struct {
  10. base_ctl.BaseAPIController
  11. }
  12. func QiniuCtlRegistRouters() {
  13. beego.Router("/api/qiniu/uptoken", &QiNiuApiController{}, "get:GetQNUpToken")
  14. }
  15. func (c *QiNiuApiController) GetQNUpToken() {
  16. fmt.Println("==========================================")
  17. redisClient := base_service.RedisClient()
  18. defer redisClient.Close()
  19. token, err := redisClient.Get("qn_token").Result()
  20. fmt.Println("token是什么",token)
  21. if err != nil {
  22. defer fmt.Println(err)
  23. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)
  24. return
  25. }
  26. c.ServeSuccessJSON(map[string]interface{}{
  27. "uptoken": token,
  28. })
  29. return
  30. }