/// <summary> /// 添加若干手机号到黑名单,可用于网站对此手机号的使用次数进行了限制 /// </summary> /// <param name="pid"></param> /// <param name="mobiles"></param> /// <param name="uid"></param> /// <param name="token"></param> /// <returns></returns> public AddIgnoreListResp addIgnoreList(int pid, String mobiles, String uid, String token) { AddIgnoreListResp resp = new AddIgnoreListResp(); String result = ""; try { result = send.HttpPost(url, "action=addIgnoreList&uid=" + uid + "&token=" + token + "&mobiles=" + mobiles + "&pid=" + pid); info("添加若干手机号到黑名单,mobiles:" + mobiles + ",uid:" + uid + ",token:" + token + ",pid:" + pid + ",返回:" + result); if (isNumber(result)) { resp.State = true; resp.Row = int.Parse(result); resp.Result = result; } else { resp.State = false; resp.Result = result; } } catch (Exception e) { error("添加若干手机号到黑名单,mobiles:" + mobiles + ",uid:" + uid + ",token:" + token + ",pid:" + pid + ",e:" + e); resp.State = false; } return(resp); }
/** * 加黑一个手机号码 * @param mobile */ private void addIgnore(String mobile) { int retry = 0; bool isretry = false; do { retry++; AddIgnoreListResp resp = AimaInterface.getInstance().addIgnoreList(pid, mobile, uid, token); if (!resp.State && ("message|速度过快,请稍后再试".Equals(resp.Result) || "message|please try again later".Equals(resp .Result)) ) { isretry = true; try { Thread.Sleep(500); } catch { } } else { isretry = false; } } while (isretry && retry < 3); //失败重试三次 Console.WriteLine("加黑一个手机号码:" + mobile); }