コード例 #1
0
        public string GetPayType(int UserId)
        {
            int TypeId       = (int)Logic.KeyValueType.支付类型管理;
            var listKeyValue = MemcachHelper.Get <List <KeyValue> >(Constant.list_keyvalue_key + TypeId, DateTime.Now.AddDays(7), () =>
            {
                return(keyValueDao.GetQuery("typeid=@TypeId ", new { TypeId }, "order by Sort desc,CTime desc"));
            });
            Users user = usersDao.Single(UserId);

            Logic.VipType vip  = (Logic.VipType)user.VipType;
            JArray        list = new JArray();


            foreach (var item in listKeyValue)
            {
                JObject m = JObject.Parse(item.Value);

                JObject data    = new JObject();
                int     PayType = m["PayType"].ToInt();
                data["PayType"] = PayType;

                data["PayName"]  = m["PayName"].ToString();
                data["Quota"]    = m["Quota"].ToString();
                data["WithDraw"] = m["WithDraw"].ToString();
                data["Time"]     = m["Time"].ToString();
                data["Remark"]   = m["Remark"].ToString();

                decimal[] r = Constant.GetRate(PayType, vip);
                data["Fee"] = $"{r[0].perCent()}+{r[1].ToString("F1")}元/笔";
                list.Add(data);
            }
            return(ApiReturnStr.getApiDataList(list));
        }
コード例 #2
0
ファイル: MasgetDepository.cs プロジェクト: chenmsg/sujin
        static string[] feecode3 = new string[] { "408536", "408536", "408536", "408536", "408536" };//荣邦3
        //static string[] feecode3 = new string[] { "406591",  "502114", "521467", "556151", "704252" };//荣邦3
        public static OptionFee SelectOptionFee(Logic.ChannelType chanel, Logic.VipType vip)
        {
            OptionFee model = new OptionFee();



            decimal[] r     = Constant.GetRate(chanel == Logic.ChannelType.荣邦科技无积分 ? 1 : 0, vip);
            decimal   Rate1 = r[0];
            decimal   Rate3 = r[1];

            switch (chanel)
            {
            case Logic.ChannelType.荣邦科技积分:
                model.ratecode = feecode1[(int)vip];
                break;

            case Logic.ChannelType.荣邦科技无积分:
                model.ratecode = feecode2[(int)vip];
                break;

            case Logic.ChannelType.荣邦3:
                model.ratecode = feecode3[(int)vip];
                break;

            default:
                break;
            }
            model.Rate1 = Rate1;
            model.Rate3 = Rate3;
            return(model);
        }
コード例 #3
0
ファイル: YeepayController.cs プロジェクト: chenmsg/sujin
        public string PayFeeTool(int UserId = 0, decimal Amount = 0M, int PayType = 0)
        {
            if (UserId <= 0)
            {
                return(ApiReturnStr.getError(-100, "用户ID不能为0"));
            }
            if (Amount < 500M)
            {
                return(ApiReturnStr.getError(-100, "支付金额不能小于500"));
            }
            ToolPay model = null;
            Users   user  = userDao.Single(UserId);

            Logic.VipType vip = (Logic.VipType)user.VipType;

            decimal[] r = Constant.GetRate(PayType, vip);
            model = new ToolPay(Amount, r[0], 0, r[1], 0, 0);

            JObject data = new JObject();

            data["Amount"]       = model.Amount.ToString("F2");
            data["Rate1"]        = model.Rate1.perCent();
            data["Rate2"]        = model.Rate2.ToString("F2");
            data["Rate3"]        = model.Rate3.ToString("F2");
            data["Rate4"]        = model.Rate4.ToString("F2");
            data["Rate5"]        = model.Rate5.ToString("F2");
            data["PayFee"]       = model.PayFee.ToString("F2");
            data["BasicFee"]     = model.BasicFee.ToString("F2");
            data["ExTargetFee"]  = model.ExTargetFee.ToString("F2");
            data["ActualAmount"] = model.ActualAmount.ToString("F2");
            return(ApiReturnStr.getApiData(data));
        }
