aa
This commit is contained in:
@@ -5,21 +5,11 @@ import "errors"
|
||||
const (
|
||||
ErrorCodeIgnore = "ignore"
|
||||
|
||||
ErrCodeSuccess = "0"
|
||||
ErrCodePoint = "1"
|
||||
ErrCodeGeneralFailed = "-1"
|
||||
ErrCodeTokenIsInvalid = "-2"
|
||||
ErrCodeUserNotExist = "-3"
|
||||
ErrCodeUserAlreadyExist = "-4" // 用户已经存在错,但不能成功登录
|
||||
ErrCodeSuccess = "0"
|
||||
ErrCodeGeneralFailed = "-1"
|
||||
ErrCodeTokenIsInvalid = "-2"
|
||||
|
||||
ErrCodeJsonActSkuConflict = "-101" // 这个错误号表示description中的是一个json对象,不是错误文本
|
||||
ErrCodeJsonActPriceTooLarger = "-102" // 这个错误号表示description中的是一个json对象,不是错误文本
|
||||
ErrCodeJsonActEarningPriceIsZero = "-103"
|
||||
ErrCodeJsonUserAlreadyExist = "-104" // 用户已经存在错,且能成功登录
|
||||
ErrCodeJsonSyncErr = "-105"
|
||||
|
||||
ErrCodeAccountBalanceNotEnough = "-201" //余额不足
|
||||
ErrCodeNotAuthBindWeixin = "-202" //没有绑定微信认证方式
|
||||
ErrCodeJsonSyncErr = "-105"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
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()
|
||||
}
|
||||
@@ -14,20 +14,27 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
ns := web.NewNamespace("/v2",
|
||||
web.NSNamespace("/openapi"),
|
||||
ns := web.NewNamespace("/openapi",
|
||||
web.NSNamespace("/print",
|
||||
web.NSInclude(
|
||||
&controllers.PrintController{},
|
||||
),
|
||||
),
|
||||
)
|
||||
ns2 := web.NewNamespace("/v2",
|
||||
web.NSNamespace("/task",
|
||||
web.NSInclude(
|
||||
&controllers.TaskController{},
|
||||
),
|
||||
),
|
||||
web.NSNamespace("/auth",
|
||||
web.NSInclude(
|
||||
&controllers.AuthController{},
|
||||
),
|
||||
),
|
||||
)
|
||||
web.AddNamespace(ns)
|
||||
web.AddNamespace(ns2)
|
||||
|
||||
// 如下都是用于检测存活的空接口
|
||||
web.Any("/", func(ctx *beecontext.Context) {
|
||||
|
||||
Reference in New Issue
Block a user