app
This commit is contained in:
37
controllers/app_controller.go
Normal file
37
controllers/app_controller.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
"git.rosy.net.cn/jx-print/model"
|
||||
"git.rosy.net.cn/jx-print/services"
|
||||
"git.rosy.net.cn/jx-print/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//查询账号下的app GET
|
||||
func GetApps(c *gin.Context) {
|
||||
var (
|
||||
b, ok bool
|
||||
token string
|
||||
user *model.User
|
||||
)
|
||||
globals.SugarLogger.Debugf("Begin API :%s params: %v ip: %s", c.Request.URL, c.Params, c.ClientIP())
|
||||
if token, b = checkToken(c); !b {
|
||||
return
|
||||
}
|
||||
if user, ok = utils.GetKet(token).(*model.User); !ok {
|
||||
c.JSON(http.StatusOK, &CallBack{
|
||||
Code: model.ErrCodeToken,
|
||||
Desc: "token 过期或无效!",
|
||||
})
|
||||
return
|
||||
}
|
||||
if !callFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = services.GetApps(c, user)
|
||||
return retVal, "", err
|
||||
}) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user