package com.zjrs.ggfw.dzsbk.util;

import com.alibaba.csb.sdk.ContentBody;
import com.alibaba.csb.sdk.HttpCaller;
import com.alibaba.csb.sdk.HttpCallerException;
import com.alibaba.csb.sdk.HttpParameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class signInfoUtils {
	private static final Logger logger = LoggerFactory.getLogger(signInfoUtils.class);
	
	public static String getSignInfo(String signInfoUrl,String accessKey,String securityKey,String jsonData){
		HttpParameters.Builder builder = HttpParameters.newBuilder();
		builder.requestURL(signInfoUrl) // 设置请求的URL
				.api("v2_sign_valid") // 设置服务名
				.version("1.0.0") // 设置版本号
				.method("post") // 设置调用方式, get/post
				.accessKey(accessKey)
				.secretKey(securityKey); // 设置accessKey 和 设置secretKey
		
		// 设置请求参数（json格式)
		ContentBody cb = new ContentBody(jsonData);
		builder.contentBody(cb);
		
		//进行调用 返回结果（json格式)
		String result = null;
		try {
			result = HttpCaller.invoke(builder.build());
			logger.info("=====sign_info="+result);
		} catch (HttpCallerException e) {
			logger.info("领卡查询接口异常：",e);
		}
		return result;
	}
}