package mobile_api_controllers

import (
	"Xcx_New/enums"
	"Xcx_New/service"
	"fmt"
)

type QiNiuApiController struct {
	MobileBaseAPIAuthController
}

func (c *QiNiuApiController) GetQNUpToken() {
	redisClient := service.RedisClient()
	defer redisClient.Close()

	token, err := redisClient.Get("qn_token").Result()
	if err != nil {
		defer fmt.Println(err)
		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)
		return
	}

	c.ServeSuccessJSON(map[string]interface{}{
		"uptoken": token,
	})
	return
}