コード例 #4
0
        /// <summary>
        /// 查询个人信息
        /// </summary>
        /// <param name="cid"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public string Single(int cid = 0, int UserId = 0)
        {
            if (UserId <= 0)
            {
                return(ApiReturnStr.getError(-100, "参数错误"));
            }

            JObject data = new JObject();
            var     user = userDao.Single(UserId);


            if (user == null || user.UserId <= 0)
            {
                return(ApiReturnStr.getError(-100, "用户不存在"));
            }
            data["Mobile"]          = user.Mobile;// ITOrm.Utility.StringHelper.Util.GetHiddenString(user.Mobile, 3, 4);
            data["IsRealState"]     = user.IsRealState;
            data["IsRealStateText"] = user.IsRealState == 0 ? "未认证" : "已认证";
            data["RealName"]        = user.RealName;
            data["IdCard"]          = Util.GetHiddenString(user.IdCard, 6, 4);
            data["VipType"]         = user.VipType;
            data["VipTypeTxt"]      = ((Logic.VipType)user.VipType).ToString();
            var version = TQuery.GetString("version");

            if (user.VipType == 1 && version == "1.0.0" && cid == 3)
            {
                data["VipType"] = 2;
            }
            data["AvatarImg"] = ITOrm.Utility.Const.Constant.StaticHost + userImageDao.GetUrl(user.AvatarImg);
            Logic.VipType vip = (Logic.VipType)user.VipType;
            decimal[]     r   = Constant.GetRate(0, vip);
            decimal[]     r2  = Constant.GetRate(1, vip);

            data["Rate1"]     = r[0].perCent();
            data["Rate3"]     = r[1].ToString("F1");
            data["NoneRate1"] = r2[0].perCent();
            data["NoneRate3"] = r2[1].ToString("F1");


            var ubk = userBankCardDao.Single(" UserId=@UserId and TypeId=0 and state=1  ", new { UserId });

            data["BankCard"] = "";
            data["BankName"] = "";
            data["BankCode"] = "";
            if (ubk != null)
            {
                data["BankCard"] = ubk.BankCard;
                data["BankName"] = ubk.BankName;
                data["BankCode"] = ubk.BankCode;
            }

            data["BaseUserName"] = "******";
            if (user.BaseUserId > 0)
            {
                var baseUser = userDao.Single(user.BaseUserId);
                data["BaseUserName"] = baseUser.RealName;
            }
            return(ApiReturnStr.getApiData(data));
        }
コード例 #5
0
        private bool SetFeeHandle()
        {
            bool flag = false;

            if (listSetFee != null && listSetFee.Count > 0)
            {
                while (listSetFee.Count > 0)
                {
                    var           item  = listSetFee[0];
                    var           user  = usersDao.Single(item.UserId);
                    Logic.VipType vip   = (Logic.VipType)user.VipType;
                    decimal       rate1 = 0.0050M;
                    decimal       rate3 = 2M;

                    var r = Constant.GetRate((int)Logic.PayType.积分, vip);
                    rate1 = r[0];
                    rate3 = r[1];
                    //审核
                    var result1 = YeepayDepository.FeeSetApi(item.UserId, (int)Logic.Platform.系统, ITOrm.Payment.Yeepay.Enums.YeepayType.设置费率1, rate1.ToString("F4"));
                    if (vip == Logic.VipType.顶级代理)
                    {
                        var result3 = YeepayDepository.FeeSetApi(item.UserId, (int)Logic.Platform.系统, ITOrm.Payment.Yeepay.Enums.YeepayType.设置费率3, rate3.ToString("F0"));
                    }
                    var result4 = YeepayDepository.FeeSetApi(item.UserId, (int)Logic.Platform.系统, ITOrm.Payment.Yeepay.Enums.YeepayType.设置费率4, "0");
                    var result5 = YeepayDepository.FeeSetApi(item.UserId, (int)Logic.Platform.系统, ITOrm.Payment.Yeepay.Enums.YeepayType.设置费率5, "0");
                    Logs.WriteLog($"处理ID:{item.ID},UserId:{item.UserId},设置费率1:{JsonConvert.SerializeObject(result1)},设置费率4:{JsonConvert.SerializeObject(result4)},设置费率5:{JsonConvert.SerializeObject(result5)}", "d:\\Log\\自动处理", string.Format("商户设置费率{0}", (result1.backState == 0 && result4.backState == 0 && result5.backState == 0)?"成功":"失败"));
                    if (result1.backState == 0 && result4.backState == 0 && result5.backState == 0)
                    {
                        int num = Convert.ToInt32(_tbxSetRateSuccess.Text);
                        num++;
                        _tbxSetRateSuccess.Text = num.ToString();
                    }
                    else
                    {
                        int num = Convert.ToInt32(_tbxSetRateFail.Text);
                        num++;
                        _tbxSetRateFail.Text = num.ToString();
                    }
                    listSetFee.Remove(item);
                    Thread.Sleep(ConfigInfo.theadTime);
                }
            }
            else
            {
                listSetFee = yeepayUserDao.GetQuery(10, " IsAudit=1 and DATEDIFF(ss,UTime,GETDATE())>3 AND (RateState1=0 OR RateState4=0 OR RateState5=0)  ", null, "order by id asc");
                if (listSetFee != null && listSetFee.Count > 0)
                {
                    return(SetFeeHandle());
                }
            }
            return(flag);
        }
