diff --git a/controllers/auth2.go b/controllers/auth2.go index 72791bc89..4ebb6ded7 100644 --- a/controllers/auth2.go +++ b/controllers/auth2.go @@ -111,9 +111,10 @@ func (c *Auth2Controller) Login() { params.AuthSecret = GetComposedCode(&c.Controller, params.AuthSecret) } if params.AuthType == weixin.AuthTypeWxApp { - configs, _ := dao.QueryConfigs(dao.GetDB(), "checkversion", model.ConfigTypeSys, "") - if params.Version == "" || configs[0].Value != params.Version { - return nil, "", fmt.Errorf("当前APP版本过旧,数据显示有错误,请到'京西菜市'公众号下载最新版本APP!") + if configs, _ := dao.QueryConfigs(dao.GetDB(), "checkversion", model.ConfigTypeSys, ""); len(configs) > 0 { + if params.Version == "" || configs[0].Value != params.Version { + return nil, "", fmt.Errorf("当前APP版本过旧,数据显示有错误,请到'京西菜市'公众号下载最新版本APP!") + } } params.AuthSecret = GetComposedCode2(&c.Controller, params.AuthSecret) }