增加微信公众号基本对接后台管理

This commit is contained in:
2020-02-19 18:16:16 +08:00
parent 4ca3cf3610
commit f28c84f3bb
47 changed files with 80536 additions and 9 deletions
+31
View File
@@ -1053,6 +1053,37 @@ namespace COMCMS.Common
return "";
}
}
/// <summary>
/// 将对象转换为Int32类型
/// </summary>
/// <param name="str">要转换的字符串</param>
/// <param name="defValue">缺省值</param>
/// <returns>转换后的int类型结果</returns>
public static int StrToInt(string str, int defValue)
{
if (string.IsNullOrEmpty(str) || str.Trim().Length >= 11 || !Regex.IsMatch(str.Trim(), @"^([-]|[0-9])[0-9]*(\.\w*)?$"))
return defValue;
int rv;
if (Int32.TryParse(str, out rv))
return rv;
return Convert.ToInt32(StrToFloat(str, defValue));
}
/// <summary>
/// string型转换为float型
/// </summary>
/// <param name="strValue">要转换的字符串</param>
/// <param name="defValue">缺省值</param>
/// <returns>转换后的int类型结果</returns>
public static float StrToFloat(object strValue, float defValue)
{
if ((strValue == null))
return defValue;
return StrToFloat(strValue.ToString(), defValue);
}
#endregion
#region COMCMS类型