package com.legalPersonMonitor.monitor;

import com.legalPersonMonitor.connections.SendRequset;
import com.legalPersonMonitor.data.AccessTokenRequset;
import com.legalPersonMonitor.data.AccessTokenResponse;
import com.legalPersonMonitor.data.WxResponseBean;

/**
 * Created by gaoxiang on 2018/1/22.
 */
public class SendToWeixin {
    public void test(){
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!");
    }
    public  void sendToWeixinMain(){
        String msgServiceState= "0X4F模式下的服务状态监控"+ServiceStateMonitoring.serviceStateMonitoringServer()+"  ";
        String msgTrustedPlatformStatus= "0X4F模式下的可信平台状态监控"+new TrustedPlatformStatusMonitoring().trustedPlatformStatusMonitoringServer()+"   ";
        String msgSignatureServerStatus = "签名服务器状态监控"+new SignatureServerStatusMonitoring().signatureServerStatusMonitoringServer();
        SendRequset sr=new SendRequset();
        AccessTokenRequset atrequset=new AccessTokenRequset("https://qyapi.weixin.qq.com/cgi-bin/gettoken","wx4244612882ba3018","5dqLUQ9S3CjhFfKXsmgl4Q9PogJEG6qieoyr4AEw1UI" );
        AccessTokenResponse asresponse=sr.getAccessToken(atrequset);
        String sendjson="{   \"touser\": \"@all\",   \"toparty\": \" \",   \"totag\": \" \",   \"msgtype\": \"mpnews\",   \"agentid\": "+1000003+",   "
                + "\"mpnews\": {       \"articles\":[           "
                + "{               \"title\": \""+"身份认证监控系统"+"\",               "
                + "\"thumb_media_id\": \""+"2_VLquGGm4PEhhG-vG5_9SEfdLvNrvNPbdLH6DrZqieHHH5LqXbfqvLWljvcgGvF4"+"\",               "
                + "\"author\": \"\",               "
                + "\"content_source_url\": \"\",               "
                + "\"content\": \""+msgServiceState+msgTrustedPlatformStatus+msgSignatureServerStatus+"\",       "
                + "\"digest\": \""+"\",               "
                + "\"show_cover_pic\": \"1\"           }       ]   },   "
                + "\"safe\":0}";
        WxResponseBean wx=sr.sendTextMessage(asresponse, sendjson);
    }
}
