WeChat how the user's information to me how to set the URL of background services??
Note: the user to open the public, the user's information is sent to my background
CodePudding user response:
This process is how walk??Development book just said, is the XML form data sent over?????? How this was sent?????? Solve???
CodePudding user response:
Get the user locationOpened a public report location interface, the user session after the attention in the public, can play box number let user to confirm whether to allow the public to use its geographic location, bounced after attention appear only once, after the user details page, in the public,
The third party after receiving report location information, you just need to reply success shows that received, are not allowed to reply message to the fans,
Get the user location
After the user agrees to report the location, each number in the public session, will report when entering the geographical position, report to the geographical position to push XML data packets to the developers to fill in the URL,
Push the XML packet example:
Writing on the book??????? How to bring these data?????? Anxious for me??? The contact WeChat only yesterday
CodePudding user response:
https://blog.csdn.net/bj123467/article/details/72909878The way you said you must configure the url, but the url can only configure a limit is larger, the above link is another way you can have a try
CodePudding user response:
@ SuppressWarnings (" serial ")@ WebServlet (urlPatterns="/wx/housekeeper," name="wxHouseKeeperServlet")
Public class HouseKeeper extends the HttpServlet {
Private static final String TOKEN="XXXXXXXXXXXXXXXXXX";
Private Logger Logger=LoggerFactory. GetLogger (HouseKeeper. Class);
@ Override
Protected void doGet (it request, HttpServletResponse response)
Throws ServletException, IOException {
Try {
//developers to submit information, WeChat server will send a GET request to fill in the address of the server URL, GET request parameters to carry
String signature=request. The getParameter (" signature ");//WeChat encrypted signature (token, timestamp, nonce)
String timestamp=request. The getParameter (" timestamp ");//timestamp
String nonce=request. The getParameter (" nonce ");//random number
String echostr=request. The getParameter (" echostr ");//random string
//will be token, timestamp, nonce three parameters dictionary sequence sorting
String [] params=new String [] {TOKEN, timestamp, nonce};
The Arrays. Sort (params);
//string concatenation three parameters into a string of sha1 encryption
String clearText=params params [0] + [1] + params [2].
String algorithm="SHA - 1";
The String sign=new String (
Hex. EncodeHex (MessageDigest. GetInstance (algorithm). The digest ((clearText). GetBytes ()), true));
//developers to get the encrypted string can be compared with signature, identifying the request from WeChat
If (signature equals (sign)) {
The response. GetWriter (). Print (echostr);
}
} the catch (Exception e) {
e.printStackTrace();
}
}
@ Override
Protected void doPost (it request, HttpServletResponse response) {
Try {
//XML processing into a map
Map
Logger. The info (" get WeChat returns the parameters of the + + + + + + + + + + + + + + + + + + + + param: {} ", JsonUtil. ObjToString (param));
PrintWriter out=response. GetWriter ();
No.//I'm here to get the current public location, only to get the coordinates in the cookies
If (param. Get (" MsgType ".) the equals (" event ")) {
CookieUtils. SetCookie (response, "point", param) get (" Longitude ") + ", "+ param. Get (" Latitude"), 604800);
}
WXAuthUtil. GetInstance (). DealMessage (param);
String resXml="";
Out. Write (resXml);
Out. The flush ();
Out. The close ();
} the catch (IOException e) {
e.printStackTrace();
}
}
}
CodePudding user response:
Public window popup for the geographic location of the tip will only focus on for the first time in the pop-up, refocus, also will pop up?