java
@AfterReturning(value = "execution(* cn.shiyu.service.rpc.share.impl.SharePhotoComponentRpcApiImpl.updateSupportStatusForSharePhotoItem(..)", returning = "result") public void pushSupport(boolean result) { // PushMessage message = new PushMessage(); // message.setIdType("SHARE_PHOTO_ITEM"); // message.setMessageType("SUPPORT"); // String sharePhotoItemId=comment.getSharePhotoItemId(); // message.setId(comment.getSharePhotoItemId()); // message.setSender(comment.getUserId()); // message.setContent(comment.getContent()); // List<String> receivers = new ArrayList<>(); // receivers.add(SharePhotoActiveRecord.getInstance().getAuthor(sharePhotoItemId)); // message.setReceivers(receivers); // message.setCreateTime(comment.getCreateTime()); // MessagePushActiveRecord.getInstance().insert(result); }
然后被代理的方法是这样的:
java
public boolean updateSupportStatusForSharePhotoItem(String userId, String sharePhotoItemId, boolean isSupport) { SharePhoto sharePhoto = this.sharePhotoActiveRecord.findBySharePhotoItemId(sharePhotoItemId); SharePhotoItem sharePhotoItem = null; for (SharePhotoItem item : sharePhoto.getItems()) { if (item.getSharePhotoItemId().equals(sharePhotoItemId)) { sharePhotoItem = item; break; } } List<String> supportUsers = sharePhotoItem.getSupportUsers(); boolean currentUserIsSupport = supportUsers.contains(userId); if (isSupport) { // 添加赞 if (!currentUserIsSupport) { // 不存在, 添加. supportUsers.add(userId); } } else { // 删除赞 if (currentUserIsSupport) { supportUsers.remove(userId); } } try { this.sharePhotoActiveRecord.updateById(sharePhoto); return true; } catch (Exception e) { e.printStackTrace(); } return false; }
现在我想获得被代理的函数的参数,String userId, String sharePhotoItemId, boolean isSupport
请问我该咋做呢?
修改代理方法
java
@AfterReturning(value = "execution(* cn.shiyu.service.rpc.share.impl.SharePhotoComponentRpcApiImpl.updateSupportStatusForSharePhotoItem(..) && args(userId,sharePhotoItemId,isSupport,..)", returning = "result") public void pushSupport(String userId, String sharePhotoItemId, boolean isSupport) { System.out.println(userId); System.out.println(sharePhotoItemId); System.out.println(isSupport); }