public string GetSMSCode(string phone) { object obj = new { timestamp = (DateTime.Now - DateTime.Parse("1970-01-01 00:00:00")).TotalMilliseconds, mobile = phone }; requestModel req = new requestModel() { pId = System.Configuration.ConfigurationManager.ConnectionStrings["pid"].ConnectionString, encryptContent = AESHelper.AESEncrypt(JsonConvert.SerializeObject(obj)) }; try { string res = HttpWebResponseUtility.CreatePostDataResponse(System.Configuration.ConfigurationManager.ConnectionStrings["url"].ConnectionString + System.Configuration.ConfigurationManager.ConnectionStrings["getsmscode"].ConnectionString, JsonConvert.SerializeObject(req)); responseModel response = JsonConvert.DeserializeObject <responseModel>(res); if (response.status.Equals("success")) { AESHelper.AESDecrypt(response.encryptionBody); SMSModel smsmodel = JsonConvert.DeserializeObject <SMSModel>(AESHelper.AESDecrypt(response.encryptionBody)); return(smsmodel.sms_code); } else { throw new Exception(response.message); } } catch (Exception ex) { throw ex; } }
public UserInfo getUserInfo(string openid) { var obj = new { timestamp = (DateTime.Now - DateTime.Parse("1970-01-01 00:00:00")).TotalMilliseconds, openId = openid }; requestModel req = new requestModel() { pId = System.Configuration.ConfigurationManager.ConnectionStrings["pid"].ConnectionString, encryptContent = AESHelper.AESEncrypt(JsonConvert.SerializeObject(obj)) }; try { string res = HttpWebResponseUtility.CreatePostDataResponse(System.Configuration.ConfigurationManager.ConnectionStrings["url"].ConnectionString + System.Configuration.ConfigurationManager.ConnectionStrings["userInfo"].ConnectionString, JsonConvert.SerializeObject(req)); log.Debug("获取用户信息:" + res); responseModel response = JsonConvert.DeserializeObject <responseModel>(res); if (response.status.Equals("success")) { log.Debug("解析用户信息:" + AESHelper.AESDecrypt(response.encryptionBody)); UserInfo userInfo = JsonConvert.DeserializeObject <UserInfo>(AESHelper.AESDecrypt(response.encryptionBody)); return(userInfo); } else { return(null); } } catch (Exception ex) { return(null); } }
public string getQR(QRModel qr) { qr.timestamp = (DateTime.Now - DateTime.Parse("1970-01-01 00:00:00")).TotalMilliseconds; requestModel req = new requestModel() { pId = System.Configuration.ConfigurationManager.ConnectionStrings["pid"].ConnectionString, encryptContent = AESHelper.AESEncrypt(JsonConvert.SerializeObject(qr)) }; try { string res = HttpWebResponseUtility.CreatePostDataResponse(System.Configuration.ConfigurationManager.ConnectionStrings["url"].ConnectionString + System.Configuration.ConfigurationManager.ConnectionStrings["getqr"].ConnectionString, JsonConvert.SerializeObject(req)); responseModel response = JsonConvert.DeserializeObject <responseModel>(res); if (response.status.Equals("success")) { return(response.qr_image); } else { throw new Exception(response.message); } } catch (Exception ex) { return(null); } }
public bool ChangeEmail(string openId, string email) { object obj = new { timestamp = (DateTime.Now - DateTime.Parse("1970-01-01 00:00:00")).TotalMilliseconds, email, openId }; requestModel req = new requestModel() { pId = System.Configuration.ConfigurationManager.ConnectionStrings["pid"].ConnectionString, encryptContent = AESHelper.AESEncrypt(JsonConvert.SerializeObject(obj)) }; try { string res = HttpWebResponseUtility.CreatePostDataResponse(System.Configuration.ConfigurationManager.ConnectionStrings["url"].ConnectionString + System.Configuration.ConfigurationManager.ConnectionStrings["changeemail"].ConnectionString, JsonConvert.SerializeObject(req)); responseModel response = JsonConvert.DeserializeObject <responseModel>(res); if (response.status.Equals("success")) { return(true); } else { throw new Exception(response.message); } } catch (Exception ex) { throw ex; } }