Esempio n. 1
0
        public int Init(int UserId, int UbkId, string BankCard, string Mobile, int Platform, int ChannelType)
        {
            BankTreatyApply model = Single(" UbkId=@UbkId and ChannelType=@ChannelType", new { UbkId, ChannelType });
            bool            flag  = false;

            if (model != null)
            {
                flag = true;
            }
            else
            {
                model = new BankTreatyApply();
            }
            model.BankCard = BankCard;
            model.Mobile   = Mobile;
            if (flag)//修改
            {
                Update(model);
                return(model.ID);
            }
            else//新增
            {
                model.Platform    = Platform;
                model.UbkID       = UbkId;
                model.ChannelType = ChannelType;
                model.UserId      = UserId;
                return(Insert(model));
            }
        }
Esempio n. 2
0
        public bool UpdateTreatycode(int Id, string Treatycode, string Smsseq, int State)
        {
            BankTreatyApply model = Single(Id);

            model.UTime      = DateTime.Now;
            model.Treatycode = Treatycode;
            model.Smsseq     = Smsseq;
            model.State      = State;
            return(Update(model));
        }
Esempio n. 3
0
        public static respMasgetModel <respBackPayModel> BackPay(int UbkId, decimal Amount, int Platform, Logic.ChannelType chanel)
        {
            string LogDic = "订单支付";

            int             TypeId = (int)chanel;
            BankTreatyApply bta    = bankTreatyApplyDao.Single(" UbkId=@UbkId and ChannelType=@TypeId", new { UbkId, TypeId });

            MasgetUser mUser = masgetUserDao.Single(" UserId=@UserId and TypeId=@TypeId", new { bta.UserId, TypeId });

            if (mUser == null)
            {
                Logs.WriteLog($"未查到用户:UserId:{bta.UserId},Platform:{Platform},BtaId:{bta.ID}", MasgetLogDic, LogDic);
                return(new respMasgetModel <respBackPayModel>()
                {
                    ret = -9999, message = "用户未进件"
                });
            }
            Users user = usersDao.Single(bta.UserId);
            bool  flag = false;

            //获取请求流水号
            int keyId = payRecordDao.Init(UbkId, Amount, Platform, Ip.GetClientIp(), (int)chanel);

            //int keyId = payRecordDao.Init(bta.UserId, Amount, Platform, Ip.GetClientIp(), bta.BankCard);
            Logs.WriteLog($"创建支付记录:UserId:{bta.UserId},Platform:{Platform},keyId:{keyId},Amount={Amount}", MasgetLogDic, LogDic);

            int requestId = yeepayLogDao.Init((int)Masget.Enums.MasgetType.订单支付, bta.UserId, Platform, keyId, (int)chanel);

            Logs.WriteLog($"获取请求流水号:UserId:{bta.UserId},Platform:{Platform},requestId:{requestId},keyId:{keyId}", MasgetLogDic, LogDic);

            reqBackPayModel model = new reqBackPayModel();

            model.ordernumber   = requestId.ToString();
            model.body          = "SJ商品购买";
            model.amount        = (Amount * 100).ToString("F0");
            model.businesstype  = "1001";
            model.paymenttypeid = "25";
            model.backurl       = MasgetNoticeUrl + "backpayNotice";
            var ext = new PayExtraParamsModel();

            ext.password         = "";
            ext.authcode         = "";
            ext.treatycode       = bta.Treatycode;
            model.payextraparams = Order <PayExtraParamsModel>(ext);
            //model.accountrule = "1";
            string json = Order <reqBackPayModel>(model);
            var    resp = PostUrl <respBackPayModel>(requestId, "masget.pay.compay.router.back.pay", json, LogDic, chanel, mUser.ID);

            if (resp.backState == 0)
            {
                //添加收银记录表
                PayCashier payCash = new PayCashier();
                payCash.ChannelType = (int)chanel;
                payCash.Value       = JsonConvert.SerializeObject(resp.data);
                payCash.LogId       = requestId;
                payCash.State       = 0;
                payCash.UserId      = bta.UserId;
                payCash.PayRecordId = keyId;
                payCash.UbkId       = UbkId;
                int payCId = payCashierDao.Insert(payCash);
                Logs.WriteLog($"添加收银记录表:UserId:{bta.UserId},Platform:{Platform},requestId:{requestId},payCId:{payCId}", MasgetLogDic, LogDic);
                resp.url = $"{Constant.CurrentApiHost}itapi/pay/cashier?payid={payCId}";
            }

            return(resp);
        }
