From e56588125b8e2f71ca617e59c4928cd3ffaf08c6 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 10:21:46 +0800 Subject: [PATCH 01/13] info --- server/info/internal/logic/usergetprofilelogic.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/info/internal/logic/usergetprofilelogic.go b/server/info/internal/logic/usergetprofilelogic.go index be64152d..9173cbf3 100644 --- a/server/info/internal/logic/usergetprofilelogic.go +++ b/server/info/internal/logic/usergetprofilelogic.go @@ -34,10 +34,6 @@ func (l *UserGetProfileLogic) UserGetProfile(req *types.QueryProfileRequest, use // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) // userinfo 传入值时, 一定不为null - if !userinfo.IsUser() { - return resp.SetStatus(basic.CodeUnAuth) - } - profileBase, err := l.svcCtx.AllModels.FsUserInfo.GetProfile(l.ctx, req.TopKey, userinfo.UserId) if err != nil { return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error()) From 832b68752b17fc3ee4c115b8d4bc2fea93c39f55 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 10:57:09 +0800 Subject: [PATCH 02/13] fix --- server/websocket/internal/logic/ws_render_image.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index a64b254e..15cc84c2 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -297,6 +297,7 @@ func (w *wsConnectItem) getProductRelateionInfo(renderImageData *websocket_data. w.renderErrResponse(renderImageData.RenderId, renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "获取对应开启云渲染模板失败", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0) return nil, nil, nil, errors.New("获取对应开启云渲染模板失败") } + //判断设计信息是否为空 if productTemplate.TemplateInfo == nil || *productTemplate.TemplateInfo == "" { w.renderErrResponse(renderImageData.RenderId, renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "模板设计信息是空的", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, 0, 0, 0) return nil, nil, nil, errors.New("模板设计信息是空的") @@ -312,6 +313,7 @@ func (w *wsConnectItem) getProductRelateionInfo(renderImageData *websocket_data. w.renderErrResponse(renderImageData.RenderId, renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "获取对应模型失败", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, 0, 0, 0) return nil, nil, nil, errors.New("获取对应模型失败") } + //判断设计信息是否为空 if model3d.ModelInfo == nil || *model3d.ModelInfo == "" { w.renderErrResponse(renderImageData.RenderId, renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "模型设计信息是空的", renderImageData.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3d.Id, 0, 0) return nil, nil, nil, errors.New("模型设计信息是空的") From ebd4d88f31244bb751fbfd3e82f51aff10b9bef8 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 10:59:56 +0800 Subject: [PATCH 03/13] fix --- server/websocket/internal/logic/ws_render_image.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index 15cc84c2..fb8e8dbf 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "fusenapi/model/gmodel" "fusenapi/service/repositories" "fusenapi/utils/curl" @@ -430,12 +431,14 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, combineImage st "render_data": sendData, } postDataBytes, _ := json.Marshal(postData) + beginPostTime := time.Now().UTC().UnixMilli() _, err = curl.ApiCall(url, "POST", header, bytes.NewReader(postDataBytes), time.Second*10) if err != nil { w.renderErrResponse(info.RenderId, info.RequestId, info.RenderData.TemplateTag, taskId, "请求unity接口失败", info.RenderData.ProductId, w.userId, w.guestId, productTemplate.Id, model3dInfo.Id, productSize.Id, *productTemplate.ElementModelId) logx.Error("failed to send data to unity") return err } + logx.Info(fmt.Sprintf("发送unity post数据耗时:%d", time.Now().UTC().UnixMilli()-beginPostTime)) //发送运行阶段消息 w.sendRenderDataToUnityStepResponseMessage(info.RenderId, info.RequestId) logx.Info("发送到unity成功,刀版图:", combineImage /*, " 请求unity的数据:", string(postDataBytes)*/) From bd07bf3264bad6b8dde63606d127c0ae856a31ad Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:02:14 +0800 Subject: [PATCH 04/13] fix --- server/websocket/internal/logic/ws_render_image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/websocket/internal/logic/ws_render_image.go b/server/websocket/internal/logic/ws_render_image.go index fb8e8dbf..173e61f7 100644 --- a/server/websocket/internal/logic/ws_render_image.go +++ b/server/websocket/internal/logic/ws_render_image.go @@ -438,7 +438,7 @@ func (w *wsConnectItem) assembleRenderDataToUnity(taskId string, combineImage st logx.Error("failed to send data to unity") return err } - logx.Info(fmt.Sprintf("发送unity post数据耗时:%d", time.Now().UTC().UnixMilli()-beginPostTime)) + logx.Info(fmt.Sprintf("发送unity post数据耗时:%dms", time.Now().UTC().UnixMilli()-beginPostTime)) //发送运行阶段消息 w.sendRenderDataToUnityStepResponseMessage(info.RenderId, info.RequestId) logx.Info("发送到unity成功,刀版图:", combineImage /*, " 请求unity的数据:", string(postDataBytes)*/) From a240d9a3e3edd36faaff5a1b165a27447e9244d1 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:11:49 +0800 Subject: [PATCH 05/13] fix --- model/gmodel/fs_product_logic.go | 4 ++-- server/product/internal/logic/getrecommendproductlistlogic.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model/gmodel/fs_product_logic.go b/model/gmodel/fs_product_logic.go index e2e16e42..5cefe921 100755 --- a/model/gmodel/fs_product_logic.go +++ b/model/gmodel/fs_product_logic.go @@ -88,9 +88,9 @@ func (p *FsProductModel) GetRandomProductList(ctx context.Context, limit int) (r Where("`is_del` =? and `is_shelf` = ?", 0, 1).Order("RAND()").Limit(limit).Find(&resp).Error return resp, err } -func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, limit int, notInProductIds []int64) (resp []FsProduct, err error) { +func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, category int, limit int, notInProductIds []int64) (resp []FsProduct, err error) { db := p.db.WithContext(ctx).Model(&FsProduct{}). - Where("`is_del` =? and `is_shelf` = ? ", 0, 1) + Where("`is_del` =? and `is_shelf` = ? and `category` = ?", 0, 1, category) if len(notInProductIds) > 0 { db = db.Where("`id` not in(?)", notInProductIds) } diff --git a/server/product/internal/logic/getrecommendproductlistlogic.go b/server/product/internal/logic/getrecommendproductlistlogic.go index 072b9164..e6f9d762 100644 --- a/server/product/internal/logic/getrecommendproductlistlogic.go +++ b/server/product/internal/logic/getrecommendproductlistlogic.go @@ -84,7 +84,7 @@ func (l *GetRecommendProductListLogic) GetRecommendProductList(req *types.GetRec lenRecommendProduct := len(recommendProductList) if lenRecommendProduct < int(req.Num) { appendNum := int(req.Num) - lenRecommendProduct - productList, err := l.svcCtx.AllModels.FsProduct.GetIgnoreRandomProductList(l.ctx, appendNum, ignoreProductIds) + productList, err := l.svcCtx.AllModels.FsProduct.GetIgnoreRandomProductList(l.ctx, 1, appendNum, ignoreProductIds) if err != nil { logx.Error(err) return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product list") From bb5fa3461140e4ae84fa18439f7c04dbc8e66434 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:17:11 +0800 Subject: [PATCH 06/13] fix --- model/gmodel/fs_product_logic.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/model/gmodel/fs_product_logic.go b/model/gmodel/fs_product_logic.go index 5cefe921..565395d7 100755 --- a/model/gmodel/fs_product_logic.go +++ b/model/gmodel/fs_product_logic.go @@ -88,9 +88,10 @@ func (p *FsProductModel) GetRandomProductList(ctx context.Context, limit int) (r Where("`is_del` =? and `is_shelf` = ?", 0, 1).Order("RAND()").Limit(limit).Find(&resp).Error return resp, err } -func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, category int, limit int, notInProductIds []int64) (resp []FsProduct, err error) { +func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, limit int, notInProductIds []int64) (resp []FsProduct, err error) { db := p.db.WithContext(ctx).Model(&FsProduct{}). - Where("`is_del` =? and `is_shelf` = ? and `category` = ?", 0, 1, category) + //过滤报价单产品 + Where("`is_del` =? and `is_shelf` = ? and `type` != ?", 0, 1, 39) if len(notInProductIds) > 0 { db = db.Where("`id` not in(?)", notInProductIds) } From 898ead74d18abeea46eed1a6831606a6cbf169ab Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:17:47 +0800 Subject: [PATCH 07/13] fix --- server/product/internal/logic/getrecommendproductlistlogic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/product/internal/logic/getrecommendproductlistlogic.go b/server/product/internal/logic/getrecommendproductlistlogic.go index e6f9d762..072b9164 100644 --- a/server/product/internal/logic/getrecommendproductlistlogic.go +++ b/server/product/internal/logic/getrecommendproductlistlogic.go @@ -84,7 +84,7 @@ func (l *GetRecommendProductListLogic) GetRecommendProductList(req *types.GetRec lenRecommendProduct := len(recommendProductList) if lenRecommendProduct < int(req.Num) { appendNum := int(req.Num) - lenRecommendProduct - productList, err := l.svcCtx.AllModels.FsProduct.GetIgnoreRandomProductList(l.ctx, 1, appendNum, ignoreProductIds) + productList, err := l.svcCtx.AllModels.FsProduct.GetIgnoreRandomProductList(l.ctx, appendNum, ignoreProductIds) if err != nil { logx.Error(err) return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product list") From 43d5fe66924cff089568e80d8fee76fb1ca84efc Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:20:28 +0800 Subject: [PATCH 08/13] fix --- model/gmodel/fs_product_logic.go | 4 ++-- server/product/internal/logic/getrecommendproductlistlogic.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/model/gmodel/fs_product_logic.go b/model/gmodel/fs_product_logic.go index 565395d7..12617ca3 100755 --- a/model/gmodel/fs_product_logic.go +++ b/model/gmodel/fs_product_logic.go @@ -88,10 +88,10 @@ func (p *FsProductModel) GetRandomProductList(ctx context.Context, limit int) (r Where("`is_del` =? and `is_shelf` = ?", 0, 1).Order("RAND()").Limit(limit).Find(&resp).Error return resp, err } -func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, limit int, notInProductIds []int64) (resp []FsProduct, err error) { +func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, notEqType int64, limit int, notInProductIds []int64) (resp []FsProduct, err error) { db := p.db.WithContext(ctx).Model(&FsProduct{}). //过滤报价单产品 - Where("`is_del` =? and `is_shelf` = ? and `type` != ?", 0, 1, 39) + Where("`is_del` =? and `is_shelf` = ? and `type` != ?", 0, 1, notEqType) if len(notInProductIds) > 0 { db = db.Where("`id` not in(?)", notInProductIds) } diff --git a/server/product/internal/logic/getrecommendproductlistlogic.go b/server/product/internal/logic/getrecommendproductlistlogic.go index 072b9164..3b38ae6e 100644 --- a/server/product/internal/logic/getrecommendproductlistlogic.go +++ b/server/product/internal/logic/getrecommendproductlistlogic.go @@ -84,7 +84,8 @@ func (l *GetRecommendProductListLogic) GetRecommendProductList(req *types.GetRec lenRecommendProduct := len(recommendProductList) if lenRecommendProduct < int(req.Num) { appendNum := int(req.Num) - lenRecommendProduct - productList, err := l.svcCtx.AllModels.FsProduct.GetIgnoreRandomProductList(l.ctx, appendNum, ignoreProductIds) + //不要查报价单的 + productList, err := l.svcCtx.AllModels.FsProduct.GetIgnoreRandomProductList(l.ctx, 39, appendNum, ignoreProductIds) if err != nil { logx.Error(err) return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product list") From 78ce8c41bd72b01bb643ec705aa7121c6e6c2101 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:29:58 +0800 Subject: [PATCH 09/13] info --- model/gmodel/fs_user_info_logic.go | 40 +++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/model/gmodel/fs_user_info_logic.go b/model/gmodel/fs_user_info_logic.go index 31101b78..e88a5969 100644 --- a/model/gmodel/fs_user_info_logic.go +++ b/model/gmodel/fs_user_info_logic.go @@ -50,7 +50,29 @@ func (m *FsUserInfoModel) MergeMetadata(userId int64, meta any) error { return fssql.MetadataModulePATCH(m.db, "profile", FsUserInfo{}, meta, "user_id = ?", userId) } -func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId int64) (map[string]any, error) { +func (m *FsUserInfoModel) GetDefaultProfile(ctx context.Context, tname string) (map[string]any, error) { + var baseinfo map[string]any + condUser := "user_id = 0 and guest_id = 0" + rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$.') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", tname, condUser) + err := m.db.WithContext(ctx).Raw(rawsql).Take(&baseinfo).Error + if err != nil { + return nil, err + } + + v, ok := baseinfo["query"].(string) + if !ok { + return nil, fmt.Errorf("default userinfo profile is not exists") + } + + var info map[string]any + err = json.Unmarshal([]byte(v), &info) + if err != nil { + return nil, err + } + return info, nil +} + +func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId int64, guestId int64) (map[string]any, error) { var baseinfo map[string]any tname := fssql.GetGormTableName(m.db, FsUserInfo{}) @@ -61,7 +83,14 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in pkey = "." + pkey } - rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$%s') as query from %s where user_id = ? and module = 'profile' order by ctime DESC limit 1", pkey, tname) + var condUser string + if userId == 0 { + condUser = fmt.Sprintf("user_id = 0 and guest_id = %d", guestId) + } else { + condUser = fmt.Sprintf("user_id = %d", userId) + } + + rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$%s') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", pkey, tname, condUser) err := m.db.WithContext(ctx).Raw(rawsql, userId).Take(&baseinfo).Error if err != nil { return nil, err @@ -69,7 +98,7 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in v, ok := baseinfo["query"].(string) if !ok { - return nil, nil + return m.GetDefaultProfile(ctx, tname) } var info map[string]any @@ -77,6 +106,11 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in if err != nil { return nil, err } + + if len(info) == 0 { + return m.GetDefaultProfile(ctx, tname) + } + return info, nil } func (m *FsUserInfoModel) FindOneByUser(ctx context.Context, userId, guestId int64, module string) (resp *FsUserInfo, err error) { From 21196c62ee3aa8d64b2448b090dc48c436369323 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:41:35 +0800 Subject: [PATCH 10/13] info --- model/gmodel/fs_user_info_logic.go | 29 ------------------- .../internal/logic/usergetprofilelogic.go | 2 +- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/model/gmodel/fs_user_info_logic.go b/model/gmodel/fs_user_info_logic.go index e88a5969..91a4d706 100644 --- a/model/gmodel/fs_user_info_logic.go +++ b/model/gmodel/fs_user_info_logic.go @@ -121,32 +121,3 @@ func (m *FsUserInfoModel) FindOneByUser(ctx context.Context, userId, guestId int } return resp, err } -func (m *FsUserInfoModel) GetProfileByUserIdGuestId(ctx context.Context, pkey string, userId, guestId int64) (map[string]any, error) { - - var baseinfo map[string]any - tname := fssql.GetGormTableName(m.db, FsUserInfo{}) - - if pkey == "." { - pkey = "" - } else { - pkey = "." + pkey - } - - rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$%s') as query from %s where user_id = ? and guest_id = ? and module = 'profile' order by ctime DESC limit 1", pkey, tname) - err := m.db.WithContext(ctx).Raw(rawsql, userId, guestId).Take(&baseinfo).Error - if err != nil { - return nil, err - } - - v, ok := baseinfo["query"].(string) - if !ok { - return nil, nil - } - - var info map[string]any - err = json.Unmarshal([]byte(v), &info) - if err != nil { - return nil, err - } - return info, nil -} diff --git a/server/info/internal/logic/usergetprofilelogic.go b/server/info/internal/logic/usergetprofilelogic.go index 9173cbf3..b94f5caa 100644 --- a/server/info/internal/logic/usergetprofilelogic.go +++ b/server/info/internal/logic/usergetprofilelogic.go @@ -34,7 +34,7 @@ func (l *UserGetProfileLogic) UserGetProfile(req *types.QueryProfileRequest, use // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) // userinfo 传入值时, 一定不为null - profileBase, err := l.svcCtx.AllModels.FsUserInfo.GetProfile(l.ctx, req.TopKey, userinfo.UserId) + profileBase, err := l.svcCtx.AllModels.FsUserInfo.GetProfile(l.ctx, req.TopKey, userinfo.UserId, userinfo.GuestId) if err != nil { return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error()) } From aef2ee18dd12950044aebc1bfadfc758f82e6e10 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:43:19 +0800 Subject: [PATCH 11/13] info --- model/gmodel/fs_user_info_logic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/gmodel/fs_user_info_logic.go b/model/gmodel/fs_user_info_logic.go index 91a4d706..13dc054c 100644 --- a/model/gmodel/fs_user_info_logic.go +++ b/model/gmodel/fs_user_info_logic.go @@ -91,7 +91,7 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in } rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$%s') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", pkey, tname, condUser) - err := m.db.WithContext(ctx).Raw(rawsql, userId).Take(&baseinfo).Error + err := m.db.WithContext(ctx).Raw(rawsql).Take(&baseinfo).Error if err != nil { return nil, err } From f9ae25ace59308f84c4e907dd9d4cd6e7462f5c8 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:44:12 +0800 Subject: [PATCH 12/13] info --- model/gmodel/fs_user_info_logic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/gmodel/fs_user_info_logic.go b/model/gmodel/fs_user_info_logic.go index 13dc054c..8a446689 100644 --- a/model/gmodel/fs_user_info_logic.go +++ b/model/gmodel/fs_user_info_logic.go @@ -53,7 +53,7 @@ func (m *FsUserInfoModel) MergeMetadata(userId int64, meta any) error { func (m *FsUserInfoModel) GetDefaultProfile(ctx context.Context, tname string) (map[string]any, error) { var baseinfo map[string]any condUser := "user_id = 0 and guest_id = 0" - rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$.') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", tname, condUser) + rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$.*') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", tname, condUser) err := m.db.WithContext(ctx).Raw(rawsql).Take(&baseinfo).Error if err != nil { return nil, err From a6cdd880c882a603e1a122d0547e9a4faab6466f Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Thu, 26 Oct 2023 11:45:52 +0800 Subject: [PATCH 13/13] info --- model/gmodel/fs_user_info_logic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/gmodel/fs_user_info_logic.go b/model/gmodel/fs_user_info_logic.go index 8a446689..23304365 100644 --- a/model/gmodel/fs_user_info_logic.go +++ b/model/gmodel/fs_user_info_logic.go @@ -53,7 +53,7 @@ func (m *FsUserInfoModel) MergeMetadata(userId int64, meta any) error { func (m *FsUserInfoModel) GetDefaultProfile(ctx context.Context, tname string) (map[string]any, error) { var baseinfo map[string]any condUser := "user_id = 0 and guest_id = 0" - rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$.*') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", tname, condUser) + rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", tname, condUser) err := m.db.WithContext(ctx).Raw(rawsql).Take(&baseinfo).Error if err != nil { return nil, err