コード例 #6
0
        public string masfee()
        {
            var list = masgetUserDao.GetQuery(" State=1 AND TypeId=4 ");

            foreach (var item in list)
            {
                var           user   = usersDao.Single(item.UserId);
                Logic.VipType vip    = (Logic.VipType)user.VipType;
                decimal[]     r      = Constant.GetRate((int)Logic.PayType.积分, vip);
                var           result = MasgetDepository.SamenameUpdate(item.UserId, 1, (Logic.ChannelType)item.TypeId, vip);
            }

            return("masfee");
        }
コード例 #7
0
        public string ybaofee()
        {
            YeepayUserBLL yee  = new YeepayUserBLL();
            var           list = yee.GetQuery(" UserId IN(100058,100060,100067,100094) ");

            foreach (var item in list)
            {
                var           user   = usersDao.Single(item.UserId);
                Logic.VipType vip    = (Logic.VipType)user.VipType;
                decimal[]     r      = Constant.GetRate((int)Logic.PayType.积分, vip);
                var           result = YeepayDepository.FeeSetApi(item.UserId, 1, Payment.Yeepay.Enums.YeepayType.设置费率1, r[0].ToString("F4"));
            }

            return("");
        }
コード例 #8
0
        public string yeefee()
        {
            var yeeaa = new YeepayUserBLL();
            var list  = yeeaa.GetQuery(" 1=1 ");

            foreach (var item in list)
            {
                var           user = usersDao.Single(item.UserId);
                Logic.VipType vip  = (Logic.VipType)user.VipType;
                decimal[]     r    = Constant.GetRate((int)Logic.PayType.积分, vip);
                YeepayDepository.FeeSetApi(user.UserId, 1, Payment.Yeepay.Enums.YeepayType.设置费率1, r[0].ToString("F4"));
                YeepayDepository.FeeSetApi(user.UserId, 1, Payment.Yeepay.Enums.YeepayType.设置费率3, r[1].ToString("F0"));
            }

            return("yeefee");
        }