Esempio n. 4
0
        public static respMasgetModel <respTreatyModifyModel> TreatyModify(int UbkId, string cvv2, string expirationYear, string expirationMonuth, int Platform, Logic.ChannelType chanel)
        {
            string LogDic = "修改协议信息";

            int             TypeId = (int)chanel;
            BankTreatyApply bta    = bankTreatyApplyDao.Single(" UbkId=@UbkId and ChannelType=@TypeId", new { UbkId, TypeId });

            if (bta == null)
            {
                Logs.WriteLog($"未查到协议记录:UserId:{bta.UserId},Platform:{Platform},BtaId:{bta.ID}", MasgetLogDic, LogDic);
                return(new respMasgetModel <respTreatyModifyModel>()
                {
                    ret = -9999, message = "未查到协议记录"
                });
            }
            if (bta.State != 2)
            {
                Logs.WriteLog($"快捷协议未开通:UserId:{bta.UserId},Platform:{Platform},BtaId:{bta.ID}", MasgetLogDic, LogDic);
                return(new respMasgetModel <respTreatyModifyModel>()
                {
                    ret = -9999, message = "快捷协议未开通"
                });
            }
            MasgetUser mUser = masgetUserDao.Single(" UserId=@UserId and TypeId=@TypeId", new { bta.UserId, TypeId });

            if (mUser == null)
            {
                Logs.WriteLog($"未查到用户:UserId:{bta.UserId},Platform:{Platform},BtaId:{bta.ID}", MasgetLogDic, LogDic);
                return(new respMasgetModel <respTreatyModifyModel>()
                {
                    ret = -9999, message = "用户未进件"
                });
            }
            Users user = usersDao.Single(bta.UserId);
            bool  flag = false;

            //获取请求流水号
            int requestId = yeepayLogDao.Init((int)Masget.Enums.MasgetType.修改协议信息, bta.UserId, Platform, bta.ID, (int)chanel);

            Logs.WriteLog($"获取请求流水号:UserId:{bta.UserId},Platform:{Platform},requestId:{requestId},BtaId:{bta.ID}", MasgetLogDic, LogDic);

            reqTreatyModifyModel model = new reqTreatyModifyModel();

            model.cvv2           = cvv2;
            model.expirationdate = expirationMonuth + expirationYear;
            model.treatycode     = bta.Treatycode;

            //model.accountrule = "1";
            string json = Order <reqTreatyModifyModel>(model);
            var    resp = PostUrl <respTreatyModifyModel>(requestId, "masget.pay.collect.router.treaty.modify", json, LogDic, chanel, mUser.ID);

            if (resp.backState == 0)
            {
                //更新银行卡对应通道可用
                //UserBankCard ubk = userBankCardDao.Single(UbkId);
                //ubk.UTime = DateTime.Now;
                //ubk.CVN2 = cvv2;
                //ubk.ExpiresYear = expirationYear;
                //ubk.ExpiresMouth = expirationMonuth;
                //flag = userBankCardDao.Update(ubk);
                //Logs.WriteLog($"更新银行卡信息:UserId:{bta.UserId},Platform:{Platform},requestId:{requestId},UbkId:{UbkId},flag:{flag}", MasgetLogDic, LogDic);
            }
            return(resp);
        }
