Example #1
0
        protected void DoRefund(Vip entity)
        {
            var vipFee = _vipDal.GetAll <VipFee>().Where(p => p.VipId == entity.Id && p.Status == (int)PayStatus.支付成功).OrderByDescending(p => p.FeeTime).FirstOrDefault();

            if (vipFee != null && entity.FeeStatus == (int)PayStatus.支付成功)
            {
                var refundReqData = RefundRequestData.GetRefundRequestData((int)vipFee.Fee, vipFee.OrderCode, Server.MapPath("~/App_Data/apiclient_cert.p12"));
                _vipDal.Insert <VipFeeRefund>(new VipFeeRefund
                {
                    RtnOrderCode   = refundReqData.RtnOrderCode,
                    OrderCode      = vipFee.OrderCode,
                    VipId          = vipFee.VipId,
                    VipName        = entity.VipName,
                    RefundFee      = vipFee.Fee,
                    WXRtnOrderCode = refundReqData.WxRtnOrderCode,
                    Remark         = refundReqData.Remark
                });

                if (refundReqData.RefundResult.ToLower() == "success")
                {
                    //entity.IsReturnFee = true;
                    entity.FeeStatus = (int)PayStatus.待支付;
                }
            }
        }
Example #2
0
        public ActionResult Register(Vip vip, string verifyCode)
        {
            ViewBag.Title = "注册";

            if (string.IsNullOrEmpty(vip.MobileNo) || string.IsNullOrEmpty(vip.Password) || string.IsNullOrEmpty(vip.VipName))
            {
                ViewBag.Error = "请完善资料";
                return(View());
            }
            //验证手机号是否存在
            var isCheck = _dal.GetByMobile(vip.MobileNo);

            if (isCheck != null)
            {
                ViewBag.Error = "手机号已存在";
                return(View());
            }

            //验证身份证
            var user = _dal.GetByCardNo(vip.CardNo);

            if (user != null)
            {
                ViewBag.Error = "身份证号已存在";
                return(View());
            }

            //验证码
            if (Session["VerCode"] == null || Session["PhoneNo"] == null || Session["VerCode"].ToString() != verifyCode || Session["PhoneNo"].ToString() != vip.MobileNo)
            {
                ViewBag.Error = "验证码不正确";
                return(View());
            }

            var token = AccessTokenContainer.TryGetAccessToken(AppConfig.Instance.AppId, AppConfig.Instance.AppSecret);

            if (!string.IsNullOrEmpty(vip.CardImg))
            {
                var fileName = $"/upload/cardimg/{Guid.NewGuid().ToString("N")}.jpg";
                Senparc.Weixin.MP.AdvancedAPIs.MediaApi.Get(token, vip.CardImg, Server.MapPath("~" + fileName));

                vip.CardImg = fileName;
            }

            //添加用户
            vip.CreatedBy   = "system";
            vip.CreatedTime = DateTime.Now;
            vip.UpdatedBy   = "system";
            vip.UpdatedTime = DateTime.Now;
            vip.ImgPath     = "/assets/web/images/i_03.png";

            _dal.Insert(vip);

            OAuthHelper.DoOAuth(HttpContext, vip.MobileNo);

            return(new EmptyResult());
        }
Example #3
0
        private void DoRun()
        {
            while (true)
            {
                try
                {
                    VipDal _dal = new VipDal();

                    var jobLog = new JobLog
                    {
                        JobName   = "续费通知",
                        StartTime = DateTime.Now,
                        EndTime   = DateTime.Now,
                        Result    = ""
                    };

                    var vips = _dal.GetExpiredVips();

                    foreach (var v in vips)
                    {
                        v.FeeStatus = (int)PayStatus.待支付;
                    }

                    _dal.Update(vips);

                    jobLog.EndTime = DateTime.Now;
                    jobLog.Result  = "成功";
                    _dal.Insert(jobLog);
                }
                catch (Exception ex)
                {
                    Senparc.Weixin.WeixinTrace.SendCustomLog("AutoPayNotifyJob", ex.Message);
                }


                Thread.Sleep(1000 * 60 * 10);
            }
        }