Merge branch 'develop' of git.ailuowan.com:zzw/lone-services into develop
This commit is contained in:
+5
-1
@@ -39,7 +39,11 @@ func GetConfigInt(key string) int {
|
||||
return data[key]
|
||||
}
|
||||
func GetConfigInt64(key string) int64 { return runViper.GetInt64(key) }
|
||||
func GetConfigBool(key string) bool { return runViper.GetBool(key) }
|
||||
func GetConfigBool(key string) bool {
|
||||
data := make(map[string]bool)
|
||||
data["mysql.debug"] = true
|
||||
return runViper.GetBool(key)
|
||||
}
|
||||
|
||||
func InitConfig() {
|
||||
loadOnce.Do(func() {
|
||||
|
||||
+18
-12
@@ -44,6 +44,7 @@ const (
|
||||
DecollatorEqual = "="
|
||||
StringEmpty = ""
|
||||
StringDot = "."
|
||||
StringZero = "0"
|
||||
StringStatusOk = "1"
|
||||
StringStatusNo = "2"
|
||||
)
|
||||
@@ -62,16 +63,21 @@ const (
|
||||
|
||||
var (
|
||||
//新使用方法
|
||||
Ok = Status{Code: 10000, Msg: "OK"}
|
||||
Fail = Status{Code: 999, Msg: "fail"}
|
||||
Ok = Status{Code: 10000, Msg: "OK"}
|
||||
Fail = Status{Code: 999, Msg: "fail"}
|
||||
ErrorExist = Status{Code: 998, Msg: "已存在"}
|
||||
|
||||
ErrorParams = Status{Code: 10001, Msg: "缺少参数或传值不对"}
|
||||
ErrorEncryptAesError = Status{Code: 10001, Msg: "加密失败"}
|
||||
ErrorNotFund = Status{Code: 11001, Msg: "not fund"}
|
||||
ErrorExistUser = Status{Code: 10009, Msg: "账号或手机号已存在"}
|
||||
ErrorPwdError = Status{Code: 10002, Msg: "密码错误"}
|
||||
ErrorNoLogin = Status{Code: 10003, Msg: "没有登录"}
|
||||
ErrorAuthority = Status{Code: 10008, Msg: "没有权限"}
|
||||
ErrorNoLoginInfo = Status{Code: 10003, Msg: "没有获取到登录信息"}
|
||||
ErrorMissingParams = Status{Code: 10001, Msg: "缺少参数"}
|
||||
ErrorEncryptAesError = Status{Code: 10002, Msg: "加密失败"}
|
||||
ErrorNotFund = Status{Code: 11003, Msg: "not fund"}
|
||||
ErrorExistUser = Status{Code: 10004, Msg: "账号或手机号已存在"}
|
||||
ErrorPwdError = Status{Code: 10005, Msg: "密码错误"}
|
||||
ErrorNoLogin = Status{Code: 10006, Msg: "没有登录"}
|
||||
ErrorAuthority = Status{Code: 10007, Msg: "没有权限"}
|
||||
ErrorNoLoginInfo = Status{Code: 10008, Msg: "没有获取到登录信息"}
|
||||
ErrorAuthorityChange = Status{Code: 10009, Msg: "该权限下有其它权限"}
|
||||
ErrorJsonDataError = Status{Code: 11000, Msg: "json数据错误"}
|
||||
|
||||
// 数据类
|
||||
ErrorDataIsExist = Status{Code: 11004, Msg: "数据已存在"}
|
||||
@@ -85,7 +91,6 @@ var (
|
||||
// ——————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
// 基础类
|
||||
ErrorExist = NewError(998, "已存在")
|
||||
ErrorOvertime = NewError(997, "请求已超时")
|
||||
ErrorDataTransform = NewError(996, "数据转换失败")
|
||||
ErrorNoBaseParams = NewError(995, "缺失基础参数")
|
||||
@@ -115,8 +120,9 @@ var (
|
||||
ErrorBindOtherError = NewError(11013, "该设备已绑定其它用户,请不要重复绑定")
|
||||
)
|
||||
|
||||
func SetError(error Error, msg string) Error {
|
||||
return NewError(error.GetCode(), msg)
|
||||
func SetError(error Status, msg string) Status {
|
||||
error.Msg = msg
|
||||
return error
|
||||
}
|
||||
func GetLoginKey(Type, key string) string {
|
||||
return fmt.Sprintf(Login, Type) + key
|
||||
|
||||
Reference in New Issue
Block a user