亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

??
1. ?????? ????
2. ??? ??
1. ??? ?? ??
2. ?? ??? ??
1. WeChat ?? ?? ???
???? ?????. 2. ???, ???? ???? ??? ??
? ?? ??? ?? ?? WeChat ?? ??? ?? ???

WeChat ?? ??? ?? ???

May 14, 2018 pm 03:28 PM
?? ?? ???

WeChat ?? ??? ??? ????? ?? WeChat ???? ???? ??? ?? ? ??? ???? ????

?? ??? ???? http://mp.weixin.qq.com/? ????? ??-?? ??-?? ??-?? ??? ???? ?? ??? WeChat ?? ??? ??? ?? ??.

1. ?????? ????

微信公眾平臺開發(fā)系列

?? ???? ?? ????

  • ?? ?? ??? ?????. ???? ???? ???

  • ????? ???? ??

???? ??? ??? ???? ?? ?????? ?? ???? ???. ??? ? ?? ???? ?????. ?, ???? ?? ?? ??? ???? ????? ???? ?? ? ????(?? ???? ??? ??? ?? ? ?? ?????. ?? ??? ?? ??? ??? ?? ????). CRM ???). ??? ?? ?? ???? WeChat ???? ?? ????? ???.

2. ??? ??

??? ???? ?? ? ?? ??? ??, ? ?? ???? ??? ??? ?????.

1. ??? ?? ??

1.1 ?? ???:

??? ????? ?? ?? ??? ??? ??? ??? ? ?? ???? ???? ??? ? ????. ???? ??? ???? ?????.

1.2 ?? ???:

????? ???? ??? ?? ??? ???? ??? ?? ???? ?????. ??? ???? ?? ????? ?? ??? ????? ???? ???? ??? ?????. ?? ?? ? ?? ?? ??? ????? ??? ? ??? ?????.

1.3 ???? ???:

???? ??? ??? ?????? ???? ?? ???? ?? ??? ??? ?????. ?? ??? ??? ? ?? ?? ?? ?? ?? ? ?? ??? ???? ?? ???? ??? ? ????. ? ?? ?? ??? ?? ??? ???? ?? ???? ??? ? ??? ????. ?? ??, ???? "??? ???"? ???? ??? ???? ?? ???? ????? ??? ? ??.

1.4 ?? ???:

?? ????? ?? ??? ???? ?? ??? ????. ???? ??? ? ? ??? ??? ??? ?? ?? ? ?? ??? ? ????.

1.5 ??? ?? ??? :

???? ?? ??? ???? ?? ?? ?? ? ? ????. ? ???? ?? ?? 4.5? ???? ?? ???? ?????. ?? ??, ???? ??? ??? ? ?? ??? ??? ????

2. ?? ??? ??

2.1 ?? ???
???? ???? ???? ?? ????? ?? ?? ??? ??? ?????. ??? ?????. ?? ????? ?? ??? ??? ? ????.

微信公眾平臺開發(fā)系列

2.2 ??? ???
??? ???? ?? ????? ?? ? ? ?? ??? ?????. ? ??? ??? ???? ? ??? ??? ? ? ????. (?? ??? ? ??? ??? ??? ?? ????.)

微信公眾平臺開發(fā)系列

2.3 ????
????? ???? ?? ???? ??? ???? ?? ?? ???? ??? ????.
?? ???? ?????? ????? ??? ??? ??? ? ?? ??? ???? ??????.

1. ??? ??? ??

??????. WeChat Work ????? ?? ??? ???? ?? ??? ???? ???? ???. ??? ?? ???? ???. URL ?? ??? WeChat? ??? ??? ??? ?? ??? ???? URL? ??? ?? ?????. ??? ??? WeChat ??? ???????. ???? WeChat ????? ??????, ??? ???? ???? ?? ????? ?????? ???? ? ?????.

?? ??? ? ????. ???? ?? WeChat? ??? URL? ?? GET ??? ?? ?????? ??? ? ??? ?????. GET ???? ??? ??? ?? ??? ? ????.

微信公眾平臺開發(fā)系列

2. GET ??? ??

