qiniiu_api_controller.go 513B

1234567891011121314151617181920212223242526272829
  1. package mobile_api_controllers
  2. import (
  3. "XT_New/enums"
  4. "XT_New/service"
  5. "fmt"
  6. )
  7. type QiNiuApiController struct {
  8. MobileBaseAPIAuthController
  9. }
  10. func (c *QiNiuApiController) GetQNUpToken() {
  11. redisClient := service.RedisClient()
  12. defer redisClient.Close()
  13. token, err := redisClient.Get("qn_token").Result()
  14. if err != nil {
  15. defer fmt.Println(err)
  16. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)
  17. return
  18. }
  19. c.ServeSuccessJSON(map[string]interface{}{
  20. "uptoken": token,
  21. })
  22. return
  23. }