public RPCResult DelBlacklist(List <string> numbers) { try { if (numbers.Count == 0) { return(new RPCResult(false, "黑名单不能为空")); } if (BlacklistDB.Del(numbers)) { string message = "Dec" + (char)2; foreach (var number in numbers) { message += number + (char)2; } BlacklistSend.Instance.Send(message.Substring(0, message.Length - 1)); return(new RPCResult(true, "")); } LogHelper.LogWarn("SMSService", "SMSService.DelBlacklist", "黑名单数据库删除失败"); return(new RPCResult(false, "删除黑名单失败")); } catch (Exception ex) { LogHelper.LogError("SMSService", "SMSService.DelBlacklist", ex.ToString()); return(new RPCResult(false, "删除黑名单出现错误")); } }
public void Test() { List <string> black = new List <string>() { "123456", "234567", "345678" }; var b = BlacklistDB.Add(black); Assert.IsTrue(b); var list = BlacklistDB.GetNumbers(); Assert.IsNotNull(list); Assert.IsTrue(list.Contains("123456")); Assert.IsTrue(list.Contains("234567")); Assert.IsTrue(list.Contains("345678")); b = BlacklistDB.Del(black); list = BlacklistDB.GetNumbers(); Assert.IsNotNull(list); Assert.IsTrue(!list.Contains("123456")); Assert.IsTrue(!list.Contains("234567")); Assert.IsTrue(!list.Contains("345678")); }