From e32ca72594d8bfbefbfbfc945e536934129d48e1 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 28 Dec 2024 17:51:29 +0800 Subject: [PATCH] 1 --- app/hdl/hdl_user.go | 6 +++++- app/utils/convert.go | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/hdl/hdl_user.go b/app/hdl/hdl_user.go index 13a6f4a..73cae91 100644 --- a/app/hdl/hdl_user.go +++ b/app/hdl/hdl_user.go @@ -421,6 +421,10 @@ func ParentInfo(c *gin.Context) { e.OutErr(c, e.ERR, err1.Error()) return } + var imUid = "0" + if imUser != nil { + imUid = strconv.FormatInt(imUser.UserId, 10) + } res := md.ParentInfo{ Nickname: user.Nickname, LevelName: level.LevelName, @@ -429,7 +433,7 @@ func ParentInfo(c *gin.Context) { Id: utils.Int64ToStr(user.Id), Phone: user.Phone, WechatAccount: user.WechatAccount, - ImUid: strconv.FormatInt(imUser.UserId, 10), + ImUid: imUid, } e.OutSuc(c, res, nil) return diff --git a/app/utils/convert.go b/app/utils/convert.go index 28f97a7..101612e 100644 --- a/app/utils/convert.go +++ b/app/utils/convert.go @@ -148,9 +148,9 @@ func interfaceSliceToJSONStyleString(slice []interface{}) string { for _, v := range slice { switch value := v.(type) { - case string: - // 对字符串进行转义并加上双引号 - elements = append(elements, fmt.Sprintf("%q", value)) + //case string: + // // 对字符串进行转义并加上双引号 + // elements = append(elements, fmt.Sprintf("%q", value)) case bool: // 直接转换为字符串 elements = append(elements, fmt.Sprintf("%v", value))