Merge pull request #40 from alimy/pr-runtime

add runtime config to adjust app feature
pull/42/head
ROC 3 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"
AlipayAppID:
AlipayPrivateKey:
Runtime: # App运行时功能调节
DisablePhoneVerify: False # 禁止绑定手机号码时验证短信验证码为true时任意验证码都可以通过验证
Server: # 服务设置
RunMode: debug
HttpIp: 0.0.0.0

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

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

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

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

Loading…
Cancel
Save