???? ? ? ??? POST ? GET ???? ???? ???. GET ??? WeChat ??? ?? ??? ????, POST? ??? ??? ?????.

? ??? HelloWeChat? ???? ?? GET ???? ?????

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
        // TODO 為了簡單起見,先不對消息來源進行校驗
        response.setContentType("text/html;charset=UTF-8"); 
        PrintWriter pw = response.getWriter(); 
        String echo = request.getParameter("echostr"); 
        echo = new String(echo.getBytes("ISO-8859-1"),"UTF-8"); 
        pw.println(echo); 
    }

????? http://localhost:8080/QiyadengWeb/HelloWeChat?echostr=hello ???? ??? ? ? ????. ??? ??? ?? ??? ??? ? ???? ???? ???. ?? ???.

3. POST ??? ??

POST ???? ?? WeChat ?? ????? ?? XML? ???? ??? ?? ??? ??? ??? ?????. ? ?? ??? ?? ???? ?? ?? ?? ??? ???? ????? ?? ?? ??? XML? ???? WeChat ?? ???? ??? ? ????.

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
        response.setContentType("text/html;charset=UTF-8"); 
        PrintWriter pw = response.getWriter(); 
        String wxMsgXml = IOUtils.toString(request.getInputStream(),"utf-8"); 
        WeChatTextMessage textMsg = null; 
        try { 
            textMsg = getWeChatTextMessage(wxMsgXml); 
        } catch (Exception e) { 
            e.printStackTrace(); 
        } 
        StringBuffer replyMsg = new StringBuffer(); 
        if(textMsg != null){ 
            //增加你所需要的處理邏輯,這里只是簡單重復消息
            replyMsg.append("您給我的消息是:"); 
            replyMsg.append(textMsg.getContent()); 
        } 
        else{ 
            replyMsg.append(":)不是文本的消息,我暫時看不懂"); 
        } 
        String returnXml = getReplyTextMessage(replyMsg.toString(), textMsg.getFromUserName()); 
        pw.println(returnXml); 
    }

???? ???? Fiddler? ???? ??? ??? ????. ?? ???? ?? ??? ??? ?? ?? ?? ??? WeChat POST ???? ?????? ? ????. Fiddler? POST ???? ???? ??? ?? ??? ??? ??? ????? ???.

微信公眾平臺開發(fā)系列

4. ?? ? ???

? ?? ??? ???? ?? ??? ??? ????. ??? ???? ?????? .

微信公眾平臺開發(fā)系列

5. ??? ?????

maven? ???? ??? ?? ?? ???? ???? ???. Maven? ?? ???? ?? ??? ?????? ?? ?? ??? ???? ???.

<dependency> 
    <groupId>joda-time</groupId> 
    <artifactId>joda-time</artifactId> 
    <version>2.2</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.commons</groupId> 
    <artifactId>commons-io</artifactId> 
    <version>1.3.2</version> 
</dependency> 
<dependency> 
    <groupId>com.thoughtworks.xstream</groupId> 
    <artifactId>xstream</artifactId> 
    <version>1.4.3</version> 
</dependency>

6. ?? ??

package com.qiyadeng.wechat; 
import java.io.IOException; 
import java.io.PrintWriter; 
import java.util.Date; 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
import org.apache.commons.io.IOUtils; 
import com.thoughtworks.xstream.XStream; 
import com.thoughtworks.xstream.io.xml.DomDriver; 
/**
 * Servlet implementation class HelloWeChat
 */
