瀏覽代碼

move public account id to config

master
Patrick Peng Sun 8 年之前
父節點
當前提交
14dbd9d2bd
共有 4 個檔案被更改,包括 9 行新增6 行删除
  1. +3
    -1
      common_test.go
  2. +3
    -0
      config.go
  3. +1
    -4
      outMsg.go
  4. +2
    -1
      server_config.json

+ 3
- 1
common_test.go 查看文件

@@ -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) {

+ 3
- 0
config.go 查看文件

@@ -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

+ 1
- 4
outMsg.go 查看文件

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


+ 2
- 1
server_config.json 查看文件

@@ -3,5 +3,6 @@
"EncodingAESKey": "cmtWK2teRnLOXyO5dw7lJkETv9jCeNAqYyguEu5D8gG",
"Appid": "wx876e233fde456b7b",
"AppSecret": "4a91aa328569b10a9fb97adeb8b0af58",
"AuthTokenSaveTo": "/tmp/wechat_hitxy_token"
"AuthTokenSaveTo": "/tmp/wechat_hitxy_token",
"PublicAccountID":"gh_f09231355c68"
}

Loading…
取消
儲存