Beispiel #1
0
        /// <summary>
        /// 通过PCN认证
        /// </summary>
        /// <returns></returns>
        public UserAuthInfoDto UserAuthByPCN(AuthByPCNReq req, bool isAdminAuth = false)
        {
            log.Info("认证开始:" + JsonConvert.SerializeObject(req));
            PcnAcountInfoDto pcnReginfo = GetRegInfoFromPcn(req.PcnNodecode);

            if (pcnReginfo == null)
            {
                return(null);
            }
            TzcAuthLog pcnAuthLog = GetAuthLogFromPcnByPcnUserNodeid(pcnReginfo.NodeCode, req);

            if (pcnAuthLog == null)
            {
                return(null);
            }
            if (!IsCanAuthByPcn(req, pcnReginfo, pcnAuthLog, out TnetNodeinfo nodeInfo, out TzcAuthLog authLog, isAdminAuth))
            {
                return(null);
            }
            if (!CopyAuthPicToLocalFromPcn(req.Nodeid, pcnAuthLog, out string oppositeUrlIDCardPicFront, out string oppositeUrlIDCardPicBack, out string livingPicReallyUrl))
            {
                return(null);
            }
            if (!isAdminAuth && !CopyLivingPicToReallyDir(req, out livingPicReallyUrl))
            {
                DeleteAuthPic(new string[] { oppositeUrlIDCardPicFront, oppositeUrlIDCardPicBack });
                return(null);
            }
            if (!SaveAuthInfoFromPcn(req.Nodeid, pcnAuthLog, nodeInfo, authLog, oppositeUrlIDCardPicFront, oppositeUrlIDCardPicBack, livingPicReallyUrl))
            {
                return(null);
            }
            RemoveRegInfoCache(req.Nodeid);
            return(GetUserAuthInfo(req.Nodeid));
        }
