Beispiel #1
0
        /// <summary>
        /// 验证BC端登陆用户信息
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="passWord"></param>
        public bool VerifyBCLoginUser(string userId, string passWord)
        {
            //先通过session,查出用户ID
            string pUserID = SysCurUser.GetCurUserID();

            LogSwHelper.Sing.Info("BC验证,从Session中获取userid:" + pUserID);
            if (!string.IsNullOrEmpty(pUserID))
            {
                CurUserM pUser = SysCurUser.GetCurUser();
                if (pUser != null && pUser.UserId == userId)
                {
                    var pwdCode = Emperor.UtilityLib.CyberUtils.Encrypt("Aes", 256, passWord, "TW" + userId);
                    if (pUser.Password == pwdCode)
                    {
                        return(true);
                    }
                }
            }
            else
            {
                //适用于登陆验证,通过用户ID获取当前用户
                UserTM pUser = GetUserByID(userId, _da.GetUserByUserID);
                if (pUser != null && pUser.UserId == userId)
                {
                    var pwdCode = Emperor.UtilityLib.CyberUtils.Encrypt("Aes", 256, passWord, "TW" + userId);
                    if (pUser.Password == pwdCode)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// 验证WA端登陆用户信息
        /// </summary>
        /// <param name="code"></param>
        /// <param name="agentid"></param>
        public void VerifyWALoginUser(string code, string agentid)
        {
            //先通过session,查出用户ID
            string pUserID = SysCurUser.GetCurUserID();

            LogSwHelper.Sing.Info("WA验证,从Session中获取userid:" + pUserID);
            if (string.IsNullOrEmpty(pUserID))
            {
                LogSwHelper.Sing.Info("获取code:" + code);
                LogSwHelper.Sing.Info("获取agentid:" + agentid);
                int iagentid = 0;
                if (int.TryParse(agentid, out iagentid))
                {
                    var pWeixinid = GetWeixinidByAPI(code, iagentid);
                    if (string.IsNullOrEmpty(pWeixinid))
                    {
                        throw new Exception();
                    }
                    LogSwHelper.Sing.Info("从API中获取微信号:" + pWeixinid);
                    //适用于登陆验证,通过微信号获取当前用户
                    UserTM pUser = GetUserByID(pWeixinid, _da.GetUserByWeixinid);
                    //WA端验证的是微信号
                    if (pUser == null || pUser.WeixinId != pWeixinid)
                    {
                        throw new Exception();
                    }

                    LogSwHelper.Sing.Info("从API中获取userid:" + pUser.UserId);
                }
                else
                {
                    throw new Exception();
                }
            }
        }