This commit is contained in:
eson 2023-09-01 14:34:40 +08:00
parent 3becece63c
commit cf10effc10

View File

@ -1,6 +1,7 @@
package logic
import (
"encoding/json"
"fmt"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
@ -40,13 +41,6 @@ var ModuleTable map[string]string = map[string]string{
"material": "fs_user_material",
}
type InfoType struct {
Id int64 `gorm:"id"`
Module string `gorm:"module"`
QueryData []byte `gorm:"querydata"`
// CreateAt time.Time `json:"ctime"`
}
type ModuleQuery struct {
TableName string
ModuleName string
@ -129,7 +123,6 @@ func (l *InfoLogic) Info(req *types.UserInfoRequest, userinfo *auth.UserInfo) (r
var info map[string]any = make(map[string]any)
err := raw.Scan(&info).Error
logx.Error(info, err)
if err == gorm.ErrRecordNotFound {
continue
}
@ -139,12 +132,12 @@ func (l *InfoLogic) Info(req *types.UserInfoRequest, userinfo *auth.UserInfo) (r
return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error())
}
// var querydata map[string]any = make(map[string]any)
// err = json.Unmarshal([]byte(info.QueryData), &querydata)
// if err != nil {
// logx.Error(err, info)
// return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error()+":"+string(info.QueryData))
// }
var querydata map[string]any = make(map[string]any)
err = json.Unmarshal([]byte(info["querydata"].(string)), &querydata)
if err != nil {
logx.Error(err, info)
return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error())
}
for k, v := range info {
metadict[k] = v