




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
平臺項什么 公眾平 初 公眾平 發(fā)到該URL中windows用戶1,windows版本的客戶端,解壓到你喜歡3,執(zhí)行ngrok-config=ngrok.cfg-subxxx80//(xxx是你自定義的前綴4,如果開啟成功你就可以使用xx 來你本機的:80的服務解析到40(需要已備案哦),然后執(zhí)行./ngrok-config=ngrok.cfg-hostnamexxx.xxx.xxx80//(xxx.xxx.xxx是你自定義的頂級)6,如果開啟成功你就可以使用你的頂級來你本機的:80的服務7,如果失敗就加 反饋下問題會看看什么原 環(huán)境搭 <artifactId>spring-boot-starter-<project.build.sourceEncoding>UTF-<<集成commons工具類<artifactId>commons-集成lombok集成redis<artifactId>spring-boot-starter-data-集成aop<artifactId>spring-boot-starter-集成web<artifactId>spring-boot-starter-<!--集成發(fā)送郵件<artifactId>spring-boot-starter-集成mysql<artifactId>mysql-connector-<artifactId>spring-boot-starter-阿里巴巴數(shù)據(jù)源<!-- --<groupId>commons- <artifactId>commons- <artifactId>spring-context-<groupId>commons-<artifactId>commons-<artifactId>spring-boot-starter-<artifactId>spring-boot-starter- <finalName>springboot-<artifactId>spring-boot-maven-<mainClass>${start-<artifactId>maven-assembly-<version>2.2-beta-<descriptorRef>jar-with-<id>assemble-port:port:8080context- 服務器將發(fā)送GET請求到填寫的服務器地址URL上,GET請求攜publicpublicclassCheckUtilpublicstaticfinalStringtookenitmayiedu開發(fā)者自行定義publicstaticbooleancheckSignature(Stringsignature,Stringtimestamp,Stringnonce)//1.定義數(shù)組存放tooken,timestamp,nonceString[arrtookentimestampnonce2.對數(shù)組進行3.StringBuffersb=newStringBuffer();for(Strings:arr){}//4.sha1加密,Stringtemp=//5.將加密后的字符串, 傳來的加密簽名比較,返回結(jié)return}publicstaticStringgetSha1(Stringstr){if(str==null||str.length()==0){return}charhexDigits[]={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};tryMessageDigestmdTemp=MessageDigest.getInstance("SHA1");byte[]md=mdTemp.digest();intj=md.length;charbuf[]=newchar[j*2];intk=0;for(inti=0;i<j;i++){bytebyte0=md[i];buf[k++]=hexDigits[byte0>>>4&0xf];buf[k++]=hexDigits[byte0&0xf];}returnnew}catch(Exceptione){returnnull;}}}publicpublicclassXmlUtils*解發(fā)來的請求*@param@returnMap<String,@throwspublicstaticMap<String,String> ml(HttpServletRequestrequest)throwsException將解析結(jié)在HashMapMap<String,String>map=newHashMap<String,//從request中取得輸入InputStreaminputStream= 輸入SAXReaderreader=new=得到xml根元Elementroot //得到根元素的所有子節(jié)List<Element>elementList=遍歷所有子for(Elemente:elementList)map.put(e.getName(),e.getText());釋放資inputStream=null;return}文本消息對象轉(zhuǎn)換成*@param*文本消息對*@returnpublicpublicstaticStringmessageToXml(TextMessagetextMessage)xstream.alias("xml",textMessage.getClass());returnxstream.toXML(textMessage);}*擴展xstream使其支持privatestaticXStreamxstream=new}*通***publicclassDispatCherServlet驗*@param@param@param@param(value="/dispatCherServlet",method=publicStringgetDispatCherServlet(Stringsignature,Stringtimestamp,Stringnonce,Stringechostr)booleancheckSignature=CheckUtil.checkSignature(signature,timestamp,nonce);if(!checkSignature){return}return}功能說明 通*@param@throws (value="/dispatCherServlet",method=publicvoidpostdispatCherServlet(HttpServletRequestrequest,HttpServletResponseresponse)throwsException{Map<String,String>mapResult=XmlUtils.par if(mapResult==null){}StringmsgType=mapResult.get("MsgType");PrintWriterout=response.getWriter();switch(msgType){case"text":Stringcontent=mapResult.get("Content");StringtoUserName=mapResult.get("ToUserName");StringfromUserName=mapResult.get("FromUserName");StringtextMessage=null;if(content.equals("螞蟻課堂判斷螞蟻課textMessage=setTextMessage("螞蟻課堂中國高端IT培訓教學 toUserName,fromUserName);}elseif(content.equals("你知 嗎"))判斷螞蟻課textMessage=setTextMessage("知道啊, 日在 toUserName,elseif(content.equals("螞蟻課堂第一期就業(yè)薪資判斷螞蟻課textMessage=setTextMessage("平均薪資 我也想去學習...",}else//調(diào)用 智能接StringresultStr= &appid=0&msg="+content);JSONObjectjsonObject=newJSONObject().parseObject(resultStr);Integerinteger=ifif(integer==null||integer!=0)textMessagesetTextMessage("親,系統(tǒng)出錯啦toUserName}elseStringresult=textMessage=setTextMessage(result,toUserName,}}("postdispatCherServlet()info:{}",textMessage);}}publicStringsetTextMessage(Stringcontent,StringtoUserName,StringfromUserName){TextMessagetextMessage=newTextMessage();textMessage.setCreateTime(newDate().getTime());StringmessageToXml=XmlUtils.messageToXml(textMessage);returnmessageToXml;}}////調(diào)用 智能接StringresultStr= &appid=0&msg="+JSONObjectjsonObject=newIntegerinteger=jsonObject.getInteger("result");if(integer==null||integer!=0){textMessagesetTextMessage("親,系統(tǒng)出錯啦toUserName}elseStringresult=textMessage=setTextMessage(result,toUserName,}}Httpimportimportimportimportjava.util.List;importimportimport importorg.apache.http. importorg.apache.http. importorg.apache.http. importorg.apache.http. importimportimportimportorg.apache.http.impl.importorg.apache.ht;importpublicclassUtilpublicstaticStringdoGet(Stringurl,Map<String,String>param)//= StringresultString=CloseableHttpResponseresponse=null;try{//URIBuilderbuilder=newURIBuilder(url);if(param!=null){for(Stringkey:param.keySet())}}URIuri=//httpGETHttpGethttpGet=new//response= //}}catch(Exceptione)}finallytryif(response!=null){} }catch(IOExceptione){}}return}publicstaticStringdoGet(Stringurl){returndoGet(url,null);}publicstaticStringdoPost(Stringurl,Map<String,String>param)//創(chuàng)建 對 =Http CloseableHttpResponseresponse=null;StringresultString="";try{//HttpPostHttpPosthttpPost=new//if(param!=null)List<NameValuePair>paramList=newArrayList<>();for(Stringkey:param.keySet()){ }//UrlEncodedFormEntityentity=newUrlEncodedFormEntity(paramList);}//httpresponse= }catch(Exceptione)}finallytry}catch(IOExceptione)//TODOAuto-generatedcatchblock}}return}publicstaticStringdoPost(Stringurl){returndoPost(url,null);}publicstaticStringdoPostJson(Stringurl,Stringjson)//創(chuàng)建 對 =Htt
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 租賃商場場地合同
- 公司員工激勵演講稿
- 養(yǎng)老護理行業(yè)老年人照護需求評估
- 肉羊養(yǎng)殖購銷合同
- 生物醫(yī)藥領域新藥研發(fā)投資合同
- 有關(guān)個人向公司借款協(xié)議書
- 城市道路施工安全管理規(guī)定
- 好品質(zhì)故事解讀
- 電影制作公司演員拍攝安全協(xié)議
- 2025年漢語拼音yw助力企業(yè)營銷策略分析
- 胸膜疾病課件
- 公路施工技術(shù)全套課件
- 胸痹心痛中醫(yī)診療方案及臨床路徑
- 泛讀2unit2-music
- 中學生防溺水安全教育課件(PPT 44頁)
- 2019版外研社高中英語選擇性必修二Unit 1 Growing up 單詞表
- 重慶危險性較大的分部分項工程安全管理實施細則
- 三菱 PLC FX2N-4AD 4DA 模擬量模塊教材(課堂PPT)
- 有機金屬化學1
- JIT標準作業(yè)作業(yè)指導書
- 安徽省2020-2021學年七年級語文下學期期末測試卷[含答案]
評論
0/150
提交評論