public static bool SendNotify(string mobile, string tplId, NameValueCollection parameters, out string errorMessage) { if (string.IsNullOrEmpty(mobile) || !StringUtils.IsMobile(mobile)) { errorMessage = "手机号码格式不正确"; return(false); } errorMessage = string.Empty; var isSuccess = false; if (ConfigManager.SystemConfigInfo.SmsProviderType == ESmsProviderType.Aliyun) { isSuccess = SendByAliyun(mobile, tplId, parameters, out errorMessage); } else if (ConfigManager.SystemConfigInfo.SmsProviderType == ESmsProviderType.Yunpian) { isSuccess = SendByYunpian(mobile, tplId, parameters, out errorMessage); } if (!isSuccess && string.IsNullOrEmpty(errorMessage)) { errorMessage = "后台短信发送功能暂时无法使用,请联系管理员或稍后再试"; } return(isSuccess); }
public static bool SendCode(string mobile, int code, out string errorMessage) { if (string.IsNullOrEmpty(mobile) || !StringUtils.IsMobile(mobile)) { errorMessage = "手机号码格式不正确"; return(false); } errorMessage = string.Empty; var isSuccess = false; if (ConfigManager.SystemConfigInfo.IsSmsAliDaYu && !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsAliDaYuAppKey) && !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsAliDaYuAppSecret) && !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsAliDaYuSignName) && !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsAliDaYuCodeTplId)) { isSuccess = SendCodeByAliDaYu(mobile, code, out errorMessage); } if (!isSuccess && ConfigManager.SystemConfigInfo.IsSmsYunPian && !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsYunPianApiKey) && !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsYunPianCodeTplId)) { isSuccess = SendCodeByYunPian(mobile, code, out errorMessage); } if (!isSuccess && string.IsNullOrEmpty(errorMessage)) { errorMessage = "后台短信发送功能暂时无法使用,请联系管理员或稍后再试"; } return(isSuccess); }