Beispiel #2
0
        private bool IsCanAuthByPcnAdmin(AuthByPCNReq req, PcnAcountInfoDto pcnReginfo, TzcAuthLog pcnAuthLog, out TnetNodeinfo nodeInfo, out TzcAuthLog authLog)
        {
            if (!AuthBasicCheck(req.Nodeid, out TnetReginfo regInfo, out nodeInfo, out authLog, true))
            {
                return(false);
            }
            if (regInfo.Isconfirmed == 1 && nodeInfo != null && authLog != null && authLog.Status == 5)
            {
                Alert("已通过实人认证,不要重复认证");
                return(false);
            }
            if (db.TzcAuthBindpcnSet.Where(w => w.Pcnnodeid == pcnReginfo.NodeId || w.Nodeid == req.Nodeid).Count() > 0)
            {
                Alert("用户已通过PCN认证或此PCN账号已绑定其他用户认证");
                return(false);
            }
            var otherAuthLog = db.TzcAuthLogSet.Where(w => w.Idcard == pcnAuthLog.Idcard && w.Nodeid != req.Nodeid);

            if (otherAuthLog.Count() > 0)
            {
                Alert("此PCN账号身份证信息已被人使用");
                log.Info("PCN认证:PNCNodeid=" + pcnReginfo.NodeId + "的身份证:" + pcnAuthLog.Idcard + "存在相信认证库中");
                return(false);
            }
            if (string.IsNullOrEmpty(pcnAuthLog.Idcardpic1) || string.IsNullOrEmpty(pcnAuthLog.Idcardpic2) || string.IsNullOrEmpty(pcnAuthLog.Idcardpic3))
            {
                Alert("此PCN账号身份证图片不完整,请联系管理员");
                return(false);
            }
            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// 获取Pcn认证用户的身份证证明照
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public string GetUserIDCardFrontPicFromPcn(GetIDCardPicFromPcnReq req)
        {
            PcnAcountInfoDto pcnReginfo = GetRegInfoFromPcn(req.PcnNodecode);

            if (pcnReginfo == null)
            {
                return(null);
            }
            if (!CheckPcnPwd(req))
            {
                return(null);
            }
            TzcAuthLog pcnAuthLog = GetAuthLogFromPcnByPcnUserNodeid(req.PcnNodecode, req);

            if (pcnAuthLog == null)
            {
                return(null);
            }
            if (db.TzcAuthBindpcnSet.Where(w => w.Pcnnodeid == pcnReginfo.NodeId || w.Nodeid == req.Nodeid).Count() > 0)
            {
                Alert("此PCN账号已被其他用户绑定");
                return(null);
            }
            var otherAuthLog = db.TzcAuthLogSet.Where(w => w.Idcard == pcnAuthLog.Idcard && w.Nodeid != req.Nodeid);

            if (otherAuthLog.Count() > 0)
            {
                Alert("此PCN账号身份证信息已被人使用");
                log.Info("PCN认证:PNCNodeid=" + pcnReginfo.NodeId + "的身份证:" + pcnAuthLog.Idcard + "存在相信认证库中");
                return(null);
            }
            return(pcnAuthLog.Idcardpic1);
        }
Beispiel #4
0
        /// <summary>
        /// 是否可进行注册(PCN认证)
        /// </summary>
        /// <param name="req"></param>
        /// <param name="pcnReginfo"></param>
        /// <param name="pcnAuthLog"></param>
        /// <param name="nodeInfo"></param>
        /// <param name="authLog"></param>
        /// <returns></returns>
        private bool IsCanAuthByPcn(AuthByPCNReq req, PcnAcountInfoDto pcnReginfo, TzcAuthLog pcnAuthLog, out TnetNodeinfo nodeInfo, out TzcAuthLog authLog, bool isAdmin = false)
        {
            if (isAdmin)
            {
                return(IsCanAuthByPcnAdmin(req, pcnReginfo, pcnAuthLog, out nodeInfo, out authLog));
            }
            if (!AuthBasicCheck(req.Nodeid, out TnetReginfo regInfo, out nodeInfo, out authLog, true))
            {
                return(false);
            }
            if (regInfo.Isconfirmed == 1 && nodeInfo != null && authLog != null && authLog.Status == 5)
            {
                Alert("已通过实人认证,不要重复认证");
                return(false);
            }
            if (!CheckPcnPwd(new GetIDCardPicFromPcnReq {
                Client = req.Client, Nodeid = req.Nodeid, PcnLoginPwd = req.PcnLoginPwd, PcnNodecode = req.PcnNodecode, Sid = req.Sid, Sign = req.Sign, Tm = req.Tm
            }))
            {
                Alert("PCN登陆密码错误");
                return(false);
            }
            if (db.TzcAuthBindpcnSet.Where(w => w.Pcnnodeid == pcnReginfo.NodeId || w.Nodeid == req.Nodeid).Count() > 0)
            {
                Alert("用户已通过PCN认证或此PCN账号已绑定其他用户认证");
                return(false);
            }
            var otherAuthLog = db.TzcAuthLogSet.Where(w => w.Idcard == pcnAuthLog.Idcard && w.Nodeid != req.Nodeid);

            if (otherAuthLog.Count() > 0)
            {
                Alert("此PCN账号身份证信息已被人使用");
                log.Info("PCN认证:PNCNodeid=" + pcnReginfo.NodeId + "的身份证:" + pcnAuthLog.Idcard + "存在相信认证库中");
                return(false);
            }
            if (string.IsNullOrEmpty(pcnAuthLog.Idcardpic1) || string.IsNullOrEmpty(pcnAuthLog.Idcardpic2) || string.IsNullOrEmpty(pcnAuthLog.Idcardpic3))
            {
                Alert("此PCN账号身份证图片不完整,请联系管理员");
                return(false);
            }
            if (!req.PcnIDCardFrontPicUrl.Contains(pcnAuthLog.Idcardpic1))
            {
                Alert("身份证正面照非此PCN用户");
                return(false);
            }
            return(true);
        }