public class HelloWeChat extends HttpServlet { 
    private static final long serialVersionUID = 1L; 
    /**
     * @see HttpServlet#HttpServlet()
     */
    public HelloWeChat() { 
        super(); 
    } 
    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
        // TODO 為了簡單起見,先不對消息來源進行校驗
        response.setContentType("text/html;charset=UTF-8"); 
        PrintWriter pw = response.getWriter(); 
        String echo = request.getParameter("echostr"); 
        echo = new String(echo.getBytes("ISO-8859-1"),"UTF-8"); 
        pw.println(echo); 
    } 
    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
        response.setContentType("text/html;charset=UTF-8"); 
        PrintWriter pw = response.getWriter(); 
        String wxMsgXml = IOUtils.toString(request.getInputStream(),"utf-8"); 
        WeChatTextMessage textMsg = null; 
        try { 
            textMsg = getWeChatTextMessage(wxMsgXml); 
        } catch (Exception e) { 
            e.printStackTrace(); 
        } 
        StringBuffer replyMsg = new StringBuffer(); 
        if(textMsg != null){ 
            //增加你所需要的處理邏輯,這里只是簡單重復消息
            replyMsg.append("您給我的消息是:"); 
            replyMsg.append(textMsg.getContent()); 
        } 
        else{ 
            replyMsg.append(":)不是文本的消息,我暫時看不懂"); 
        } 
        String returnXml = getReplyTextMessage(replyMsg.toString(), textMsg.getFromUserName()); 
        pw.println(returnXml); 
    } 
    private WeChatTextMessage getWeChatTextMessage(String xml){ 
        XStream xstream = new XStream(new DomDriver()); 
        xstream.alias("xml", WeChatTextMessage.class); 
        xstream.aliasField("ToUserName", WeChatTextMessage.class, "toUserName"); 
        xstream.aliasField("FromUserName", WeChatTextMessage.class, "fromUserName"); 
        xstream.aliasField("CreateTime", WeChatTextMessage.class, "createTime"); 
        xstream.aliasField("MsgType", WeChatTextMessage.class, "messageType"); 
        xstream.aliasField("Content", WeChatTextMessage.class, "content"); 
        xstream.aliasField("MsgId", WeChatTextMessage.class, "msgId"); 
        WeChatTextMessage wechatTextMessage = (WeChatTextMessage)xstream.fromXML(xml);  
        return wechatTextMessage; 
    } 
    private String getReplyTextMessage(String content, String weChatUser){ 
        WeChatReplyTextMessage we = new WeChatReplyTextMessage(); 
        we.setMessageType("text"); 
        we.setFuncFlag("0"); 
        we.setCreateTime(new Long(new Date().getTime()).toString()); 
        we.setContent(content); 
        we.setToUserName(weChatUser); 
        we.setFromUserName("shanghaiweather");//TODO 你的公眾帳號微信號
        XStream xstream = new XStream(new DomDriver());  
        xstream.alias("xml", WeChatReplyTextMessage.class); 
        xstream.aliasField("ToUserName", WeChatReplyTextMessage.class, "toUserName"); 
        xstream.aliasField("FromUserName", WeChatReplyTextMessage.class, "fromUserName"); 
        xstream.aliasField("CreateTime", WeChatReplyTextMessage.class, "createTime"); 
        xstream.aliasField("MsgType", WeChatReplyTextMessage.class, "messageType"); 
        xstream.aliasField("Content", WeChatReplyTextMessage.class, "content"); 
        xstream.aliasField("FuncFlag", WeChatReplyTextMessage.class, "funcFlag"); 
        String xml =xstream.toXML(we); 
        return xml; 
    } 
}

?? ??? ?? ?? ????, ?? ?? ????? ?? ???? ???? ????? ?? ??? ???? ??. ???? ???? ??. ???? ? ?? ??? ???? ?? ? ????:

1. WeChat ??? ?? ??

2. ?? ??, ???? ?? ?? ??? ??

1. WeChat ?? ?? ???

WeChat ?? ????? ?? ??? ???? ??? ?????

<xml> 
<ToUserName><![CDATA[toUser]]></ToUserName> 
<FromUserName><![CDATA[fromUser]]></FromUserName> 
<CreateTime>1351776360</CreateTime> 
<MsgType><![CDATA[location]]></MsgType> 
<Location_X>23.134521</Location_X> 
<Location_Y>113.358803</Location_Y> 
<Scale>20</Scale> 
<Label><![CDATA[位置信息]]></Label> 
<MsgId>1234567890123456</MsgId> 
</xml>

???? ?? ??? ??, ?? ? ?? ?????. ??? ??? ?? ??? ???? ????? ?? ???? ??? ? ????. ???? ??, ?? ??? ???? ?? ???? ??? ??? ??? ?? ????.

