| @@ -12,7 +12,9 @@ func SetupConfig() { | |||
| "cmtWK2teRnLOXyO5dw7lJkETv9jCeNAqYyguEu5D8gG", | |||
| "wx876e233fde456b7b", | |||
| "4a91aa328569b10a9fb97adeb8b0af58", | |||
| "wechat_hitxy_access_token"} | |||
| "wechat_hitxy_access_token", | |||
| "gh_f09231355c68"} | |||
| } | |||
| func AssertEqual(t *testing.T, a interface{}, b interface{}, message string) { | |||
| @@ -24,6 +24,9 @@ type WechatAPIConfig struct { | |||
| //AuthTokenSaveTo | |||
| AuthTokenSaveTo string `json:"AuthTokenSaveTo"` | |||
| //PublicAccountID | |||
| PublicAccountID string `json:"PublicAccountID"` | |||
| } | |||
| //APIConfig contains secrets that cannot store in source file | |||
| @@ -19,12 +19,9 @@ func BuildTextMsg(txt string, ToUserName string) (string, error) { | |||
| <MsgType><![CDATA[text]]></MsgType> | |||
| <Content><![CDATA[%s]]></Content> | |||
| </xml>` | |||
| msg := fmt.Sprintf(template, ToUserName, "gh_f09231355c68", int32(time.Now().Unix()), txt) | |||
| fmt.Println(msg) | |||
| msg := fmt.Sprintf(template, ToUserName, APIConfig.PublicAccountID, int32(time.Now().Unix()), txt) | |||
| e := Encode(msg) | |||
| str, _, _, _ := signMsg(e) | |||
| fmt.Println(str) | |||
| return str, nil | |||
| } | |||
| @@ -3,5 +3,6 @@ | |||
| "EncodingAESKey": "cmtWK2teRnLOXyO5dw7lJkETv9jCeNAqYyguEu5D8gG", | |||
| "Appid": "wx876e233fde456b7b", | |||
| "AppSecret": "4a91aa328569b10a9fb97adeb8b0af58", | |||
| "AuthTokenSaveTo": "/tmp/wechat_hitxy_token" | |||
| "AuthTokenSaveTo": "/tmp/wechat_hitxy_token", | |||
| "PublicAccountID":"gh_f09231355c68" | |||
| } | |||