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

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

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 忘记密码————发送用户验证码进行验证 
	 */
  retrievePasswordUserVerificationCode: function(loginName,eamil, verificationCodeType,languageId){
    var requestUrl = 'api/UserVerificationCodeResource/retrievePasswordUserVerificationCode';
    var paramCount = 0;
    if(loginName != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('loginName=' + loginName);
      paramCount ++;
    }
    if(eamil != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('eamil=' + eamil);
      paramCount ++;
    }
    if(verificationCodeType != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('verificationCodeType=' + verificationCodeType);
      paramCount ++;
    }
    if(languageId != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('languageId=' + languageId);
      paramCount ++;
    }


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

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 发送用户登录验证码 
	 */
  sendUserVerificationCode: function(userId, verificationCodeType){
    var requestUrl = 'api/UserVerificationCodeResource/sendUserVerificationCode';
    var paramCount = 0;
    if(userId != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('userId=' + userId);
      paramCount ++;
    }
    if(verificationCodeType != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('verificationCodeType=' + verificationCodeType);
      paramCount ++;
    }


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

  

  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 忘记密码验证身份 
	 */
  forgetPasswordVerifyIdentity: function(loginName, email, verificationCode){
    var requestUrl = 'api/UserVerificationCodeResource/forgetPasswordVerifyIdentity';
    var paramCount = 0;
    if(loginName != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('loginName=' + loginName);
      paramCount ++;
    }
    if(email != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('email=' + email);
      paramCount ++;
    }
    if(verificationCode != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('verificationCode=' + verificationCode);
      paramCount ++;
    }


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

  
  /**
	 * 工具类自动生成的方法
	 * 工具作者: 杨志杰
	 * 忘记用户密码 
	 */
  retrievePassword: function(loginName, email, verificationCode, newPassword, newPassword2){
    var requestUrl = 'api/userResource/retrievePassword';
    var paramCount = 0;
    if(loginName != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('loginName=' + loginName);
      paramCount ++;
    }
    if(email != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('email=' + email);
      paramCount ++;
    }
    if(verificationCode != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('verificationCode=' + verificationCode);
      paramCount ++;
    }
    if(newPassword != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('newPassword=' + newPassword);
      paramCount ++;
    }
    if(newPassword2 != null){
      requestUrl += (paramCount > 0) ? '&' : '?';
      requestUrl += ('newPassword2=' + newPassword2);
      paramCount ++;
    }


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





};