Esempio n. 5
0
        public static respMasgetModel <respTreatyConfirmModel> TreatyConfirm(int UbkId, string Authcode, int Platform, Logic.ChannelType chanel)
        {
            string LogDic = "确认开通快捷协议";

            int             TypeId = (int)chanel;
            BankTreatyApply bta    = bankTreatyApplyDao.Single(" UbkId=@UbkId and ChannelType=@TypeId", new { UbkId, TypeId });

            if (bta == null)
            {
                Logs.WriteLog($"未查到协议记录:UserId:{bta.UserId},Platform:{Platform},BtaId:{bta.ID}", MasgetLogDic, LogDic);
                return(new respMasgetModel <respTreatyConfirmModel>()
                {
                    ret = -9999, message = "未查到协议记录"
                });
            }
            if (bta.State == 2)
            {
                Logs.WriteLog($"快捷协议已开通:UserId:{bta.UserId},Platform:{Platform},BtaId:{bta.ID}", MasgetLogDic, LogDic);
                return(new respMasgetModel <respTreatyConfirmModel>()
                {
                    ret = -9999, message = "快捷协议已开通"
                });
            }
            MasgetUser mUser = masgetUserDao.Single(" UserId=@UserId and TypeId=@TypeId", new { bta.UserId, TypeId });

            if (mUser == null)
            {
                Logs.WriteLog($"未查到用户:UserId:{bta.UserId},Platform:{Platform},BtaId:{bta.ID}", MasgetLogDic, LogDic);
                return(new respMasgetModel <respTreatyConfirmModel>()
                {
                    ret = -9999, message = "用户未进件"
                });
            }
            Users user = usersDao.Single(bta.UserId);
            bool  flag = false;

            //获取请求流水号
            int requestId = yeepayLogDao.Init((int)Masget.Enums.MasgetType.确认开通快捷协议, bta.UserId, Platform, bta.ID, (int)chanel);

            Logs.WriteLog($"获取请求流水号:UserId:{bta.UserId},Platform:{Platform},requestId:{requestId},BtaId:{bta.ID}", MasgetLogDic, LogDic);

            reqTreatyConfirmModel model = new reqTreatyConfirmModel();

            model.authcode   = Authcode;
            model.smsseq     = bta.Smsseq;
            model.treatycode = bta.Treatycode;

            //model.accountrule = "1";
            string json = Order <reqTreatyConfirmModel>(model);
            var    resp = PostUrl <respTreatyConfirmModel>(requestId, "masget.pay.collect.router.treaty.confirm", json, LogDic, chanel, mUser.ID);

            if (resp.backState == 0)
            {
                //更新快捷协议
                flag = bankTreatyApplyDao.UpdateTreatycode(bta.ID, resp.data.treatycode, bta.Smsseq, 2);// 1开通成功
                Logs.WriteLog($"确认开通快捷协议:UserId:{bta.UserId},Platform:{Platform},requestId:{requestId},btaId:{bta.ID},flag:{flag}", MasgetLogDic, LogDic);
                //更新银行卡对应通道可用
                UserBankCard ubk = userBankCardDao.Single(UbkId);
                ubk.State       = 1;
                ubk.UTime       = DateTime.Now;
                ubk.RelationId += TypeId + ",";
                flag            = userBankCardDao.Update(ubk);
                Logs.WriteLog($"更新银行卡对应通道可用:UserId:{bta.UserId},Platform:{Platform},requestId:{requestId},UbkId:{UbkId},flag:{flag}", MasgetLogDic, LogDic);
            }
            return(resp);
        }
Esempio n. 6
0
 /// <summary>
 /// Delete,根据实体对象删除
 /// </summary>
 /// <returns>返回,成功:true,失败:false</returns>
 public bool Delete(BankTreatyApply entity)
 {
     return(dal.Update(entity));
 }
Esempio n. 7
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <returns>返回,成功:true,失败:false</returns>
 public int Insert(BankTreatyApply entity)
 {
     return(dal.Insert(entity));
 }