Merge pull request #40 from alimy/pr-runtime

add runtime config to adjust app feature
pull/42/head
ROC 2 years ago committed by GitHub
commit a2f38fd1c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,6 +10,8 @@ App: # APP基础设置项
SmsJuheTplVal: "#code#=%d&#m#=%d" SmsJuheTplVal: "#code#=%d&#m#=%d"
AlipayAppID: AlipayAppID:
AlipayPrivateKey: AlipayPrivateKey:
Runtime: # App运行时功能调节
DisablePhoneVerify: False # 禁止绑定手机号码时验证短信验证码为true时任意验证码都可以通过验证
Server: # 服务设置 Server: # 服务设置
RunMode: debug RunMode: debug
HttpIp: 0.0.0.0 HttpIp: 0.0.0.0

@ -10,6 +10,7 @@ import (
var ( var (
ServerSetting *setting.ServerSettingS ServerSetting *setting.ServerSettingS
AppSetting *setting.AppSettingS AppSetting *setting.AppSettingS
RuntimeSetting *setting.RuntimeSettingS
DatabaseSetting *setting.DatabaseSettingS DatabaseSetting *setting.DatabaseSettingS
RedisSetting *setting.RedisSettingS RedisSetting *setting.RedisSettingS
SearchSetting *setting.SearchSettingS SearchSetting *setting.SearchSettingS

@ -41,6 +41,10 @@ func setupSetting() error {
if err != nil { if err != nil {
return err return err
} }
err = setting.ReadSection("Runtime", &global.RuntimeSetting)
if err != nil {
return err
}
err = setting.ReadSection("Log", &global.LoggerSetting) err = setting.ReadSection("Log", &global.LoggerSetting)
if err != nil { if err != nil {
return err return err

@ -248,12 +248,13 @@ func BindUserPhone(c *gin.Context) {
} }
// 验证短信验证码 // 验证短信验证码
err := svc.CheckPhoneCaptcha(param.Phone, param.Captcha) if !global.RuntimeSetting.DisablePhoneVerify {
if err != nil { if err := svc.CheckPhoneCaptcha(param.Phone, param.Captcha); err != nil {
global.Logger.Errorf("svc.CheckPhoneCaptcha err: %v\n", err) global.Logger.Errorf("svc.CheckPhoneCaptcha err: %v\n", err)
response.ToErrorResponse(err) response.ToErrorResponse(err)
return return
} }
}
// 执行绑定 // 执行绑定
user.Phone = param.Phone user.Phone = param.Phone

@ -51,6 +51,10 @@ type AppSettingS struct {
AlipayPrivateKey string AlipayPrivateKey string
} }
type RuntimeSettingS struct {
DisablePhoneVerify bool
}
type SearchSettingS struct { type SearchSettingS struct {
ZincHost string ZincHost string
ZincIndex string ZincIndex string

Loading…
Cancel
Save