Java源码示例:com.akaxin.proto.site.ApiFriendDeleteProto
示例1
/**
* 删除好友
*
* @param command
* @return
*/
public CommandResponse delete(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiFriendDeleteProto.ApiFriendDeleteRequest request = ApiFriendDeleteProto.ApiFriendDeleteRequest
.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String siteFriendId = request.getSiteFriendId();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNotBlank(siteUserId) && StringUtils.isNotBlank(siteFriendId)
&& !siteUserId.equals(siteFriendId)) {
if (UserFriendDao.getInstance().deleteFriend(siteUserId, siteFriendId)) {
errCode = ErrorCode2.SUCCESS;
}
} else {
errCode = ErrorCode2.ERROR_PARAMETER;
}
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
示例2
/**
* 删除好友
*
* @param command
* @return
*/
public CommandResponse delete(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiFriendDeleteProto.ApiFriendDeleteRequest request = ApiFriendDeleteProto.ApiFriendDeleteRequest
.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String siteFriendId = request.getSiteFriendId();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNotBlank(siteUserId) && StringUtils.isNotBlank(siteFriendId)
&& !siteUserId.equals(siteFriendId)) {
if (UserFriendDao.getInstance().deleteFriend(siteUserId, siteFriendId)) {
errCode = ErrorCode2.SUCCESS;
}
} else {
errCode = ErrorCode2.ERROR_PARAMETER;
}
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
示例3
/**
* 删除好友
*
* @param command
* @return
*/
public CommandResponse delete(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiFriendDeleteProto.ApiFriendDeleteRequest request = ApiFriendDeleteProto.ApiFriendDeleteRequest
.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
String siteFriendId = request.getSiteFriendId();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNotBlank(siteUserId) && StringUtils.isNotBlank(siteFriendId)
&& !siteUserId.equals(siteFriendId)) {
if (UserFriendDao.getInstance().deleteFriend(siteUserId, siteFriendId)) {
errCode = ErrorCode2.SUCCESS;
}
} else {
errCode = ErrorCode2.ERROR_PARAMETER;
}
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}