* @return 参数
* @throws UnsupportedEncodingException
* @throws Exception
*/
private MultipartEntity getUpdatePicParam(QqUpdatePicParamBean paramBean) throws UnsupportedEncodingException {
MultipartEntity reqEntity = new MultipartEntity();
// AccessToken
reqEntity.addPart("access_token", new StringBody(paramBean.getAccessToken()));
// AppId
reqEntity.addPart("oauth_consumer_key", new StringBody(oqu.getConfigValue("qq.appid")));
// OpenId
reqEntity.addPart("openid", new StringBody(paramBean.getOpenId()));
// 照片描述
if (oqu.isNotNull(paramBean.getPhotoDesc())) {
reqEntity.addPart("photodesc", new StringBody(paramBean.getPhotoDesc(),Charset.forName("UTF-8")));
}
// 照片的命名
if (oqu.isNotNull(paramBean.getTitle())) {
reqEntity.addPart("title", new StringBody(paramBean.getTitle(),Charset.forName("UTF-8")));
}
// 相册id
if (oqu.isNotNull(paramBean.getAlbumId())) {
reqEntity.addPart("albumid", new StringBody(paramBean.getAlbumId()));
}
// 照片拍摄时的地理位置的经度
if (oqu.isNotNull(paramBean.getLongitude())) {
reqEntity.addPart("x", new StringBody(paramBean.getLongitude()));
}
// 照片拍摄时的地理位置的纬度
if (oqu.isNotNull(paramBean.getLatitude())) {
reqEntity.addPart("y", new StringBody(paramBean.getLatitude()));
}
// 定义API返回的数据格式
reqEntity.addPart("format", new StringBody("json"));
// 标识上传照片时是否要发feed
reqEntity.addPart("needfeed", new StringBody(String.valueOf(paramBean.getNeedFeed())));
// 已成功上传的张数
if (paramBean.getSuccessNum() > 0) {
reqEntity.addPart("successnum", new StringBody(String.valueOf(paramBean.getSuccessNum())));
}
// 批量上传照片的总张数
if (paramBean.getPicNum() > 0) {
reqEntity.addPart("picnum", new StringBody(String.valueOf(paramBean.getPicNum())));
}
// 图片的内容
FileBody fileBody = new FileBody(new File(paramBean.getPicPath()));
reqEntity.addPart("picture", fileBody);
return reqEntity;
}