import { Common } from 'pc-component-v3';

/**
 * 工具类自动生成的API，请勿做任何修改，请勿做任何修改，请勿做任何修改（重要的事情说3遍）
 * 工具作者: 杨志杰
 *  
 */
export default {

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 检查是否需要再次显示弹框 
	 */
	checkIsDisplayAgain: function(windowName){
		var requestUrl = "InfoDisplayResource/checkIsDisplayAgain";
		var paramCount = 0;
		if(windowName != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('windowName=' + windowName);
			paramCount ++;
		}


		return new Promise((resolve, reject) => {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "get",
				contentType: "application/json",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	},

	/**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 记录下一次不显示 
	 */
	saveNoDisplayAgain: function(windowName){
		var requestUrl = "InfoDisplayResource/saveNoDisplayAgain";
		var paramCount = 0;
		if(windowName != null){
			requestUrl += (paramCount > 0) ? '&' : '?';
			requestUrl += ('windowName=' + windowName);
			paramCount ++;
		}


		return new Promise((resolve, reject) => {
			$.ajax({
				url: Common.getApiURL(requestUrl),
				type: "post",
				contentType: "application/json",
				
				dataType: "json",
				
				
				beforeSend: function(request) {
					Common.addTokenToRequest(request);
				},
				success: function(data) {
					resolve(data);
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					reject(XMLHttpRequest);
				}
			});
		});
	}
}
