From 5d1b933b0814565fd4095dea7519dd5389582082 Mon Sep 17 00:00:00 2001 From: Administrator <Administrator@S0ZHK00LKCA6OYY> Date: 星期五, 09 十一月 2018 18:47:26 +0800 Subject: [PATCH] 开启登录拦截 --- fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java | 30 +++++++++++++++++++++++------- 1 files changed, 23 insertions(+), 7 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java index 458d1ac..9c81e76 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java @@ -22,6 +22,7 @@ import com.yeshi.fanli.service.inter.user.AccountMessageService; import com.yeshi.fanli.service.inter.user.SystemZnxService; import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; @Service public class PushServiceImpl implements PushService { @@ -54,20 +55,24 @@ @Resource private XMPushService xmPushService; - @Resource private PushRecordMapper pushRecordMapper; - + @Resource private AccountMessageMapper accountMessageMapper; - - + @Async("pushExecutor") @Override public void pushGoods(Long uid, String url, String title, String content) throws PushException { String gids = url.split("id=")[1]; String gid = gids.split("&")[0]; + if (StringUtil.isNullOrEmpty(gid)) + throw new PushException(1, "鍟嗗搧瑙f瀽澶辫触"); + if (StringUtil.isNullOrEmpty(title)) + throw new PushException(1, "璇峰~鍐欐帹閫佹爣棰�"); + if (StringUtil.isNullOrEmpty(content)) + throw new PushException(1, "璇峰~鍐欐帹閫佸唴瀹�"); PushRecord pushRecord = new PushRecord(); pushRecord.setState(1); @@ -79,7 +84,7 @@ xmPushService.pushGoods(uid, Long.parseLong(gid), title, content); iosPushService.pushGoods(uid, Long.parseLong(gid), title, content); - //hwPushService.pushGoods(uid, Long.parseLong(gid), title, content); + // hwPushService.pushGoods(uid, Long.parseLong(gid), title, content); pushRecordMapper.insertSelective(pushRecord); } @@ -87,6 +92,14 @@ @Async("pushExecutor") @Override public void pushUrl(Long uid, String url, String title, String content) throws PushException { + + if (StringUtil.isNullOrEmpty(url)) + throw new PushException(1, "鏃犳帹閫侀摼鎺�"); + if (StringUtil.isNullOrEmpty(title)) + throw new PushException(1, "鏃犳帹閫佹爣棰�"); + if (StringUtil.isNullOrEmpty(content)) + throw new PushException(1, "鏃犳帹閫佸唴瀹�"); + PushRecord pushRecord = new PushRecord(); pushRecord.setState(1); pushRecord.setType(PushController.URL); @@ -103,9 +116,13 @@ @Async("pushExecutor") @Override public void pushZNX(Long uId, String title, String content) throws PushException { + if (StringUtil.isNullOrEmpty(title)) + throw new PushException(1, "鏃犳帹閫佹爣棰�"); + if (StringUtil.isNullOrEmpty(content)) + throw new PushException(1, "鏃犳帹閫佸唴瀹�"); /* 鏃爑id , 骞挎挱 鏁版嵁鎻掑叆绯荤粺琛� */ - if (uId == null||uId==0) { + if (uId == null || uId == 0) { // 鎻掑叆鏁版嵁搴擄紙绯荤粺绔欏唴淇℃暟鎹級 SystemZnx systemZnx = new SystemZnx(); systemZnx.setTitle(title); @@ -146,6 +163,5 @@ pushRecordMapper.insertSelective(pushRecord); } } - } -- Gitblit v1.8.0