add app
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
"git.rosy.net.cn/jx-print/model"
|
||||
"git.rosy.net.cn/jx-print/services"
|
||||
@@ -40,16 +39,27 @@ func GetApps(c *gin.Context) {
|
||||
type AddAppParam struct {
|
||||
Code string `json:"code" form:"code"` //手机验证码
|
||||
Mobile string `json:"mobile" form:"mobile"` //手机号
|
||||
Name string `json:"name" form:"name"` //应用名称
|
||||
}
|
||||
|
||||
//新建app POST
|
||||
func AddApp(c *gin.Context) {
|
||||
var (
|
||||
err error
|
||||
b, ok bool
|
||||
token string
|
||||
user *model.User
|
||||
param = &AddAppParam{}
|
||||
)
|
||||
globals.SugarLogger.Debugf("Begin API :%s params: %v ip: %s", c.Request.URL, c.Params, c.ClientIP())
|
||||
if err = c.Bind(¶m); err != nil {
|
||||
c.JSON(http.StatusOK, &CallBack{
|
||||
Code: model.ErrCodeNormal,
|
||||
Desc: err.Error(),
|
||||
})
|
||||
globals.SugarLogger.Debugf("End API :%s error:%v:", c.Request.URL, err)
|
||||
return
|
||||
}
|
||||
if token, b = checkToken(c); !b {
|
||||
return
|
||||
}
|
||||
@@ -61,7 +71,7 @@ func AddApp(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if !callFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
fmt.Println(user)
|
||||
err = services.AddApp(c, param.Code, param.Name, param.Mobile, user.UserID)
|
||||
return retVal, "", err
|
||||
}) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user