- 微信登录签名不一致
APP调起微信登录报签名不一致 首先自查微信后台配置签名为 [图片] 签名工具获取的签名也是 [图片] APPID:wx9563f326a2ccf9e3 openSDK版本:最新版本 微信号:bob1892743 时间点:2021/02/22/14:03
2021-02-22 - 微信支付统一下单报错System_Error?
<xml> <appid>wx62fa8e235e8ab***</appid> <attach>购买vip</attach> <body>购买vip</body> <mch_id>14911**282</mch_id> <nonce_str>XZBrsskErFXJKp7k8qkYXQZ8nuyLp8U7</nonce_str> <notify_url>http://appn.holosz.com/pay/notifyWXPay</notify_url> <out_trade_no>077515928152360332572</out_trade_no> <sign>771B96659F13DB4DAD41418956C82E18</sign> <spbill_create_ip>10.10.20.16</spbill_create_ip> <total_fee>990</total_fee> <trade_type>APP</trade_type> </xml> 您好,利用统一下单接口,下单,上面是请求参数,一直一直报系统错误,之前可以用
2020-06-22 - 安卓移动端接入扫码登录auth时报错?
按照步骤,安卓移动端接入扫码登录,auth报错步骤如下 //获取token private void wechatfirst() { // String url = "http://eyetrain.holosz.com/loginC/getKey"; String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=我的APPID&secret=我的secret"; OkHttpClient okHttpClient = new OkHttpClient(); Request request = new Request.Builder().url(url).get().build(); okHttpClient.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { String result = response.body().string(); Gson gson = new Gson(); WeChatFirst resultdata = gson.fromJson(result, WeChatFirst.class); String access_token = resultdata.getAccess_token(); getLoginQrCode(access_token); } }); } /** * 获取二维码 * 获取ticket */ private void getLoginQrCode(String token) { String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token="+token+"&type=2"; // loginPresenter.getLoginQrCode(); OkHttpClient okHttpClient = new OkHttpClient(); /* final Request request = new Request.Builder().url(url).get().build();*/ final Request request = new Request.Builder() // .url("http://eyetrain.holosz.com/loginC/getsdkTicket") .url(url) .get().build(); okHttpClient.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { // Toast.makeText(LoginActivity.this, "网络请求失败,请检查网络", Toast.LENGTH_LONG).show(); } @Override public void onResponse(Call call, Response response) throws IOException { String result = response.body().string(); Gson gson = new Gson(); TicketBean resultdata = gson.fromJson(result, TicketBean.class); String ticket = resultdata.getTicket();//拿到Ticket StringBuilder str = new StringBuilder();// 定义变长字符串 Random random = new Random(); // 随机生成数字,并添加到字符串 for (int i = 0; i < 8; i++) { str.append(random.nextInt(10)); } String noncestr = str.toString(); String timeStamp = new SimpleDateFormat(TIME_FORMAT).format(new Date()); String string1 = String.format("appid=%s&noncestr=%s&sdk_ticket=%s×tamp=%s", Constant.WeChatAppID, noncestr, ticket, timeStamp); String sha = EncryptUtils.getSHA(string1); sign(noncestr, timeStamp, sha); } }); } //第三步 private void sign(String noncestr, String timeStamp, String sha) { oauth.auth(Constant.WeChatAppID, "snsapi_userinfo", noncestr, timeStamp, sha, this); } 报错如下 [图片]
2020-02-11 - 微信扫码登录?
请问在APP集成微信扫码登录的时候,如果在刷新二维码的时候,前二维码还在有效期内,二维码会变化吗? 因为此时在二维码有效期内,我重新请求二维码,SDK-ticket没有变化 void onAuthGotQrcode(String var1, byte[] var2) 此方法没有回调
2020-01-08 - 微信客服自动回复图片报错45047?
微信小程序客服,自动回复图片,周五调试自动回复正常,周一调试发现自动回复报错 sendMessage >>>>>>>{"errcode":45047,"errmsg":"out of response count limit hint: [SJW2DA08438630]"} [图片] 这个超限是啥超限?对于一个从来没用过此小程序的新用户,同样报了此问题;
2019-10-14 - 微信客服自动回复图片?
在调试微信客服自动回复图片时,所有都是按照文档要求开发,但是无法自动回复 首先:自动回复配置如下: [图片] 第二:验证加密(通过): [代码]boolean[代码] [代码]isGet = request.getMethod().toLowerCase().equals([代码][代码]"get"[代码][代码]);[代码][代码] [代码][代码]if[代码] [代码](isGet) {[代码][代码] [代码][代码]// 微信加密签名[代码][代码] [代码][代码]String signature = request.getParameter([代码][代码]"signature"[代码][代码]);[代码][代码] [代码][代码]// 时间戳[代码][代码] [代码][代码]String timestamp = request.getParameter([代码][代码]"timestamp"[代码][代码]);[代码][代码] [代码][代码]// 随机数[代码][代码] [代码][代码]String nonce = request.getParameter([代码][代码]"nonce"[代码][代码]);[代码][代码] [代码][代码]// 随机字符串[代码][代码] [代码][代码]String echostr = request.getParameter([代码][代码]"echostr"[代码][代码]);[代码] [代码] [代码][代码]// 通过检验signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败[代码][代码] [代码][代码]if[代码] [代码](signature != [代码][代码]null[代码] [代码]&& WeChatUtil.checkSignature(signature, timestamp, nonce)) {[代码][代码] [代码][代码]logger.debug([代码][代码]"signature == "[代码] [代码]+ signature);[代码][代码] [代码][代码]try[代码] [代码]{[代码][代码] [代码][代码]PrintWriter print = response.getWriter();[代码][代码] [代码][代码]print.write(echostr);[代码][代码] [代码][代码]print.flush();[代码][代码] [代码][代码]} [代码][代码]catch[代码] [代码](IOException e) {[代码][代码] [代码][代码]logger.error([代码][代码]"微信消息接收和token验证异常"[代码][代码], e);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码]第三:自动回复 自动回复先上传临时素材到回信服务,并获取mediaId [代码]//先上传临时素材到微信服务[代码] [代码] [代码][代码]String mediaId = uploadFileToWeChat(WeChatUtil.REQ_MESSAGE_TYPE_IMAGE);[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 上传图片到微信服务[代码][代码] [代码][代码]*[代码][代码] [代码][代码]* @param[代码][代码] [代码][代码]* @return[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]@Override[代码][代码] [代码][代码]public[代码] [代码]String uploadFileToWeChat(String type) {[代码][代码] [代码][代码]String accessToken = weiXinToken.getAccessToken();[代码][代码] [代码][代码]System.out.println([代码][代码]"token == "[代码] [代码]+ accessToken);[代码][代码] [代码][代码]RestTemplate restTemplate = [代码][代码]new[代码] [代码]RestTemplate();[代码][代码] [代码][代码]HttpHeaders headers = [代码][代码]new[代码] [代码]HttpHeaders();[代码][代码] [代码][代码]headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);[代码][代码] [代码][代码]File file = [代码][代码]new[代码] [代码]File(IMAGE_PATH);[代码][代码] [代码][代码]if[代码] [代码](!file.exists() || !file.isFile()) {[代码][代码] [代码][代码]return[代码] [代码]null[代码][代码];[代码][代码] [代码][代码]}[代码][代码] [代码][代码]StringBuilder sb = [代码][代码]new[代码] [代码]StringBuilder();[代码][代码] [代码][代码]sb.append(weixinImageUpload)[代码][代码] [代码][代码].append([代码][代码]"access_token="[代码][代码])[代码][代码] [代码][代码].append(accessToken)[代码][代码] [代码][代码].append([代码][代码]"&type="[代码][代码])[代码][代码] [代码][代码].append(type);[代码] [代码] [代码][代码]String mediaId = WeChatUtil.httpRequest(sb.toString(), file);[代码] [代码] [代码][代码]return[代码] [代码]mediaId;[代码][代码] [代码][代码]}[代码] 获取到mediaId后,然后自动回复开发 [代码]/**[代码][代码] [代码][代码]* 此处自动回复文本[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]TextMessageResponseVo textMessageResponseVo = [代码][代码]new[代码] [代码]TextMessageResponseVo();[代码][代码] [代码][代码]textMessageResponseVo.setFromUserName(requestMessageMap.get([代码][代码]"ToUserName"[代码][代码]));[代码][代码] [代码][代码]textMessageResponseVo.setToUserName(requestMessageMap.get([代码][代码]"FromUserName"[代码][代码]));[代码][代码] [代码][代码]textMessageResponseVo.setMsgType([代码][代码]"text"[代码][代码]);[代码][代码] [代码][代码]textMessageResponseVo.setCreateTime(System.currentTimeMillis() / [代码][代码]1000[代码][代码]);[代码][代码] [代码][代码]textMessageResponseVo.setContent([代码][代码]"你好"[代码][代码]);[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 此处自动回复图片[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]ImageMessageResponseVo imageMessageResponseVo = [代码][代码]new[代码] [代码]ImageMessageResponseVo();[代码][代码] [代码][代码]imageMessageResponseVo.setFromUserName(requestMessageMap.get([代码][代码]"FromUserName"[代码][代码]));[代码][代码] [代码][代码]imageMessageResponseVo.setToUserName(requestMessageMap.get([代码][代码]"ToUserName"[代码][代码]));[代码][代码] [代码][代码]imageMessageResponseVo.setMsgType([代码][代码]"image"[代码][代码]);[代码][代码] [代码][代码]imageMessageResponseVo.setCreateTime(System.currentTimeMillis() / [代码][代码]1000[代码][代码]);[代码][代码] [代码][代码]AutoAnswer autoAnswer = [代码][代码]new[代码] [代码]AutoAnswer();[代码][代码] [代码][代码]autoAnswer.setMediaId(mediaId);[代码][代码] [代码][代码]imageMessageResponseVo.setImage(autoAnswer);[代码][代码] [代码][代码]System.out.println([代码][代码]"textMessageResponseVo>>>>>>>>"[代码][代码]+imageMessageResponseVo.toString());[代码][代码] [代码][代码]String result = WeChatUtil.messageToXml(textMessageResponseVo);[代码][代码] [代码][代码]System.out.println([代码][代码]"result XML CDATA +++++++++++++++++++++++++"[代码] [代码]+ result);[代码][代码] [代码][代码]return[代码] [代码]result;[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 文本消息转换成xml[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]public[代码] [代码]static[代码] [代码]String messageToXml(TextMessageResponseVo textMessageResponseVo) {[代码][代码] [代码][代码]xstream.alias([代码][代码]"xml"[代码][代码], textMessageResponseVo.getClass());[代码][代码] [代码][代码]return[代码] [代码]xstream.toXML(textMessageResponseVo);[代码] [代码] [代码][代码]}[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 图片[代码][代码] [代码][代码]* @param imageMessageResponseVo[代码][代码] [代码][代码]* @return[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]public[代码] [代码]static[代码] [代码]String messageToXml(ImageMessageResponseVo imageMessageResponseVo) {[代码][代码] [代码][代码]xstream.alias([代码][代码]"xml"[代码][代码], imageMessageResponseVo.getClass());[代码][代码] [代码][代码]return[代码] [代码]xstream.toXML(imageMessageResponseVo);[代码] [代码] [代码][代码]}[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 扩展xstream使其支持CDATA[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]private[代码] [代码]static[代码] [代码]XStream xstream = [代码][代码]new[代码] [代码]XStream([代码][代码]new[代码] [代码]XppDriver() {[代码][代码] [代码][代码]@Override[代码][代码] [代码][代码]public[代码] [代码]HierarchicalStreamWriter createWriter(Writer out) {[代码][代码] [代码][代码]return[代码] [代码]new[代码] [代码]PrettyPrintWriter(out) {[代码][代码] [代码][代码]// 对所有xml节点的转换都增加CDATA标记[代码][代码] [代码][代码]boolean[代码] [代码]cdata = [代码][代码]true[代码][代码];[代码] [代码] [代码][代码]@Override[代码][代码] [代码][代码]@SuppressWarnings[代码][代码]([代码][代码]"unchecked"[代码][代码])[代码][代码] [代码][代码]public[代码] [代码]void[代码] [代码]startNode(String name, Class clazz) {[代码][代码] [代码][代码]super[代码][代码].startNode(name, clazz);[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]@Override[代码][代码] [代码][代码]protected[代码] [代码]void[代码] [代码]writeText(QuickWriter writer, String text) {[代码][代码] [代码][代码]if[代码] [代码](cdata) {[代码][代码] [代码][代码]writer.write([代码][代码]"<![CDATA["[代码][代码]);[代码][代码] [代码][代码]writer.write(text);[代码][代码] [代码][代码]writer.write([代码][代码]"]]>"[代码][代码]);[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]writer.write(text);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]};[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码] 最后,响应微信服务的是一串String的xml [代码]//文本响应微信的xml[代码][代码]<xml>[代码][代码] [代码][代码]<ToUserName><![CDATA[onv1V4-zyxgliQlXbaBujrNT-ycs]]></ToUserName>[代码][代码] [代码][代码]<FromUserName><![CDATA[gh_dc0815388d0f]]></FromUserName>[代码][代码] [代码][代码]<CreateTime><![CDATA[[代码][代码]1570614951[代码][代码]]]></CreateTime>[代码][代码] [代码][代码]<MsgType><![CDATA[text]]></MsgType>[代码][代码] [代码][代码]<Content><![CDATA[你好]]></Content>[代码][代码]</xml>[代码][代码] [代码] [代码] [代码] [代码]//图片响应微信的xml[代码][代码] [代码] [代码]<xml>[代码] [代码] [代码][代码]<ToUserName><![CDATA[onv1V4-zyxgliQlXbaBujrNT-ycs]]></ToUserName>[代码] [代码] [代码][代码]<FromUserName><![CDATA[gh_dc0815388d0f]]></FromUserName>[代码] [代码] [代码][代码]<CreateTime><![CDATA[[代码][代码]1570670451[代码][代码]]]></CreateTime>[代码] [代码] [代码][代码]<MsgType><![CDATA[image]]></MsgType>[代码] [代码] [代码][代码]<Image>[代码] [代码] [代码][代码]<MediaId><![CDATA[ukM01FczEHwYUthTQ_Sf_6XNgI1_2lScqCFuIWOs8zQ8CGp0kgH98SS8B4SxdznU]]></MediaId>[代码] [代码] [代码][代码]</Image>[代码] [代码]</xml>[代码] [代码][代码] 但是最后没有收到微信自动回复,请求各位大佬指教 ;
2019-10-09