微信公眾平臺開發(fā)系列

?? WeChat? ??? ?? ??? ???? WeChatLocationMessage ???? ???? Xml? WeChatLocationMessage ??? ?????.

public class WeChatLocationMessage { 
    private String toUserName; 
    private String fromUserName; 
    private String createTime; 
    private String msgType; 
    private String locationx; 
    private String localtiony; 
    private String scale; 
    private String label; 
    private String msgId; 
    public static WeChatLocationMessage getWeChatLocationMessage(String xml){ 
        XStream xstream = new XStream(new DomDriver()); 
        WeChatLocationMessage  message = null; 
        xstream.alias("xml", WeChatLocationMessage.class); 
        xstream.aliasField("ToUserName", WeChatLocationMessage.class, "toUserName"); 
        xstream.aliasField("FromUserName", WeChatLocationMessage.class, "fromUserName"); 
        xstream.aliasField("CreateTime", WeChatLocationMessage.class, "createTime"); 
        xstream.aliasField("MsgType", WeChatLocationMessage.class, "msgType"); 
        xstream.aliasField("Location_X", WeChatLocationMessage.class, "locationx"); 
        xstream.aliasField("Location_Y", WeChatLocationMessage.class, "localtiony"); 
        xstream.aliasField("Scale", WeChatLocationMessage.class, "scale"); 
        xstream.aliasField("Label", WeChatLocationMessage.class, "label"); 
        xstream.aliasField("MsgId", WeChatLocationMessage.class, "msgId"); 
        message = (WeChatLocationMessage)xstream.fromXML(xml); 
        return message; 
    } 
//getter and setter
}

? ???? Baidu? ?? API? ???? ??? ????. ?? ??? ??? ?? ???????.

public String getPalace(String query,String lat,String lng) throws ClientProtocolException, IOException{ 
    HttpClient httpClient = new DefaultHttpClient(); 
    String url = palceRequestUrl(query,lat,lng); 
    logger.log(Level.INFO, url); 
    HttpGet httpget = new HttpGet(url); 
    ResponseHandler<String> responseHandler = new BasicResponseHandler(); 
    String responseBody = httpClient.execute(httpget, responseHandler); 
    logger.log(Level.INFO,"baidu response:"+responseBody); 
    return responseBody; 
} 

public String palceRequestUrl(String query,String lat,String lng) throws UnsupportedEncodingException { 
    String url = WeChatConstant.BASEURL + "place/search?query=" + URLEncoder.encode(query,"UTF-8") + "&key="
            + WeChatConstant.MAPKEY +"&location="+lat+","+lng +"&radius=2000"+"&output=" + WeChatConstant.OUTPUTFORMAT; 
    return url; 
}

?? ??

<PlaceSearchResponse> 
    <status>OK</status> 
    <results> 
        <result> 
            <name>中國工商銀行東長安街支行</name> 
            <location> 
                <lat>39.915891</lat> 
                <lng>116.41867</lng> 
            </location> 
            <address>東城區(qū)東長安街1號東方廣場西三辦公樓1樓</address> 
            <uid>a025683c73033c35a21de987</uid> 
            <detail_url>http://api.map.baidu.com/place/detail?uid=a025683c73033c35a21de987&amp;amp;output=html&amp;amp;source=placeapi
            </detail_url> 
            <tag>銀行,王府井/東單</tag> 
        </result> 
      </results> 
</PlaceSearchResponse>

