public Dictionary <string, Object> Regist(Account account) { try { Dictionary <string, Object> dic = new Dictionary <string, object>(); string httpStatusCode = CommonRequest.ApiAccountRegist(account); if (httpStatusCode == "202") { //绑定逻辑 if (!string.IsNullOrEmpty(account.WxOpenID)) { dynamic resultModel = CommonRequest.ApiBindAccount(account); if (resultModel == null || !resultModel.IsOk) { logger.Debug("注册时[api/account/Regist/]微信和账号绑定失败"); } } SetAuthCookie(account); dic.Add("RESULT", "202"); } else { dic.Add("RESULT", "404"); } return(dic); } catch (Exception e) { logger.Error("注册接口异常:" + e.Message); return(null); } }
public Dictionary <string, Object> Login(Account Account) { Dictionary <string, Object> dic = new Dictionary <string, object>(); dynamic accountModel = CommonRequest.ApiAccountLogin(Account); if (accountModel != null && accountModel.Return == "202") { if (accountModel.AccoutInfo != null) { var accoutInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <Account>(accountModel.AccoutInfo.ToString()); //转换成Account类 SetAuthCookie(accoutInfo); dynamic resultModel = CommonRequest.ApiCheckMemLoginIDIsBind(Account.MemLoginID); if (resultModel != null && resultModel.IsBind) { //如果该账号已经被其它微信号绑定 dic.Add("RESULT", "303"); } else { logger.Info("微信OpenID:" + accountModel.AccoutInfo.WxOpenID); //绑定逻辑 if (accountModel != null && accountModel.AccoutInfo != null && accountModel.AccoutInfo.WxOpenID != null) { dynamic tempModel = CommonRequest.ApiBindAccount(accoutInfo); if (tempModel != null && tempModel.IsOk == false) { dic.Add("RESULT", "305"); } else { dic.Add("RESULT", "202"); } } else { dic.Add("RESULT", "202"); } } } } else { dic.Add("RESULT", "404"); } return(dic); }