From 747adc64ca45ba92e473d16a7af18318f104b3c5 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Fri, 24 Nov 2023 13:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/gmodel/a_test.go | 23 +++++++++++++++++++++++ model/gmodel/fs_user_info_logic.go | 4 +--- 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 model/gmodel/a_test.go diff --git a/model/gmodel/a_test.go b/model/gmodel/a_test.go new file mode 100644 index 00000000..def666f6 --- /dev/null +++ b/model/gmodel/a_test.go @@ -0,0 +1,23 @@ +package gmodel + +import ( + "log" + "testing" + + "github.com/tidwall/gjson" +) + +func TestCase1(t *testing.T) { + v := `{"base": {"mobile": "18588505404", "company": "fusen", "last_name": "sm", "first_name": "h", "resetaurant": "boy"}, "sub_status": {"notification_email": {"newseleter": false, "order_update": false}, "notification_phone": {"newseleter": true, "order_update": false}}, "logo_selected": {"logo_url": "https://fusenstorage.s3.us-east-2.amazonaws.com/d163cba052dc03e7684a4fa8574a17c629e08b6cd0f47f9c239866949365f807", "logo_selected_id": 5018, "merchant_category": 10, "template_tag_selected": {"color": [["#25211F"], ["#1E1916"]], "version": "2", "template_tag": "C6", "selected_index": 0}}}` + + // log.Println(userId, guestId, v) + if logoSelected := gjson.Get(v, "logo_selected"); logoSelected.Exists() { + log.Println(logoSelected) + log.Println(logoSelected.Get("version")) + if ver := logoSelected.Get("version"); ver.Exists() && ver.String() == versionML { + log.Println(ver) + } + } + + // gjson.Get(content, "logo_selected") +} diff --git a/model/gmodel/fs_user_info_logic.go b/model/gmodel/fs_user_info_logic.go index 37fa47a1..bb4eeaed 100644 --- a/model/gmodel/fs_user_info_logic.go +++ b/model/gmodel/fs_user_info_logic.go @@ -115,10 +115,8 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in return m.getDefaultProfile(ctx, tname) } - log.Println(userId, guestId, v) if logoSelected := gjson.Get(v, "logo_selected"); logoSelected.Exists() { - log.Println(userId, guestId, logoSelected) - if ver := logoSelected.Get("version"); ver.Exists() && ver.String() == versionML { + if ver := logoSelected.Get("template_tag_selected.version"); ver.Exists() && ver.String() == versionML { log.Println(ver) return info, nil }