作者 yangfu

message init

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