Bladeren bron

move public account id to config

master
Patrick Peng Sun 8 jaren geleden
bovenliggende
commit
14dbd9d2bd
4 gewijzigde bestanden met toevoegingen van 9 en 6 verwijderingen
  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 Bestand weergeven

"cmtWK2teRnLOXyO5dw7lJkETv9jCeNAqYyguEu5D8gG", "cmtWK2teRnLOXyO5dw7lJkETv9jCeNAqYyguEu5D8gG",
"wx876e233fde456b7b", "wx876e233fde456b7b",
"4a91aa328569b10a9fb97adeb8b0af58", "4a91aa328569b10a9fb97adeb8b0af58",
"wechat_hitxy_access_token"}
"wechat_hitxy_access_token",
"gh_f09231355c68"}

} }


func AssertEqual(t *testing.T, a interface{}, b interface{}, message string) { func AssertEqual(t *testing.T, a interface{}, b interface{}, message string) {

+ 3
- 0
config.go Bestand weergeven



//AuthTokenSaveTo //AuthTokenSaveTo
AuthTokenSaveTo string `json:"AuthTokenSaveTo"` AuthTokenSaveTo string `json:"AuthTokenSaveTo"`

//PublicAccountID
PublicAccountID string `json:"PublicAccountID"`
} }


//APIConfig contains secrets that cannot store in source file //APIConfig contains secrets that cannot store in source file

+ 1
- 4
outMsg.go Bestand weergeven

<MsgType><![CDATA[text]]></MsgType> <MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[%s]]></Content> <Content><![CDATA[%s]]></Content>
</xml>` </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) e := Encode(msg)

str, _, _, _ := signMsg(e) str, _, _, _ := signMsg(e)
fmt.Println(str)
return str, nil return str, nil
} }



+ 2
- 1
server_config.json Bestand weergeven

"EncodingAESKey": "cmtWK2teRnLOXyO5dw7lJkETv9jCeNAqYyguEu5D8gG", "EncodingAESKey": "cmtWK2teRnLOXyO5dw7lJkETv9jCeNAqYyguEu5D8gG",
"Appid": "wx876e233fde456b7b", "Appid": "wx876e233fde456b7b",
"AppSecret": "4a91aa328569b10a9fb97adeb8b0af58", "AppSecret": "4a91aa328569b10a9fb97adeb8b0af58",
"AuthTokenSaveTo": "/tmp/wechat_hitxy_token"
"AuthTokenSaveTo": "/tmp/wechat_hitxy_token",
"PublicAccountID":"gh_f09231355c68"
} }

Laden…
Annuleren
Opslaan