作者 yangfu

message init

... ... @@ -2,12 +2,13 @@ package main
import (
"github.com/astaxie/beego"
_ "github.com/go-sql-driver/mysql"
"gitlab.fjmaimaimai.com/mmm-go/ability/protocol"
_ "gitlab.fjmaimaimai.com/mmm-go/ability/routers"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/config"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/orm"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/redis"
_ "github.com/go-sql-driver/mysql"
)
func init(){
... ... @@ -30,6 +31,7 @@ func main() {
defer func(){
log.Info("app on stop!")
}()
protocol.InitMessageCode()
log.Info("app on start!")
log.Info("Beego Run Mode:",beego.BConfig.RunMode)
beego.Run()
... ...
package protocol
import "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/mybeego"
func InitMessageCode(){
messages := []struct {
Code int
Msg string
}{
{113,"签名验证失败"},
{1009,"验证码已超时,登录失败"},
{1011,"短信验证码次数超过限制,请稍后重试"},
{1012,"验证码错误"},
{2001,"请输入正确的手机号码"},
{2002,"后台未配置账号信息,请联系管理员配置"},
{2009,"上传的文件流为空"},
{2020,"帐号不存在,请联系管理员"},
{2021,"登录失败,手机号或密码错误"},
{2025,"短信验证码验证失败"},
{2026,"两次输入的密码不一致"},
{4139,"authCode无效或过期"},
{4140,"refreshToken过期,需要重新登录授权"},
{4141,"accessToken过期或无效,需要进行重新获取令牌"},
{4142,"Uuid已存在,请求失败"},
}
for i:=range messages{
mybeego.SetMessage(messages[i].Code,messages[i].Msg)
}
}
... ...