package com.xxfc.platform.universal.utils;



import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class CCPRestSmsUtils {
	public static CCPRestSDK restAPI;

	static {
		restAPI = new CCPRestSDK();
		restAPI.init("app.cloopen.com", "8883");
		restAPI.setAccount("8aaf070865e6b6eb0165ecd776700559",
				"3fe5e2f053674f23b029a9a9fc9503f0");
		restAPI.setAppId("8a216da86bfdbeb5016c0d2543670a06");
	}

	public static Map<String, Object> sendTemplateSMS(String phoneNumbers, String[] params, String templateId) {
		HashMap<String, Object> result = null;
		result = restAPI.sendTemplateSMS(phoneNumbers, templateId, params);

		System.out.println("SDKTestGetSubAccounts result=" + result);
		if ("000000".equals(result.get("statusCode"))) {
			// 正常返回输出data包体信息（map）
			HashMap<String, Object> data = (HashMap<String, Object>) result.get("data");
			Set<String> keySet = data.keySet();
			for (String key : keySet) {
				Object object = data.get(key);
				System.out.println(key + " = " + object);
			}
		} else {
			// 异常返回输出错误码和错误信息
			System.out.println("错误码=" + result.get("statusCode") + " 错误信息= " + result.get("statusMsg"));
		}
		return result;
	}

}