/// <summary> /// 实现写入字典功能 /// </summary> protected override void FlushToDic() { if (Mobile.Count > 1000) { throw new IndexOutOfRangeException($"{nameof(Mobile)}的个数不能超过1000个"); } _dic["mobile"] = string.Join(",", Mobile); _dic["tpl_id"] = TmplId; var tplValue = string.Join("&", TmplValues.OrderBy(x => x.Key) .Select(x => { // 处理 不带 # 号 var key = x.Key; if (!key.StartsWith("#") && !key.EndsWith("#")) { key = $"#{key}#"; } return(new KeyValuePair <string, string>(key, x.Value)); }) .Select(x => $"{WebUtility.UrlEncode(x.Key)}={WebUtility.UrlEncode(x.Value ?? string.Empty)}")); _dic["tpl_value"] = tplValue; if (!string.IsNullOrEmpty(Extend)) { _dic["extend"] = Extend; } else { _dic.Remove("extend"); } if (!string.IsNullOrEmpty(UId)) { _dic["uid"] = UId; } else { _dic.Remove("uid"); } }
/// <summary> /// 实现写入字典功能 /// </summary> protected override void FlushToDic() { _dic["mobile"] = Mobile; _dic["tpl_id"] = TmplId; var tplValue = string.Join("&", TmplValues.OrderBy(x => x.Key) .Select(x => { // 处理 不带 # 号 var key = x.Key; if (!key.StartsWith("#") && !key.EndsWith("#")) { key = $"#{key}#"; } return(new KeyValuePair <string, string>(key, x.Value)); }) .Select(x => $"{WebUtility.UrlEncode(x.Key)}={WebUtility.UrlEncode(x.Value ?? string.Empty)}")); _dic["tpl_value"] = tplValue; if (!string.IsNullOrEmpty(Extend)) { _dic["extend"] = Extend; } else { _dic.Remove("extend"); } if (!string.IsNullOrEmpty(UId)) { _dic["uid"] = UId; } else { _dic.Remove("uid"); } }