???? ??? ??? ??? ?? ?? ??? ?? ????? ??? ???

    public static String getWeChatReplyNewsMessageByBaiduPlace(List<BaiduPlaceResponse> placeList, double lat, double lng,String userName, int size){ 
        WeChatReplyNewsMessage newsMessage = new WeChatReplyNewsMessage(); 
        List<Item> items = new ArrayList<Item>(); 
        StringBuffer strBuf = new StringBuffer(); 
        logger.log(Level.INFO,"placeList count="+placeList.size()); 
        newsMessage.setItems(items); 
        if(placeList.size()>size){ 
            newsMessage.setArticleCount(size); 
        } 
        else{ 
            newsMessage.setArticleCount(placeList.size()); 
        } 
        logger.log(Level.INFO,"article count="+newsMessage.getArticleCount()); 
        newsMessage.setCreateTime(new Date().getTime()+""); 
        newsMessage.setMsgType("news"); 
        newsMessage.setFuncFlag("0"); 
        newsMessage.setToUserName(userName); 
        newsMessage.setFromUserName(WeChatConstant.FROMUSERNAME); 
        for(int i = 0;i <newsMessage.getArticleCount();i++){ 
            BaiduPlaceResponse place = placeList.get(i); 
            Double distance = GeoUtil.DistanceOfTwoPoints(Double.valueOf(place.getLng()), Double.valueOf(place.getLat()), lng, lat, GaussSphere.Beijing54); 
            Item item = new Item(); 
            item.setTitle(place.getName()+"["+distance+"米]"+"\n"+place.getAddress()+"\n"+place.getTelephone()); 
            item.setPicUrl(""); 
            item.setUrl(place.getDetailUrl()); 
            item.setDescription(""); 
            items.add(item); 
        } 
logger.log(Level.INFO,"newMessage="+newsMessage.toString()); 
        strBuf = strBuf.append(getWeChatNewsMessage(newsMessage)); 
        return strBuf.toString(); 
    } 
    public static String getWeChatNewsMessage(WeChatReplyNewsMessage newsMessage){ 
        XStream xstream = new XStream(new DomDriver()); 
        xstream.alias("xml", WeChatReplyNewsMessage.class); 
        xstream.aliasField("ToUserName", WeChatReplyNewsMessage.class, "toUserName"); 
        xstream.aliasField("FromUserName", WeChatReplyNewsMessage.class, "fromUserName"); 
        xstream.aliasField("CreateTime", WeChatReplyNewsMessage.class, "createTime"); 
        xstream.aliasField("MsgType", WeChatReplyNewsMessage.class, "msgType"); 
        xstream.aliasField("ArticleCount", WeChatReplyNewsMessage.class, "articleCount"); 
        xstream.aliasField("Content", WeChatReplyNewsMessage.class, "content"); 
        xstream.aliasField("FuncFlag", WeChatReplyNewsMessage.class, "funcFlag"); 
        xstream.aliasField("Articles", WeChatReplyNewsMessage.class, "items"); 
        xstream.alias("item", Item.class); 
        xstream.aliasField("Title", Item.class, "title"); 
        xstream.aliasField("Description", Item.class, "description"); 
        xstream.aliasField("PicUrl", Item.class, "picUrl"); 
        xstream.aliasField("Url", Item.class, "url"); 
        return xstream.toXML(newsMessage); 
    }

???? ?????. 2. ???, ???? ???? ??? ??

???, ???? ?? ?? ??? ?3? ????? ?? ??? ????? ??? ??? ???? ?????.

? ????? Baidu Map API? ???? ?? ?? ??? ??? ??? ?????.

??? ??? ??? ? ??? ? ?? ??? ??? ?????, ??? ??? ?? ?? ??? ??????.

微信公眾平臺開發(fā)系列

public String getGeoCode(String query) throws ClientProtocolException, IOException{ 
        HttpClient httpClient = new DefaultHttpClient(); 
        String url = geoCodeRequestUrl(query); 
        logger.log(Level.INFO, url); 
        HttpGet httpget = new HttpGet(url); 
        ResponseHandler<String> responseHandler = new BasicResponseHandler(); 
        String responseBody = httpClient.execute(httpget, responseHandler); 
        logger.log(Level.INFO,"baidu response:"+responseBody); 
        return responseBody; 
    } 
    public String geoCodeRequestUrl(String query) throws UnsupportedEncodingException{ 
        String url = WeChatConstant.BASEURL + "geocoder?address=" + URLEncoder.encode(query,"UTF-8") + "&key="
                + WeChatConstant.MAPKEY + "&output=" + WeChatConstant.OUTPUTFORMAT; 
        return url; 
    }

WeChat ?? ??? ?? ??? ?? ??? ? ??? PHP ??? ????? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1597
29
PHP ????
1488
72
???