This commit is contained in:
eson 2023-09-01 17:13:31 +08:00
parent 7d9435ca29
commit b4a80bcf98

View File

@ -67,6 +67,21 @@ func (mquery *ModuleQuery) EncodeQuery(field string) string {
return string(qstr)
}
func (mquery *ModuleQuery) EncodeEmpty() map[string]any {
var qstr map[string]any = make(map[string]any)
for query := range mquery.ModuleQuery {
if query != "" {
query = "." + query
}
k := fmt.Sprintf("%s%s", mquery.ModuleName, query)
qstr[k] = map[string]any{}
}
return qstr
}
func (l *InfoLogic) Info(req *types.UserInfoRequest, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
@ -145,7 +160,11 @@ func (l *InfoLogic) Info(req *types.UserInfoRequest, userinfo *auth.UserInfo) (r
queryjson, ok := info["querydata"].(string)
if !ok {
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, mquery.ModuleName)
for k, v := range mquery.EncodeEmpty() {
metadict[k] = v
}
continue
// return resp.SetStatusWithMessage(basic.CodeDbSqlErr, mquery.ModuleName)
}
var querydata map[string]any = make(map[string]any)