Exemple #1
0
        /// <summary>
        /// 使一个购买单的佣金生效
        /// 完结订单时使用
        /// </summary>
        /// <param name="order"></param>
        public void AgentMoneyOK()
        {
            //string sql = "update Lebi_Agent_Money set Type_id_AgentMoneyType=382 where Order_id=" + order.id + "";
            //Common.ExecuteSql(sql);
            List <Lebi_Agent_Money> models = B_Lebi_Agent_Money.GetList("Order_id=" + Order.id + "", "");

            foreach (Lebi_Agent_Money model in models)
            {
                model.Type_id_AgentMoneyStatus = 382;
                Lebi_User user = B_Lebi_User.GetModel(model.User_id);
                if (user != null)
                {
                    UpdateUserMoney(user, model);
                    B_Lebi_Agent_Money.Update(model);
                }
            }
        }
Exemple #2
0
        protected decimal zmoney; //总金额
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            if (!Shop.Bussiness.B_API.Check("plugin_agent"))
            {
                Response.Write(Tag("权限不足"));
                Response.End();
            }
            if (CurrentUser.id == 0)
            {
                Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + ""));
            }
            LoadTheme(themecode, siteid, languagecode, pcode);
            path     = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_UserCenter", "") + "\"><span>" + Tag("会员中心") + "</span></a><em>&raquo;</em><a href=\"" + URL("P_UserAgent", "") + "\"><span>" + Tag("推广佣金") + "</span></a><em>&raquo;</em><a class=\"text\"><span>" + Tag("佣金查询") + "</span></a>";
            PageSize = RequestTool.getpageSize(20);
            key      = RequestTool.RequestString("key");
            status   = RequestTool.RequestInt("status", 0);
            dateFrom = Rstring("dateFrom");
            dateTo   = Rstring("dateTo");
            DateTime lbsql_dateFrom = RequestTool.RequestDate("dateFrom");
            DateTime lbsql_dateTo   = RequestTool.RequestDate("dateTo");

            string where = "User_id=" + CurrentUser.id;
            if (key != "")
            {
                where += " and (Order_Code like lbsql{'%" + key + "%'} or Product_Number like lbsql{'%" + key + "%'})";
            }
            if (status > 0)
            {
                where += " and Type_id_AgentMoneyStatus=" + status;
            }
            if (dateFrom != "" && dateTo != "")
            {
                where += " and (datediff(d,Time_add,'" + lbsql_dateFrom + "')<=0 and datediff(d,Time_add,'" + lbsql_dateTo + "')>=0)";
            }
            models = B_Lebi_Agent_Money.GetList(where, "", PageSize, pageindex);
            int recordCount = B_Lebi_Agent_Money.Counts(where);

            PageString = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&key=" + key + "&status=" + status + " & dateFrom = " + dateFrom + " & dateTo = " + dateTo, pageindex, PageSize, recordCount, CurrentLanguage);
            string money_  = Common.GetValue("select sum(Money) from Lebi_Agent_Money where User_id=" + CurrentUser.id + " and Type_id_AgentMoneyStatus=382 and datediff(d,Time_add,'" + System.DateTime.Now + "')>" + SYS.CommissionMoneyDays + "");
            string zmoney_ = Common.GetValue("select sum(Money) from Lebi_Agent_Money where User_id=" + CurrentUser.id + " and Type_id_AgentMoneyStatus=382");

            decimal.TryParse(money_, out money);
            decimal.TryParse(zmoney_, out zmoney);
        }
Exemple #3
0
        /// <summary>
        /// 添加佣金记录
        /// </summary>
        /// <param name="money"></param>
        /// <param name="user"></param>
        /// <param name="order"></param>
        /// <param name="type"></param>
        /// <param name="status"></param>
        /// <param name="areaid"></param>
        /// <param name="productid"></param>
        /// <param name="productparentid"></param>
        private void AddMoney(decimal money, Lebi_User user, int type, int areaid, int productid, int productparentid, string productnumber = "")
        {
            if (money == 0)
            {
                SystemLog.Add("金额:" + money + ",会员:" + user.id + ",订单:" + Order.Code + "");
                return;
            }
            int IsSpread = 1;

            if (Order.Supplier_id > 0)
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(Order.Supplier_id);
                if (supplier != null)
                {
                    IsSpread = supplier.IsSpread;
                }
            }
            if (IsSpread == 1) //判断是否开启推广佣金 by lebi.kingdge 2015-04-10
            {
                Lebi_Agent_Money model = new Lebi_Agent_Money();
                model.Area_id = areaid;
                model.Money   = money;
                model.Type_id_AgentMoneyType = type;
                if (Order.Type_id_OrderType == 212)//退货单
                {
                    model.Money = 0 - money;
                }
                model.Order_Code               = Order.Code;
                model.Order_id                 = Order.id;
                model.Product_id               = productid;
                model.Product_id_parent        = productparentid;
                model.Type_id_AgentMoneyStatus = 381;
                model.Product_Number           = productnumber;
                model.User_id       = user.id;
                model.User_UserName = user.UserName;
                model.Supplier_id   = Order.Supplier_id;
                model.DT_id         = user.DT_id;
                B_Lebi_Agent_Money.Add(model);
                UpdateUserMoney(user, model);
            }
        }
Exemple #4
0
        /// <summary>
        /// 使一个购买单的佣金失效
        /// 已完结订单取消完结时使用
        /// </summary>
        /// <param name="order"></param>
        public void AgentMoneyCancal()
        {
            //string sql = "update Lebi_Agent_Money set Type_id_AgentMoneyType=383 where Order_id=" + order.id + "";
            //Common.ExecuteSql(sql);
            List <Lebi_Agent_Money> models = B_Lebi_Agent_Money.GetList("Order_id=" + Order.id + "", "");

            foreach (Lebi_Agent_Money model in models)
            {
                model.Type_id_AgentMoneyStatus = 381;
                Lebi_User user = B_Lebi_User.GetModel(model.User_id);
                if (user != null)
                {
                    B_Lebi_Agent_Money.Update(model);
                    user.AgentMoney_history -= model.Money;
                    user.AgentMoney         -= model.Money;
                    B_Lebi_User.Update(user);
                    //model.Money = 0 - model.Money;
                    //UpdateUserMoney(user, model);
                }
            }
        }
Exemple #5
0
 /// <summary>
 /// 删除一个订单的佣金记录
 /// 已审核订单取消审核的情况下使用
 /// </summary>
 /// <param name="order"></param>
 public static void AgentMoneyDelete(Lebi_Order order)
 {
     B_Lebi_Agent_Money.Delete("Order_id=" + order.id + "");
 }