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