public void SendBingPhoneExist() { ThreeLoginInfo three = new ThreeLoginInfo() { openid = "1", //类型 1 wx,2 qq,3 wb type = 1 }; string token = JWTManager.Encode(three); SmsController sms = new SmsController(); InputSendSms input = new InputSendSms() { phone = "13101200134", type = EnumSms.itype.BingPhone, bingtoken = token }; //添加用户 smsClear.ClearBingTestUser(input.phone); smsClear.AddBingTestUser(input.phone, three.type); var v1 = sms.GetValidate(input).Data as YJYSoft.YL.Common.AjaxResult; Assert.IsTrue(v1.code == 1010102); //清除用户 smsClear.ClearBingTestUser(input.phone); }
public void BingPhoneExistBing() { AccountController account = new AccountController(); ThreeLoginInfo three = new ThreeLoginInfo() { openid = "13101200146", //类型 1 wx,2 qq,3 wb type = 1, nickname = "unittest", }; string token = JWTManager.Encode(three); SmsController sms = new SmsController(); InputSendSms input = new InputSendSms() { phone = "13101200146", type = EnumSms.itype.BingPhone, bingtoken = token, }; smsClear.ClearSms(input.phone); accountClear.ClearUser(input.phone); accountClear.AddBing(input.phone, three); var v1 = sms.GetValidate(input).Data as YJYSoft.YL.Common.AjaxResult; Assert.IsTrue(v1.code == 0); var v2 = sms.CheckValidate(input.phone, input.type, "123456", token).Data as YJYSoft.YL.Common.AjaxResult; Assert.IsTrue(v2.code == 1010203, "已经绑定手机验证失败"); accountClear.ClearUser(input.phone); }
internal void AddBing(string phone, ThreeLoginInfo three) { db.UserThirdAuthInfo.Add(new UserThirdAuthInfo() { UserId = 0, AuthType = three.type, AutoCode = three.openid, }); db.SaveChanges(); }
internal void AddUserBing(string phone, ThreeLoginInfo three) { var v = db.BaseUser.Add(new BaseUser() { Phone = phone, NickName = "", Number = Guid.NewGuid().ToString("N"), Scal = "", CreatTime = DateTime.Now, }); db.SaveChanges(); db.UserThirdAuthInfo.Add(new UserThirdAuthInfo() { UserId = v.UserId, AuthType = three.type, AutoCode = three.openid, }); db.SaveChanges(); }
public void BingPhone() { AccountController account = new AccountController(); ThreeLoginInfo three = new ThreeLoginInfo() { openid = "13101200144", //类型 1 wx,2 qq,3 wb type = 1, nickname = "unittest", }; string token = JWTManager.Encode(three); SmsController sms = new SmsController(); InputSendSms input = new InputSendSms() { phone = "13101200144", type = EnumSms.itype.BingPhone, bingtoken = token, }; smsClear.ClearSms(input.phone); accountClear.ClearUser(input.phone); var v1 = sms.GetValidate(input).Data as YJYSoft.YL.Common.AjaxResult; Assert.IsTrue(v1.code == 0); var v2 = sms.CheckValidate(input.phone, input.type, "123456", token).Data as YJYSoft.YL.Common.AjaxResult; Assert.IsTrue(v2.code == 0, "绑定用户验证短信失败{0}", v2.msg); var v = Newtonsoft.Json.JsonConvert.SerializeObject(v2.data); Newtonsoft.Json.JsonConvert.SerializeObject(v2.data); JObject data = Newtonsoft.Json.JsonConvert.DeserializeObject(v) as JObject; var v3 = account.SetPwd(data["temptoken"].Value <string>(), input.phone, YJYSoft.YL.Common.Encrypt.MD5Encrypt("123456"), "1", token).Data as YJYSoft.YL.Common.AjaxResult; Assert.IsTrue(v3.code == 0, "绑定用户失败{0}", v3.msg); accountClear.ClearUser(input.phone); }