add app
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"git.rosy.net.cn/jx-print/globals"
|
"git.rosy.net.cn/jx-print/globals"
|
||||||
"git.rosy.net.cn/jx-print/model"
|
"git.rosy.net.cn/jx-print/model"
|
||||||
"git.rosy.net.cn/jx-print/services"
|
"git.rosy.net.cn/jx-print/services"
|
||||||
@@ -35,3 +36,35 @@ func GetApps(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type AddAppParam struct {
|
||||||
|
Code string `json:"code" form:"code"` //手机验证码
|
||||||
|
Mobile string `json:"mobile" form:"mobile"` //手机号
|
||||||
|
}
|
||||||
|
|
||||||
|
//新建app POST
|
||||||
|
func AddApp(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) {
|
||||||
|
fmt.Println(user)
|
||||||
|
return retVal, "", err
|
||||||
|
}) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ func Init(r *gin.Engine) {
|
|||||||
//app
|
//app
|
||||||
app := v2.Group("/app")
|
app := v2.Group("/app")
|
||||||
app.GET("/getApps", controllers.GetApps)
|
app.GET("/getApps", controllers.GetApps)
|
||||||
|
app.GET("/addApp", controllers.AddApp)
|
||||||
|
|
||||||
//v1是不需要token的
|
//v1是不需要token的
|
||||||
v1 := r.Group("v1")
|
v1 := r.Group("v1")
|
||||||
|
|||||||
Reference in New Issue
Block a user