12345678910111213141516171819202122232425262728293031323334353637 |
- package controllers
-
- import (
- "XT_New/enums"
- "XT_New/service"
- "fmt"
-
- "github.com/astaxie/beego"
- )
-
- type QiNiuApiController struct {
- BaseAPIController
- // beego.Controller
- }
-
- func QiniuApiRegistRouters() {
- beego.Router("/api/qiniu/uptoken", &QiNiuApiController{}, "get:GetQNUpToken")
- }
-
- func (c *QiNiuApiController) GetQNUpToken() {
- redisClient := service.RedisClient()
- defer redisClient.Close()
-
- token, err := redisClient.Get("qn_token").Result()
- fmt.Print("token------------------------------------", token)
- if err != nil {
- defer fmt.Println(err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)
- return
- }
-
- c.ServeSuccessJSON(map[string]interface{}{
- "uptoken": token,
- })
- return
- }
|