/// <summary> /// 邀请码进入 /// </summary> private void InviteQRHandler() { try { //教师邀请 if (_EventKey.StartsWith(WxConfig.QR_Invite_TecPre)) { var wxUser = WXApi.GetWXUserInfo(_wxMessage.FromUserName); var user = _UserSrv.AddOrUpdateFromWXUser(wxUser); _TecSrv.NewTecFromUser(user); _ResultMsg = _wxMessage.toText(WXReplyContent.NewTec(user.Name)); } else if (_EventKey.StartsWith(WxConfig.QR_Invite_User)) { var ownOpenId = _EventKey.Split("_")[2]; var user = _BusinessSrv.InvitedUserComing(_wxMessage.FromUserName, ownOpenId); _ResultMsg = _wxMessage.toText(WXReplyContent.NewUserAdd(user.Name)); } } catch (Exception ex) { NLogHelper.ErrorTxt($"[InviteQRHandler]-FromUserName:{_wxMessage.FromUserName}| 信息:{ex.Message}"); } }
private EUserInfo TryInvitedUserComing(string OpenId, WXUserInfo wXUser) { var act = HttpContext.Request.Query["act"]; EUserInfo ui = null; if (act == "Invite") { string ownOpenId = HttpContext.Request.Query["OwnOpenId"]; if (!string.IsNullOrEmpty(ownOpenId)) { ui = _BusinessSrv.InvitedUserComing(OpenId, ownOpenId, wXUser); } } return(ui); }