Tag Archives: wechat

[Solved] wxauto error: ImportError: DLL load failed while importing win32gui: Can’t find the specified program

Background

Using wxauto to develop wechat robot, there was an error when running the program in Pycharm

Error prompt

Traceback (most recent call last):
  File "D:\Project\wechatBot\test.py", line 2, in <module>
    from wxauto import WeChat
  File "C:\Users\pokeu\anaconda3\envs\wechatbot\lib\site-packages\wxauto\__init__.py", line 2, in <module>
    from .wxauto import WxParam, WxUtils, WeChat, COPYDICT
  File "C:\Users\pokeu\anaconda3\envs\wechatbot\lib\site-packages\wxauto\wxauto.py", line 10, in <module>
    import win32gui, win32con
ImportError: DLL load failed while importing win32gui: Can't find the specified program.

Solution:

Check if the win32gui.pyd file exists in the C:\Users\username\anaconda3\envs\wechatbot\Lib\site-packages\win32 directory

If not, run pip install pywin32 to install it.

Add C:\Users\username\anaconda3\envs\wechatbot\Lib\site-packages\pywin32_system32 to the system environment variable.

Notes.
a. User name Replace with your own user name.
b. The first half of C:\Users\username\anaconda3 is the installation path of anaconda, replace it with your own.
c. \envs\wechatbot is the path of the new environment I created (wechatbot), replace it with your own environment, or ignore it if you didn’t create it, and just find \Lib\site-packages\win32.

In the original import … import the following library before the original import …: import pywintypes, e.g.

import pywintypes
#import pythoncom # Uncomment this if some other DLL load will fail
from wxauto import WeChat
import time, random

Now run the program again, and there should be no error.

[Solved] Wechat IOS signature error config:fail

When sharing on wechat H5, I found that Android was ok, and IOS kept reporting config:fail

Later, it was found that noncestr and timestamp must not be int values. If the int returned in the background needs to be converted into a string

 wx.config({
        debug: false, // Enable debug mode, the return value of all api calls will be alerted out in the client side, if you want to see the incoming parameters, you can open it in the pc side, the parameter information will be typed out by log, only when the pc side will be printed.
        appId: '*******', // required, the unique identifier of the public number
        timestamp: res.timestamp + '', // required, the timestamp of the signature generation
        nonceStr: res.nonceStr + '', // required, the random string to generate the signature
        signature: res.signature, // mandatory, signature
        jsApiList: ['updateAppMessageShareData', 'hideMenuItems'] // required, the list of JS interfaces to be used
    })

How to Solve Vue3 jweixin-module Error

Use in vue3:

var jweixin = require('jweixin-module');

It will be compiled with the error: require is not defined, there is no require module, change to import, because jweixin-module does not support export writing, so the introduction can not succeed.

Solution:
Use a third-party wrapper jdk: weixin-js-sdk

npm install weixin-js-sdk -S

import jweixin from 'weixin-js-sdk'

Wechat Payment V2 Error: No appropriate protocol [How to Solve]

Error message:

An error is reported when the refund interface calls the certificate:
no approve protocol (protocol is disabled or cipher suits are inappropriate)

Solution:

1. [not recommended] Find jdk/jre/lib/security/java.security file to modify , remove the TLSv1 , so the production environment still have to change, so give up this method.

2. [recommended] solution: find the class corresponding to the SDK and modify it according to the following figure

How to Solve Android wechat payment Error: error_code = -1

Usually this error is a signature error

This figure is the case given by wechat. The signature is MD5. Note that there is no colon here. Check whether there is more colon

For example:

MD5: 01:B3:DF:B0:8F:AB:39:07:A2:F7:F3:CF:54:F0:1E:C9

Then I fill in:

01B3DFB08FAB3907A2F7F3CF54F01EC9

It’s easy to make mistakes here. I write it down here. I hope it can help you!

As for signature acquisition: Click gradle on the far right of Android studio, select singreport, double-click, and you can see it in build,

By the way, if you want to build Signature files are configured under gradle (APP)

[Solved] Mybatis Error: attempting to get column ‘XX’ from result set

Summary of common causes
1. The field name in the encapsulation set is inconsistent with the database column name. Check whether it is consistent and whether there is this field
2. Using Lombok or other operations results in no parameter free structure or no get/set
3. Use Druid, because the version problem leads to exception handling for the time type localdatetime.class; This solution: do not use druid or use other database connection sources for replacement or Druid version upgrade.
Let’s talk about the source of this exception first:
getResult in basetypehandler.java

  public T getResult(ResultSet rs, String columnName) throws SQLException {
    try {
      // Map database fields and entity class attributes in the result set
      return getNullableResult(rs, columnName);
    } catch (Exception e) {
      throw new ResultMapException("Error attempting to get column '" + columnName + "' from result set.  Cause: " + e, e);
    }
  }

There will be exceptions before this exception, that is, the exception will be caused by many reasons, which means there will be many solutions for the exception. Here is the processing and positioning process of the third exception handling scheme.
problem scenario description
Query the qualified course record information by date. The time field in the entity class is starttime (Format: yyyy MM DD HH: mm: SS), and the field in the database is start_ Time, field type datetime.
Stack exception information (some stack information is deleted due to length reason):

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'start_time' from result set.  Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'start_time' from result set.  Cause: java.sql.SQLFeatureNotSupportedException
	at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
