aa
This commit is contained in:
45
controllers/auth_contorller.go
Normal file
45
controllers/auth_contorller.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type AuthController struct {
|
||||
web.Controller
|
||||
}
|
||||
|
||||
// @Title 注册用户
|
||||
// @Description 注册用户
|
||||
// @Param param formData string true "注册信息"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /RegisterUser [post]
|
||||
func (c *AuthController) RegisterUser() {
|
||||
var (
|
||||
err error
|
||||
errCode = model.ErrCodeGeneralFailed
|
||||
param string
|
||||
)
|
||||
errParams := []string{}
|
||||
if param = c.GetString("param", ""); param == "" {
|
||||
errParams = append(errParams, "param")
|
||||
}
|
||||
if len(errParams) > 0 {
|
||||
err = fmt.Errorf(strRequiredParamIsEmpty, strings.Join(errParams, ","))
|
||||
}
|
||||
if err == nil {
|
||||
c.Data["json"] = &CallResult{
|
||||
Code: model.ErrCodeSuccess,
|
||||
Data: string(""),
|
||||
}
|
||||
} else {
|
||||
c.Data["json"] = &CallResult{
|
||||
Code: errCode,
|
||||
Desc: err.Error(),
|
||||
}
|
||||
}
|
||||
c.ServeJSON()
|
||||
}
|
||||
Reference in New Issue
Block a user