From 5d9705ddc82c668ce34d2c390d3074b7678393d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E8=88=AA?= Date: Sun, 31 May 2020 17:40:29 +0800 Subject: [PATCH] Update menu.go (#271) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update menu.go json: cannot unmarshal string into Go struct field MatchRule.conditionalmenu.matchrule.group_id of type int32 接口返回是字符串 "matchrule": { "group_id": "2" } 结构体定义 //MatchRule 个性化菜单规则 type MatchRule struct { GroupID int32 json:"group_id,omitempty" ... } * matchrule字段均是字符串 "matchrule": { "tag_id": "2", "sex": "1", "country": "中国", "province": "广东", "city": "广州", "client_platform_type": "2", "language": "zh_CN" } --- officialaccount/menu/menu.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/officialaccount/menu/menu.go b/officialaccount/menu/menu.go index 243fb09..5c31d4c 100644 --- a/officialaccount/menu/menu.go +++ b/officialaccount/menu/menu.go @@ -102,12 +102,12 @@ type ButtonNew struct { //MatchRule 个性化菜单规则 type MatchRule struct { - GroupID int32 `json:"group_id,omitempty"` - Sex int32 `json:"sex,omitempty"` + GroupID string `json:"group_id,omitempty"` + Sex string `json:"sex,omitempty"` Country string `json:"country,omitempty"` Province string `json:"province,omitempty"` City string `json:"city,omitempty"` - ClientPlatformType int32 `json:"client_platform_type,omitempty"` + ClientPlatformType string `json:"client_platform_type,omitempty"` Language string `json:"language,omitempty"` }