
com.jeecg.weibo.util.WeiboSendUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jeewx-api Show documentation
Show all versions of jeewx-api Show documentation
JEEWX-API(微信极速SDK、同时支持微信公众号\企业微信\支付窗\小程序\微博).
The newest version!
package com.jeecg.weibo.util;
import java.net.URLEncoder;
import org.apache.commons.lang.StringUtils;
import com.jeecg.weibo.dto.WeiboSendDto;
import com.jeecg.weibo.exception.BusinessException;
public class WeiboSendUtil {
/*
*
* 获取@当前用户的最新微博的请求必填参数验证
*
*/
public static void getSendParmValidate(WeiboSendDto send){
if(StringUtils.isEmpty(send.getAccess_token())){
throw new BusinessException("access_token不能为空");
}
if(StringUtils.isEmpty(send.getStatus())){
throw new BusinessException("发布微博内容不能为空");
}
}
/*
*
* 获取@当前用户的最新微博的请求路径
*/
@SuppressWarnings("deprecation")
public static String getSendUrl (String interUrl,WeiboSendDto send){
StringBuilder requestUrl=new StringBuilder();
requestUrl.append(interUrl);
if(StringUtils.isNotEmpty(send.getAccess_token())){
requestUrl.append("&access_token="+send.getAccess_token());
}
if(StringUtils.isNotEmpty(send.getStatus())){
requestUrl.append("&status="+send.getStatus());
}
if(StringUtils.isNotEmpty(send.getUrl())){
String url = URLEncoder.encode(send.getUrl());
requestUrl.append("&url="+url);
}
return requestUrl.toString();
}
public static void delParmValidate(WeiboSendDto send){
if(StringUtils.isEmpty(send.getAccess_token())){
throw new BusinessException("access_token不能为空");
}
if(StringUtils.isEmpty(send.getId())){
throw new BusinessException("微博ID不能为空");
}
}
@SuppressWarnings("deprecation")
public static String getDelUrl (String interUrl,WeiboSendDto send){
StringBuilder requestUrl=new StringBuilder();
requestUrl.append(interUrl);
if(StringUtils.isNotEmpty(send.getAccess_token())){
requestUrl.append("&access_token="+send.getAccess_token());
}
if(StringUtils.isNotEmpty(send.getId())){
requestUrl.append("&id="+send.getId());
}
return requestUrl.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy