Esempio n. 1
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);
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        /// <summary>
        /// 拷贝活体照片到真实路径
        /// </summary>
        /// <param name="req"></param>
        /// <param name="livingPicReallyUrl"></param>
        /// <returns></returns>
        private bool CopyLivingPicToReallyDir(AuthByPCNReq req, out string livingPicReallyUrl)
        {
            string dateTime = DateTime.Now.ToString("yyyyMMddhhmmss");

            livingPicReallyUrl = authImagePath + req.Nodeid + "-" + dateTime + "-Living_PCNAuth" + Path.GetExtension(req.LivingPicUrl);
            if (!Common.Facade.Helper.CopyFile(HttpContext.Current.Server.MapPath($"/images2/tempfile/{DateTime.Now.ToString("yyyyMMdd")}/" + Path.GetFileName(req.LivingPicUrl)), HttpContext.Current.Server.MapPath(livingPicReallyUrl)))
            {
                log.Info($"认证失败,复制文件错误:{livingPicReallyUrl}");
                Alert("认证失败");
                return(false);
            }
            //livingPicReallyUrl = Common.Facade.Helper.DomainUrl + livingPicReallyUrl;
            return(true);
        }
Esempio n. 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);
        }