/// <summary> /// 根据 保存绑定信息 绑定该微信接收消息推送 20200523 /// </summary> public BaseViewModel SaveBindMsg(BindMsgModel bindMsg) { BaseViewModel InfoModel = new BaseViewModel(); try { var info = _userInfoRepository.GetByIdnumber(bindMsg.Idnumber); //判断是否有 账号、密码信息 if (info != null) { //判断是否已经绑定了 微信 接收消息推送 if (!string.IsNullOrEmpty(bindMsg.openid) && !string.IsNullOrEmpty(bindMsg.unionid)) { info.openid = bindMsg.openid; info.unionid = bindMsg.unionid; info.UpdateDate = DateTime.Now; _userInfoRepository.Update(info); int a = _userInfoRepository.SaveChanges(); if (a > 0) { InfoModel.Message = "绑定成功"; InfoModel.ResponseCode = 0; } else { InfoModel.Message = "绑定失败"; InfoModel.ResponseCode = 1; } } else { InfoModel.Message = "参数为空"; InfoModel.ResponseCode = 2; } } else { InfoModel.Message = "未分配用户名"; InfoModel.ResponseCode = 3; } } catch (Exception ex) { InfoModel.Message = "出现异常"; InfoModel.ResponseCode = 4; } return(InfoModel); }
public ActionResult <BaseViewModel> SaveBindMsg(BindMsgModel bindMsg) { BaseViewModel resModel = _weChatHttpClient.SaveBindMsg(bindMsg); return(resModel); }