Пример #1
0
        public static string Channelrebatelist(int pageindex, int pagesize, int channelid, string payment)
        {
            int totalcount = 0;
            IList <Member_channel_rebatelog> list = new Member_channel_rebatelogData().Channelrebatelist(pageindex, pagesize, channelid, payment, out totalcount);

            if (list.Count > 0)
            {
                return(JsonConvert.SerializeObject(new { type = 100, msg = list, totalcount = totalcount }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
            }
        }
Пример #2
0
        public static string Channelapplyrebate(int channelid, string applytype, string applydetail, decimal applymoney, int comid)
        {
            Member_Channel m = new MemberChannelData().GetChannelDetail(channelid);

            if (m != null)
            {
                decimal rebatemoney = m.Rebatemoney;
                if (rebatemoney < applymoney)
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "提现金额不可大于账户余额" }));
                }

                Member_channel_rebateApplylog applylog = new Member_channel_rebateApplylog
                {
                    id          = 0,
                    applytime   = DateTime.Now,
                    applytype   = applytype,
                    applydetail = applydetail,
                    applymoney  = applymoney,
                    channelid   = channelid,
                    operstatus  = 0,
                    comid       = comid
                };
                int r = new Member_channel_rebateApplylogData().Insrebateapplylog(applylog);
                if (r > 0)
                {
                    ////账户提现,返佣表和 渠道表变动

                    //获得渠道人的返佣余额
                    decimal channelrebatemoney = new Member_channel_rebatelogData().Getrebatemoney(channelid);
                    //返佣记录
                    Member_channel_rebatelog rebatelog = new Member_channel_rebatelog
                    {
                        id           = 0,
                        channelid    = channelid,
                        orderid      = 0,
                        payment      = 2,
                        payment_type = "返佣提现",
                        proid        = "0",
                        proname      = applytype + "-" + applydetail,
                        subdatetime  = DateTime.Now,
                        ordermoney   = 0,
                        rebatemoney  = -applymoney,
                        over_money   = decimal.Round(channelrebatemoney - applymoney, 2),
                        comid        = comid
                    };
                    //增加返佣记录 同时增加渠道人的返佣金额
                    new Member_channel_rebatelogData().Editrebatelog(rebatelog);
                    new Member_channel_rebatelogData().Editchannelrebate(rebatelog.channelid, rebatelog.over_money);


                    return(JsonConvert.SerializeObject(new { type = 100, msg = "成功" }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "意外错误" }));
                }
            }
            else
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "意外错误" }));
            }
        }