コード例 #9
0
        public ActionResult Pay(int UserId, decimal Amount = 0)
        {
            if (UserId == 0 || Amount < 500M)
            {
                return(new RedirectResult($"/Prompt?state=-100&msg=参数错误&url=/debug/"));
            }

            var user = userDao.Single(UserId);


            Logic.VipType vip   = (Logic.VipType)user.VipType;
            decimal[]     r     = Constant.GetRate(0, vip);
            ToolPay       tp    = new ToolPay(Amount, r[0], r[1], 0.0038M, 1M);
            PayRecord     model = new PayRecord();

            model.UserId         = UserId;
            model.Amount         = Amount;
            model.Platform       = 1;
            model.Ip             = "1.1.1.1";
            model.BankCard       = "622202XXXXXXXXXXXXXX";
            model.Fee            = tp.PayFee;
            model.Rate           = tp.Rate1;
            model.Fee3           = tp.Rate3;
            model.State          = 10;
            model.DrawState      = 10;
            model.WithDrawAmount = model.Amount - model.Fee;//结算金额
            model.ActualAmount   = tp.ActualAmount;
            model.DrawBankCard   = "622222XXXXXX";
            model.BankCode       = "ICBC";
            model.PayerName      = user.RealName;
            model.PayerPhone     = user.Mobile;
            model.ChannelType    = 4;
            model.Income         = tp.Income;
            model.DrawIncome     = tp.Rate3 - 1;//结算收益

            var result = payRecordDao.Insert(model);

            int    backState = result > 0 ? 0 : -100;
            string message   = result > 0 ? "操作成功" : "操作失败";

            //交易成功回调
            UsersDepository.NoticeSuccess(result, UserId);

            return(new RedirectResult($"/Prompt?state={backState}&msg={message}&url=/debug/"));
        }
コード例 #10
0
        public string GetVipTypeIntroduce(int cid = 0, int VipType = 0)
        {
            if (VipType < 0)
            {
                return(ApiReturnStr.getError(-100, "参数错误"));
            }
            var version = TQuery.GetString("version");

            if (VipType == 1 && version == "1.0.0" && cid == 3)
            {
                VipType = 4;
            }

            int TypeId       = (int)Logic.KeyValueType.支付类型管理;
            var listKeyValue = MemcachHelper.Get <List <KeyValue> >(Constant.list_keyvalue_key + TypeId, DateTime.Now.AddDays(7), () =>
            {
                return(keyValueDao.GetQuery("typeid=@TypeId ", new { TypeId }, "order by Sort desc,CTime desc"));
            });

            Logic.VipType vip  = (Logic.VipType)VipType;
            JArray        list = new JArray();

            foreach (var item in listKeyValue)
            {
                JObject m       = JObject.Parse(item.Value);
                JObject data    = new JObject();
                int     PayType = m["PayType"].ToInt();
                data["PayName"] = m["PayName"].ToString();
                data["Quota"]   = m["Quota"].ToString();
                decimal[] r = Constant.GetRate(PayType, vip);
                data["Fee"] = $"{r[0].perCent()}+{r[1].ToString("F1")}元/笔";
                if (!(PayType == 1 && vip == Logic.VipType.顶级代理))//顶级代理隐藏无积分费率
                {
                    list.Add(data);
                }
            }
            return(ApiReturnStr.getApiDataList(list));
        }
コード例 #11
0
ファイル: Constant.cs プロジェクト: chenmsg/sujin
        public static decimal[] GetRate(int payType, Logic.VipType vipType)
        {
            decimal Rate1 = 0M;
            decimal Rate3 = 0M;

            Logic.PayType type = (Logic.PayType)payType;
            switch (type)
            {
            case Logic.PayType.积分:
                Rate1 = fee1Rate1[(int)vipType];
                Rate3 = fee1Rate3[(int)vipType];
                break;

            case Logic.PayType.无积分:
                Rate1 = fee2Rate1[(int)vipType];
                Rate3 = fee2Rate3[(int)vipType];
                break;

            default:
                break;
            }

            return(new decimal[] { Rate1, Rate3 });
        }
