コード例 #1
0
        /// <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}");
            }
        }
コード例 #2
0
        /// <summary>
        /// 关注
        /// </summary>
        private void SubscribeHandler()
        {
            NLogHelper.InfoTxt("SubscribeHandler In");
            EUserInfo ui = _UserSrv.GetUserInfo(_wxMessage.FromUserName);

            if (ui == null)
            {
                var wxUser = WXApi.GetWXUserInfo(_wxMessage.FromUserName);
                ui = _UserSrv.AddOrUpdateFromWXUser(wxUser);

                _ResultMsg = _wxMessage.toText(WXReplyContent.NewUserAdd(ui.wx_Name));
            }
            else
            {
                _ResultMsg = _wxMessage.toText(WXReplyContent.UserComing(ui.wx_Name));
            }
        }