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 }