//Here is the id of the official account (in its own data)
String id="7f04f5b8af8248b9b83a74aff6c607d620170915141439";
SellerPublicNumber sellerPublicNumber = SellerPublicNumber.dao.findById(id);
ApiConfigKit.putApiConfig(WxConfigUitils.getApiConfig(sellerPublicNumber.getToKen(), sellerPublicNumber.getAppId(), sellerPublicNumber.getAppSecret()));
//The above four lines of code are for the following getAccessToken()
// receive the openid of the message
String ToUserName="oRvVatwa2sxv6CCTSM1RBwVPqTn0";String Title="小石潭记";
String Description="From the hill to the west, one hundred and twenty paces across the bamboo can hear the sound of the water, such as the sound of a ring and the heart is happy";
//The map's address
String PicUrl="http://www.joffro.com/Activity/upload/hello.jpg";
//click the jump link
String Url="http://open.weixin.qq.com/connect/oauth2/authorize?appid=wx3db6ea684d097397&redirect_uri=http%3a%2f%2fwww.joffro.com%2fActivity%2fbreakEgg%2fgetGoods%3fappid%3dwx3db6ea684d097397&response_type=code&scope=snsapi_userinfo&state=wx#wechat_redirect";
//This is the message splicing to be sent
String result="{\"touser\":\""+ToUserName+"\",\"msgtype\":\"news\",\"news\":{\"articles\":[{\"title\":\""+Title+"\",\"description\":\""+Description+"\",\"url\":\""+Url+"\",\"picurl\":\""+PicUrl+"\"}]}}";
//post send message
String ps = HttpUtils.post("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + getAccessToken(),result);
// send text message
String toUser="oRvVatwa2sxv6CCTSM1RBwVPqTn0";
String content="I once crossed mountains and seas, and people...";
String json = "{\"touser\": \""+toUser+"\",\" msgtype\": \"text\", \"text\": {\"content\": \""+content+"\"}}";
String ps =HttpUtils.post("https://api.weixin .qq.com/cgi-bin/message/custom/send?access_token=" + getAccessToken(),json);