Files
jx-callback/controllers/auth_contorller.go
suyl 2cc0e81445 aa
2021-06-24 18:24:41 +08:00

46 lines
976 B
Go

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()
}