コード例 #12
0
ファイル: MasgetDepository.cs プロジェクト: chenmsg/sujin
        public static respMasgetModel <object> SamenameUpdate(int UserId, int Platform, Logic.ChannelType chanel, Logic.VipType vip)
        {
            string     LogDic = "修改同名进出商户费率";
            int        TypeId = (int)chanel;
            MasgetUser mUser  = masgetUserDao.Single(" UserId=@UserId and TypeId=@TypeId", new { UserId, TypeId });

            if (mUser == null)
            {
                return(new respMasgetModel <object>()
                {
                    ret = -100, message = "用户不存在"
                });
            }
            bool flag = false;
            //获取请求流水号
            int requestId = yeepayLogDao.Init((int)Masget.Enums.MasgetType.修改同名进出商户费率, UserId, Platform, 0, (int)chanel);

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

            var optionFee = SelectOptionFee(chanel, vip);
            reqSamenameUpdateModel model = new reqSamenameUpdateModel();

            model.companyid        = mUser.CompanyId;
            model.ratecode         = optionFee.ratecode;
            model.paymenttypeid    = "25";
            model.subpaymenttypeid = "25";
            //model.accountrule = "1";
            string json = Order <reqSamenameUpdateModel>(model);
            var    resp = PostUrl <object>(requestId, "masget.pay.compay.router.samename.update", json, LogDic, chanel);

            if (resp.backState == 0)
            {
                //更新用户
                mUser.Rate1 = optionFee.Rate1;
                mUser.Rate3 = optionFee.Rate3;
                mUser.UTime = DateTime.Now;
                flag        = masgetUserDao.Update(mUser);
                Logs.WriteLog($"修改费率:UserId:{UserId},Platform:{Platform},requestId:{requestId},flag:{flag},Rate1{ optionFee.Rate1}, Rate3:{ optionFee.Rate1}", MasgetLogDic, LogDic);
            }
            return(resp);
        }
コード例 #13
0
ファイル: MasgetDepository.cs プロジェクト: chenmsg/sujin
        public static respMasgetModel <respSubcompanyAddModel> SubcompanyAdd(int UserId, int Platform, Logic.ChannelType chanel)
        {
            string LogDic = "快速进件";

            UserBankCard ubk  = userBankCardDao.Single("UserId=@UserId and State=1 and TypeId=0  ", new { UserId });
            Users        user = usersDao.Single(UserId);
            bool         flag = false;
            //获取请求流水号
            int requestId = yeepayLogDao.Init((int)Masget.Enums.MasgetType.快速进件, UserId, Platform, 0, (int)chanel);

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

            switch (chanel)
            {
            case Logic.ChannelType.荣邦科技积分:
                break;

            case Logic.ChannelType.荣邦科技无积分:
                wu = "(无积分)";
                break;

            case Logic.ChannelType.荣邦3:
                wu = "(积分3)";
                break;

            default:
                break;
            }
            reqSubcompanyAddModel model = new reqSubcompanyAddModel();

            model.companyname = $"{user.RealName}({user.UserId}){wu}";
            model.companycode = user.UserId.ToString();
            model.accountname = user.RealName;
            model.bankaccount = ubk.BankCard;
            //model.accounttype = "1";
            //model.bankcardtype = "1";
            model.mobilephone = ubk.Mobile;
            model.idcardno    = user.IdCard;
            model.address     = "无";
            model.loginname   = ubk.Mobile;



            Logic.VipType vip       = (Logic.VipType)user.VipType;
            var           optionFee = SelectOptionFee(chanel, vip);

            model.ratecode = optionFee.ratecode;

            model.bank     = "";
            model.bankcode = "";
            //model.accountrule = "1";
            string json = Order <reqSubcompanyAddModel>(model);
            var    resp = PostUrl <respSubcompanyAddModel>(requestId, "masget.webapi.com.subcompany.add", json, LogDic, chanel);

            if (resp.backState == 0)
            {
                //创建用户
                var mid = masgetUserDao.Init(UserId, resp.data.appid, resp.data.session, resp.data.secretkey, resp.data.companyid, Platform, (int)chanel, optionFee.Rate1, optionFee.Rate3);
                Logs.WriteLog($"创建荣邦渠道用户:UserId:{UserId},Platform:{Platform},requestId:{requestId},MasgetUserId:{mid},Rate1{optionFee.Rate1},Rate3:{optionFee.Rate3}", MasgetLogDic, LogDic);
                if (chanel == Logic.ChannelType.荣邦3)
                {
                    masgetUserDao.UpdateState(UserId, (int)chanel, 1);
                    Logs.WriteLog($"默认设置已入驻:UserId:{UserId},chanel:{Platform},MasgetUserId:{mid}", MasgetLogDic, LogDic);
                }
            }
            return(resp);
        }
