日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

为Jfinal-weixin SDK添加微信连WiFi成功通知事件

發(fā)布時間:2025/7/14 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 为Jfinal-weixin SDK添加微信连WiFi成功通知事件 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

2019獨角獸企業(yè)重金招聘Python工程師標準>>>

1、在event包中添加InWifiConnectedEvent類:

package?com.jfinal.weixin.sdk.msg.in.event;import?com.jfinal.weixin.sdk.msg.in.InMsg;/**通過微信連Wi-Fi連網(wǎng)成功后會觸發(fā)事件推送,該事件將發(fā)送至開發(fā)者填寫的URL(登錄公眾平臺進入開發(fā)者中心設(shè)置)。開發(fā)者可通過事件推送獲取連網(wǎng)相關(guān)信息、數(shù)據(jù)統(tǒng)計等操作。<xml><ToUserName><![CDATA[toUser]]></ToUserName><FromUserName><![CDATA[FromUser]]></FromUserName><CreateTime>123456789</CreateTime><MsgType><![CDATA[event]]></MsgType><Event><![CDATA[WifiConnected]]></Event><ConnectTime>0</ConnectTime><ExpireTime>0</ExpireTime><VendorId>![CDATA[3001224419]]</VendorId><PlaceId>![CDATA[PlaceId]]</PlaceId><DeviceNo>![CDATA[DeviceNo]]</DeviceNo></xml>*/ public?class?InWifiConnectedEvent?extends?InMsg?{private?String?event;private?Integer?connectTime;//用戶聯(lián)網(wǎng)時間private?String?expireTime;//系統(tǒng)保留字private?String?vendorId;//系統(tǒng)保留字private?Integer?placeId;//設(shè)備所屬的門店idprivate?String?deviceNo;//設(shè)備的mac地址public?InWifiConnectedEvent(String?toUserName,?String?fromUserName,?Integer?createTime,?String?msgType)?{super(toUserName,?fromUserName,?createTime,?msgType);}public?String?getEvent()?{return?event;}public?void?setEvent(String?event)?{this.event?=?event;}public?Integer?getConnectTime()?{return?connectTime;}public?void?setConnectTime(Integer?connectTime)?{this.connectTime?=?connectTime;}public?String?getExpireTime()?{return?expireTime;}public?void?setExpireTime(String?expireTime)?{this.expireTime?=?expireTime;}public?String?getVendorId()?{return?vendorId;}public?void?setVendorId(String?vendorId)?{this.vendorId?=?vendorId;}public?Integer?getPlaceId()?{return?placeId;}public?void?setPlaceId(Integer?placeId)?{this.placeId?=?placeId;}public?String?getDeviceNo()?{return?deviceNo;}public?void?setDeviceNo(String?deviceNo)?{this.deviceNo?=?deviceNo;} }

2、擴展InMsgParaser類的parseInEvent方法:

//微信連WiFi成功通知事件 if?("WifiConnected".equals(event)){InWifiConnectedEvent?e=new?InWifiConnectedEvent(toUserName,fromUserName,createTime,msgType);e.setEvent(event);e.setConnectTime(Integer.parseInt(root.elementText("ConnectTime")));e.setExpireTime(root.elementText("ExpireTime"));e.setVendorId(root.elementText("VendorId"));e.setPlaceId(Integer.parseInt(root.elementText("PlaceId")));e.setDeviceNo(root.elementText("PlaceId"));return?e; }

3、繼續(xù)擴展MsgController類,添加processInWifiConnectedEvent抽象方法:

protected?abstract?void?processInWifiConnectedEvent(InWifiConnectedEvent?inWifiConnectedEvent);

在其index方法中添加:

else??if?(msg?instanceof?InWifiConnectedEvent)processInWifiConnectedEvent((InWifiConnectedEvent)?msg);

5、在WeixinMsgController控制器中實現(xiàn)上一步的抽象方法:

@Override protected?void?processInWifiConnectedEvent(InWifiConnectedEvent?inWifiConnectedEvent)?{System.out.println("WiFi連接成功通知事件"); }


轉(zhuǎn)載于:https://my.oschina.net/u/1993676/blog/491775

總結(jié)

以上是生活随笔為你收集整理的为Jfinal-weixin SDK添加微信连WiFi成功通知事件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。