Caused by: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'start_time' from result set.  Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'start_time' from result set.  Cause: java.sql.SQLFeatureNotSupportedException
	at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:87)
	... 73 more
Caused by: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'start_time' from result set.  Cause: java.sql.SQLFeatureNotSupportedException
	at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:85)
	... 99 more
Caused by: java.sql.SQLFeatureNotSupportedException
	at com.alibaba.druid.pool.DruidPooledResultSet.getObject(DruidPooledResultSet.java:1771)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:69)
	at com.sun.proxy.$Proxy190.getObject(Unknown Source)
	at org.apache.ibatis.type.LocalDateTimeTypeHandler.getNullableResult(LocalDateTimeTypeHandler.java:38)
	at org.apache.ibatis.type.LocalDateTimeTypeHandler.getNullableResult(LocalDateTimeTypeHandler.java:28)
	at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:85)
	... 101 more

Look at the stack information from the beginning. Obviously, it is the exception thrown by getnullableresult in localdatetimetypehandler.java.The earliest exception information: java.sql.sqlfeaturenotsupportedexception.
first look at getnullableresult in localdatetimetypehandler.java

  public LocalDateTime getNullableResult(ResultSet rs, String columnName) throws SQLException {
    return rs.getObject(columnName, LocalDateTime.class);
  }

 rs.getobject has many implementation methods. Because the Druid database connection source is used (the original version is 1.0.28), you can directly locate GetObject in druidpooledresultset.java:

 public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

Looking through the source code according to druid1.0.28, it is found that localdatetime.Class about date type processing instructions are not supported, and sqlfeaturenotsupportedexception is thrown directly. Modify the Druid version in pom.xml, upgrade to 1.2.1, and then take a look at the implementation of this version:

  public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
        try {
            return this.rs.getObject(columnLabel, type);
        } catch (Throwable var4) {
            throw this.checkException(var4);
        }
    }

Note: the higher version supports localdatetime.Class processing. It is normal after retesting!

WeChat official account web page authorized, redirect_ Uri parameter error, solution!

Recently, WeChat has been experiencing some problems, such as WeChat official account authorization, redirect_ The URI parameter is wrong, but many articles on the Internet can’t be explained clearly. They have been revised over and over again, but they still can’t.

The callback in WeChat official account can only be a full domain name, such as your visit. http://www.xx.com/authorize Authentication, but callback to fill in www.xx.com And then the request parameter is HTTP% 3A% 2F% 2 fwww.xx.com%2fauthorize , URLEncode is required

Wechat applet animate animation does not implement animation effect for the first time

The main problem is that your.wxss file does not set the appropriate properties; For example, if use Animation. Left (number | string value) element to the left, the Animation is a specific execution of Animation from the time of the elements of the left value to the left you new set value; So if you don’t have an attribute in your original element style you’re not going to get the initial value, you’re not going to be able to animate it, so you’re going to do a left assignment and you’re not going to animate it.

Deployment project websocket failed: error during websocket Handshake: unexpected response code: 400

Fixed nginx forwarding WebSocket 400 error
Reprint link: https://www.cnblogs.com/duanweishi/p/9286461.html

because the personal server has a number of projects, configured with a secondary domain name, the need to forward the secondary domain name, in the forwarding work this quickly took the famous nginx. Before this, all the projects had no problem running forward, but today, when deploying a project with WebSocket communication, an unexpected error was reported, with the following error message:
Failed: Error during WebSocket handshake: Unexpected response code: 400
. This error worked in both the local test environment and access to non-Nginx forwarding, which inferred that the problem should have occurred in nginx forwarding.
Then, with the help of Google, saw the socket. IO official issues have a discussion about this problem, link: https://github.com/socketio/socket.io/issues/1942
Solution
read the solution in the discussion section, the problem appears in the configuration file of nginx, and the nginx.conf file needs to be modified. Type vim /etc/nginx/nginx.conf into the Linux terminal and find the location. The configuration file is as follows:

server {
        listen       80;
        server_name  school.godotdotdot.com;
        charset utf-8;

        location/{
            proxy_pass http://127.0.0.1:3000;
            proxy_set_header Host $host;
            proxy_http_version 1.1; 
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_connect_timeout 60;
           proxy_read_timeout 600;
           proxy_send_timeout 600;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
 }

The most important of these are the following three lines

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

The first line tells Nginx to use the HTTP/1.1 communication protocol, which websoket must use.
The second and third lines tell Nginx to respond to an HTTP upgrade request when it wants to use WebSocket.
Supplement:

	server {
	        listen       80;
	        server_name  school.godotdotdot.com;
	        charset utf-8;
	        
			proxy_http_version 1.1; 
			proxy_set_header Upgrade $http_upgrade;
			proxy_set_header Connection "upgrade";
	

	        location/{
	            proxy_pass http://127.0.0.1:3000;
	            proxy_set_header Host $host;
	            proxy_set_header X-Real-IP $remote_addr;
	            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	            proxy_connect_timeout 60;
	           proxy_read_timeout 600;
	           proxy_send_timeout 600;
	        }

	        error_page   500 502 503 504  /50x.html;
	        location = /50x.html {
	            root   html;
	        }
	 }