/** 添加收藏 */ @Override public Boolean collectionAdd(String ptype, String pcode, String contentid) throws ServiceException { Map<String, String> headerMap = AppSetting.getInstance(context).getCommonHeaderMap(true); headerMap.put("ptype", ptype); headerMap.put("pcode", pcode); headerMap.put("contentid", contentid); ApiResponse info = null; Object respAccountObj = null; OpenContentActionLog log = new OpenContentActionLog(context, contentid, contentid); log.setActionDesc("添加收藏"); try { respAccountObj = callPostApi(DzlcAndroidConfig.ADD_COLLECTION, headerMap, ApiResponse.class); } catch (ServiceException e) { log.setActionResult("1"); log.setFailCause(e.getErrCode() + ":" + e.getErrMsg()); } if (respAccountObj != null) log.setActionResult("0"); ClientLogFactory.getInstance().addLog(log); info = (ApiResponse) respAccountObj; if (info != null && info.getCode() != null && info.getCode().equals("00")) { return true; } return false; }
/** 取消收藏 */ @Override public ApiResponse collectionDelete(String contentid) throws ServiceException { Map<String, String> headerMap = AppSetting.getInstance(context).getCommonHeaderMap(true); ApiResponse collectionList = null; headerMap.put("contentid", contentid); Object respAccountObj = null; OpenContentActionLog log = new OpenContentActionLog(context, contentid, contentid); log.setActionDesc("取消收藏"); try { respAccountObj = callPostApi(DzlcAndroidConfig.DELETE_COLLECTION, headerMap, ApiResponse.class); } catch (ServiceException e) { log.setActionResult("1"); log.setFailCause(e.getErrCode() + ":" + e.getErrMsg()); } if (respAccountObj != null) { log.setActionResult("0"); collectionList = (ApiResponse) respAccountObj; } else { log.setActionResult("1"); } ClientLogFactory.getInstance().addLog(log); return collectionList; }