-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update logger related code , using @slf4j instead
- Loading branch information
1 parent
517dc7e
commit 45db364
Showing
12 changed files
with
189 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
git commit -a -m "update wxjava sdk to 4.6.0" | ||
git commit -a -m "update logger related code , using @slf4j instead" | ||
#git commit -a -m "update wxjava sdk to 4.6.0" | ||
git pull --rebase | ||
|
||
git push origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
src/main/java/com/github/binarywang/demo/wx/cp/handler/ContactChangeHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
package com.github.binarywang.demo.wx.cp.handler; | ||
|
||
import java.util.Map; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import com.github.binarywang.demo.wx.cp.builder.TextBuilder; | ||
import com.github.binarywang.demo.wx.cp.utils.JsonUtils; | ||
import lombok.extern.slf4j.Slf4j; | ||
import me.chanjar.weixin.common.session.WxSessionManager; | ||
import me.chanjar.weixin.cp.api.WxCpService; | ||
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage; | ||
import me.chanjar.weixin.cp.bean.message.WxCpXmlOutMessage; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* 通讯录变更事件处理器. | ||
* | ||
* @author <a href="https://github.com/binarywang">Binary Wang</a> | ||
*/ | ||
@Slf4j | ||
@Component | ||
public class ContactChangeHandler extends AbstractHandler { | ||
|
||
@Override | ||
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context, WxCpService cpService, | ||
WxSessionManager sessionManager) { | ||
String content = "收到通讯录变更事件,内容:" + JsonUtils.toJson(wxMessage); | ||
log.info(content); | ||
@Override | ||
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context, WxCpService cpService, | ||
WxSessionManager sessionManager) { | ||
String content = "收到通讯录变更事件,内容:" + JsonUtils.toJson(wxMessage); | ||
log.info(content); | ||
|
||
return new TextBuilder().build(content, wxMessage, cpService); | ||
} | ||
return new TextBuilder().build(content, wxMessage, cpService); | ||
} | ||
|
||
} |
49 changes: 25 additions & 24 deletions
49
src/main/java/com/github/binarywang/demo/wx/cp/handler/LocationHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,44 @@ | ||
package com.github.binarywang.demo.wx.cp.handler; | ||
|
||
import java.util.Map; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import com.github.binarywang.demo.wx.cp.builder.TextBuilder; | ||
import lombok.extern.slf4j.Slf4j; | ||
import me.chanjar.weixin.common.api.WxConsts; | ||
import me.chanjar.weixin.common.session.WxSessionManager; | ||
import me.chanjar.weixin.cp.api.WxCpService; | ||
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage; | ||
import me.chanjar.weixin.cp.bean.message.WxCpXmlOutMessage; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @author <a href="https://github.com/binarywang">Binary Wang</a> | ||
*/ | ||
@Slf4j | ||
@Component | ||
public class LocationHandler extends AbstractHandler { | ||
|
||
@Override | ||
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context, WxCpService cpService, | ||
WxSessionManager sessionManager) { | ||
if (wxMessage.getMsgType().equals(WxConsts.XmlMsgType.LOCATION)) { | ||
//TODO 接收处理用户发送的地理位置消息 | ||
try { | ||
String content = "感谢反馈,您的的地理位置已收到!"; | ||
return new TextBuilder().build(content, wxMessage, null); | ||
} catch (Exception e) { | ||
log.error("位置消息接收处理失败", e); | ||
@Override | ||
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context, WxCpService cpService, | ||
WxSessionManager sessionManager) { | ||
if (wxMessage.getMsgType().equals(WxConsts.XmlMsgType.LOCATION)) { | ||
//TODO 接收处理用户发送的地理位置消息 | ||
try { | ||
String content = "感谢反馈,您的的地理位置已收到!"; | ||
return new TextBuilder().build(content, wxMessage, null); | ||
} catch (Exception e) { | ||
log.error("位置消息接收处理失败", e); | ||
return null; | ||
} | ||
} | ||
|
||
//上报地理位置事件 | ||
log.info("\n上报地理位置,纬度 : {}\n经度 : {}\n精度 : {}", | ||
wxMessage.getLatitude(), wxMessage.getLongitude(), String.valueOf(wxMessage.getPrecision())); | ||
|
||
//TODO 可以将用户地理位置信息保存到本地数据库,以便以后使用 | ||
|
||
return null; | ||
} | ||
} | ||
|
||
//上报地理位置事件 | ||
log.info("\n上报地理位置,纬度 : {}\n经度 : {}\n精度 : {}", | ||
wxMessage.getLatitude(), wxMessage.getLongitude(), String.valueOf(wxMessage.getPrecision())); | ||
|
||
//TODO 可以将用户地理位置信息保存到本地数据库,以便以后使用 | ||
|
||
return null; | ||
} | ||
|
||
} |
23 changes: 12 additions & 11 deletions
23
src/main/java/com/github/binarywang/demo/wx/cp/handler/LogHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
package com.github.binarywang.demo.wx.cp.handler; | ||
|
||
import java.util.Map; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import com.github.binarywang.demo.wx.cp.utils.JsonUtils; | ||
import lombok.extern.slf4j.Slf4j; | ||
import me.chanjar.weixin.common.session.WxSessionManager; | ||
import me.chanjar.weixin.cp.api.WxCpService; | ||
import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage; | ||
import me.chanjar.weixin.cp.bean.message.WxCpXmlOutMessage; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @author <a href="https://github.com/binarywang">Binary Wang</a> | ||
* @author <a href="https://github.com/binarywang">Binary Wang</a> | ||
*/ | ||
@Slf4j | ||
@Component | ||
public class LogHandler extends AbstractHandler { | ||
@Override | ||
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context, WxCpService cpService, | ||
WxSessionManager sessionManager) { | ||
log.info("\n接收到请求消息,内容:{}", JsonUtils.toJson(wxMessage)); | ||
return null; | ||
} | ||
@Override | ||
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context, WxCpService cpService, | ||
WxSessionManager sessionManager) { | ||
log.info("\n接收到请求消息,内容:{}", JsonUtils.toJson(wxMessage)); | ||
return null; | ||
} | ||
|
||
} |
Oops, something went wrong.