Skip to content

Instantly share code, notes, and snippets.

@flyerhzm
Last active August 27, 2017 10:57
Show Gist options
  • Save flyerhzm/8fc234d560a8b38f7e58fa841e19acb3 to your computer and use it in GitHub Desktop.
Save flyerhzm/8fc234d560a8b38f7e58fa841e19acb3 to your computer and use it in GitHub Desktop.
微信端APIs

微信端

身份认证

防止未认证访问或数据篡改,需要在所有api调用加入2个参数 c 和 v

c = Base64(unix timestamp)
v = SHA1 hexdigest({c} + modumajiang)

比如,unix timestamp 是 1495465498,那么

c = "MTQ5NTQ2NTU1Mg==\n"
v = "2cd88088ead8b53051bce19af58a58f0e3d413df" // {c} + modumajiang = "MTQ5NTQ2NTU1Mg==\n:modumajiang"

调用api格式为 POST http://wechat.mohuatech.com/users/:id/use?c=MTQ5NTQ2NTU1Mg%3D%3D%0A&v=2cd88088ead8b53051bce19af58a58f0e3d413df

APIs

  1. 使用房卡
POST /users/:id/use

{"cardnumber": 10}
  1. 用户受邀注册
POST /users/:id/invited_by

{"parentid": :parentid}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment