This commit is contained in:
eson 2023-11-24 13:15:26 +08:00
parent b9c611f235
commit 747adc64ca
2 changed files with 24 additions and 3 deletions

23
model/gmodel/a_test.go Normal file
View File

@ -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")
}

View File

@ -115,10 +115,8 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in
return m.getDefaultProfile(ctx, tname) return m.getDefaultProfile(ctx, tname)
} }
log.Println(userId, guestId, v)
if logoSelected := gjson.Get(v, "logo_selected"); logoSelected.Exists() { if logoSelected := gjson.Get(v, "logo_selected"); logoSelected.Exists() {
log.Println(userId, guestId, logoSelected) if ver := logoSelected.Get("template_tag_selected.version"); ver.Exists() && ver.String() == versionML {
if ver := logoSelected.Get("version"); ver.Exists() && ver.String() == versionML {
log.Println(ver) log.Println(ver)
return info, nil return info, nil
} }