liyiorg / weixin-popular

微信SDK JAVA (公众平台、开放平台、 商户平台、 服务商平台)
Apache License 2.0
2.5k stars 1.06k forks source link

您好,关于开放平台通过code获取snsToken,与现在的官方文档不一致的地方。 #79

Closed whyyue closed 7 years ago

whyyue commented 7 years ago

微信登录官方文档中的第二步,返回的json如下: { "access_token":"ACCESS_TOKEN", "expires_in":7200, "refresh_token":"REFRESH_TOKEN", "openid":"OPENID", "scope":"SCOPE", "unionid": "o6_bmasdasdsad6_2sgVt7hMZOPfL" } 中有unionid一项,但在贵代码中,得到的SnsToken,无法getUnionid,是否是你们未写这一项呢?还是隐藏在别的地方,由于在下太粗心未找到😂

盼回复!祝好!

官方文档地址:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=&lang=zh_CN

liyiorg commented 7 years ago

应该是新添加的字段,原文档中没有unionid。下版本会更新

whyyue commented 7 years ago

好的。之前好像是用openid。现在同一个账号,网页扫码和android端第三方等登录方式的unionid相同,但openid不一样。

whyyue commented 7 years ago

您好,想请教一下,企业支付总是报transfersResult为空指针,代码是这么写的: Transfers transfers = new Transfers(); transfers.setMch_appid(Appid); transfers.setMchid(Mchid); transfers.setNonce_str(UUID.randomUUID().toString().replace("-", "")); transfers.setOpenid(openId); Date startDate = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); String startDay = sdf.format(startDate); String outTradeNo = startDay + Sha1Util.random6digit(); transfers.setPartner_trade_no(outTradeNo); transfers.setCheck_name("NO_CHECK");//"NO_CHECK"||"FORCE_CHECK" transfers.setAmount(amount);//单位分 transfers.setDesc("withdraw"); transfers.setSpbill_create_ip("115.159.149.XX"); PayMchAPI.mmpaymkttransfersPromotionTransfers(transfers, Key); TransfersResult transfersResult = PayMchAPI.mmpaymkttransfersPromotionTransfers(transfers, Key);

看了好久不知道哪里有问题。。。难道不是这么用的吗

liyiorg commented 7 years ago

设置证书了吗,没有的话先去设置一个。 https://github.com/liyiorg/weixin-popular/wiki/%E8%AE%BE%E7%BD%AEAPI%20MCH%20KeyStore

jinggoing commented 7 years ago

请问企业付款也是需要设置证书的吗? @liyiorg

liyiorg commented 7 years ago

@jinggoing 需要