コード例 #14
0
ファイル: PayRecordBLL.cs プロジェクト: chenmsg/sujin
        public int Init(int UbkID, decimal Amount, int Platform, string IP, int ChannelType)
        {
            var ubk   = userBankCardDao.Single(UbkID);
            var users = usersDao.Single(ubk.UserId);
            //提现卡
            var ubkDraw = userBankCardDao.Single(" TypeId=0 and UserId=@UserId", new { ubk.UserId });

            int TypeId = (int)Logic.KeyValueType.支付通道管理;

            //获得通道列表
            var listChannelPay = MemcachHelper.Get <List <KeyValue> >(Constant.list_keyvalue_key + TypeId, DateTime.Now.AddDays(7), () =>
            {
                return(keyValueDao.GetQuery(" typeid=@TypeId ", new { TypeId }, "order by Sort desc,CTime desc"));
            });


            //var kv = keyValueDao.Single("KeyId=@ChannelType and TypeId=@TypeId", new { ChannelType , TypeId });

            var kv      = listChannelPay.Find(m => m.KeyId == ChannelType && m.TypeId == TypeId);
            int payType = 0;

            payType = (kv != null && kv.Value2 == "1") ? 1 : 0;//确定通道  积分类型

            JObject data       = JObject.Parse(kv.Value);
            decimal BasicRate1 = data["Rate1"].ToDecimal();
            decimal BasicRate3 = data["Rate3"].ToDecimal();

            Logic.VipType vip = (Logic.VipType)users.VipType;
            decimal[]     r   = Constant.GetRate(payType, vip);
            //ToolPay tp = new ToolPay(Amount, r[0], 0, r[1], 0, 0);
            ToolPay tp = new ToolPay(Amount, r[0], r[1], BasicRate1, BasicRate3);


            //ToolPay tp = null;
            //switch ((Logic.ChannelType)ChannelType)
            //{
            //    case Logic.ChannelType.易宝:
            //        var yeepayUser = yeepayUserDao.Single("UserId=@UserId", new { ubk.UserId });
            //        tp=new ToolPay(Amount, yeepayUser.Rate1, yeepayUser.Rate2, yeepayUser.Rate3, yeepayUser.Rate4, yeepayUser.Rate5);
            //        break;
            //    case Logic.ChannelType.荣邦科技积分:
            //        var mUser = masgetUserDao.Single(" UserId=@UserId and TypeId=@ChannelType ", new { ubk.UserId, ChannelType });
            //        tp = new ToolPay(Amount, mUser.Rate1, 0, mUser.Rate3, 0, 0);
            //        break;
            //    case Logic.ChannelType.荣邦科技无积分:
            //        var mUser2 = masgetUserDao.Single(" UserId=@UserId and TypeId=@ChannelType ", new { ubk.UserId, ChannelType });
            //        tp = new ToolPay(Amount, mUser2.Rate1, 0, mUser2.Rate3, 0, 0);
            //        break;
            //    default:
            //        break;
            //}


            PayRecord model = new PayRecord();

            model.UserId         = ubk.UserId;
            model.Amount         = Amount;
            model.Platform       = Platform;
            model.Ip             = IP;
            model.BankCard       = ubk.BankCard;
            model.Fee            = tp.PayFee;
            model.Rate           = tp.Rate1;
            model.Fee3           = tp.Rate3;
            model.DrawState      = 0;                        //未发起
            model.WithDrawAmount = model.Amount - model.Fee; //结算金额
            model.ActualAmount   = tp.ActualAmount;
            model.DrawBankCard   = ubkDraw.BankCard;
            model.BankCode       = ubk.BankCode;
            model.PayerName      = users.RealName;
            model.PayerPhone     = ubk.Mobile;
            model.ChannelType    = ChannelType;
            model.Income         = tp.Income;
            model.DrawIncome     = tp.Rate3 - BasicRate3;//结算收益
            return(Insert(model));
        }