diff --git a/Mtxfw.DAL/MemberStatistics_huiyuan.cs b/Mtxfw.DAL/MemberStatistics_huiyuan.cs index c9f0fb2..1432a44 100644 --- a/Mtxfw.DAL/MemberStatistics_huiyuan.cs +++ b/Mtxfw.DAL/MemberStatistics_huiyuan.cs @@ -31,10 +31,11 @@ namespace Mtxfw.DAL /// /// /// - /// + /// 付款金额 + /// 消费值 /// /// - /// + /// 0热卖推荐,1会员商城 /// /// /// @@ -43,7 +44,7 @@ namespace Mtxfw.DAL /// /// /// - public static void UpdteYJ(Mtxfw.Utility.Config config, Model.user_info umodel, Double pv, int gtype, DateTime dt, int ttype,int ptype, int peitype, string orderid, int OId, string Province, string City, string County, string Tradingarea) + public static void UpdteYJ(Mtxfw.Utility.Config config, Model.user_info umodel, Double pv, Double xfz, int gtype, DateTime dt, int ttype,int ptype, int peitype, string orderid, int OId, string Province, string City, string County, string Tradingarea) { Model.User_Errlog mo; string mindt = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"; @@ -60,7 +61,7 @@ namespace Mtxfw.DAL mjl2.Cutmoney = 0; mjl2.Totalmoney = umodel.umoney20 + pv; mjl2.addtime = dt; - mjl2.BZContent = "购买套餐"; + mjl2.BZContent = ttype == 0 ? "购买热卖商品" : "购买商城商品"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; @@ -92,8 +93,12 @@ namespace Mtxfw.DAL //} #endregion - ///如果符合条件更新自己的等级 - var uplevel = UpdteSelfuLevel(gtype, umodel, config, ptype, pv); + ///如果热卖推荐且符合条件更新自己的等级 + if(ttype == 0) + { + var uplevel = UpdteSelfuLevel(gtype, umodel, config, ptype, pv); + } + /// umodel.ContactIDS 值的格式如下:",68,160021,160023,160024," string[] ASuperiorsIDS = (umodel.ContactIDS).Split(','); @@ -131,8 +136,15 @@ namespace Mtxfw.DAL daoUser.UpdateMoney("umoney19", pv, dID); var isLast = ak == 1; - //先更新业绩 - yfbl = JiangJinJS(config, umodel, ds.Tables[0].Rows[0], YContactID, YContactIDS, pv, yfbl); + //热卖商品,且遍历到当前会员是付款仁直接推荐人,则计算佣金 + if(ttype == 0 && YuLevel == YContactID) + { + //计算佣金 + YongJinJS(config, umodel, ds.Tables[0].Rows[0], YContactID, YContactIDS, pv, xfz, yfbl, ttype); + } + + //结算奖金(按等级算批发差价) + yfbl = JiangJinJS(config, umodel, ds.Tables[0].Rows[0], YContactID, YContactIDS, pv, xfz, yfbl, ttype); } @@ -140,8 +152,8 @@ namespace Mtxfw.DAL /////如果符合条件更新自己的等级 移到上面了,这里 注释掉了,如果今后没影响,记得删掉,留着没意义 //var uplevel = UpdteSelfuLevel(gtype, umodel, config, ptype, pv); - ///更新上级的等级 - if (uplevel > 0) + ///如果热卖商城的商品,更新上级的等级 + if (uplevel > 0 && ttype == 0) { UpdteContacttLevel(gtype, umodel, config, ds.Tables[0].Rows[0], YContactID, YContactIDS, uplevel); ///上面更新金额和等级的几个方法顺序不能颠倒,否则会出错 @@ -910,16 +922,18 @@ namespace Mtxfw.DAL #endregion /// - /// 奖金结算 + /// 奖金结算(批发差价) /// /// 配置文件 /// 支付客户数据 /// 一条支付链条用户数据 /// 支付客户直接上级 /// 支付链条 - /// 消费金额 + /// 付款金额 + /// 消费值 /// 已分奖金比例 - public static Double JiangJinJS(Mtxfw.Utility.Config config, Model.user_info umodel, DataRow ContactRow, int YContactID,string YContactIDS, Double pv,double yfbl) + /// 0热卖推荐,1会员商城 + public static Double JiangJinJS(Mtxfw.Utility.Config config, Model.user_info umodel, DataRow ContactRow, int YContactID,string YContactIDS, Double pv, Double xfz, double yfbl,int ttype) { Model.User_Errlog mo; DateTime dt = DateTime.Now; @@ -933,23 +947,60 @@ namespace Mtxfw.DAL int buyerlevel = umodel.uLevel; var buyerlevelname = Mtxfw.Utility.Common.GetuLevelname(buyerlevel); var Contactlevelname = Mtxfw.Utility.Common.GetuLevelname(ContactLevel); ; + var BZContent = "";//备注 + if (ttype == 0) + { + BZContent = "热卖商品批发差价" + } + else + { + BZContent = "商城商品批发差价" + } //当前奖金比例 Double fixed_bonus = 0; //当前级别对应的最大奖金比例 - 下级已分比例 等于当前等级剩余可分奖金比例 - switch (ContactLevel) + //热卖商品分配方案 + if (ttype == 0) { - case 1: - fixed_bonus = config.level1_fixed_bonus - yfbl; - break; - case 2: - fixed_bonus = config.level2_fixed_bonus - yfbl; - break; - case 3: - fixed_bonus = config.level3_fixed_bonus - yfbl; - break; - case 4: - fixed_bonus = config.level4_fixed_bonus - yfbl; - break; + //直接推荐人获得业务佣金 + if (ContactLevel == YContactID) + { + var yjbl + } + switch (ContactLevel) + { + case 1: + fixed_bonus = config.level1_fixed_bonus - yfbl; + break; + case 2: + fixed_bonus = config.level2_fixed_bonus - yfbl; + break; + case 3: + fixed_bonus = config.level3_fixed_bonus - yfbl; + break; + case 4: + fixed_bonus = config.level4_fixed_bonus - yfbl; + break; + } + } + //商城商品分配方案 + else + { + switch (ContactLevel) + { + case 1: + fixed_bonus = config.level1_fixed_bonus - yfbl; + break; + case 2: + fixed_bonus = config.level2_fixed_bonus - yfbl; + break; + case 3: + fixed_bonus = config.level3_fixed_bonus - yfbl; + break; + case 4: + fixed_bonus = config.level4_fixed_bonus - yfbl; + break; + } } if (fixed_bonus > 0) { @@ -965,7 +1016,7 @@ namespace Mtxfw.DAL mjl2.Cutmoney = 0; mjl2.Totalmoney = -(Yumoney17 - jaingjin); mjl2.addtime = dt; - mjl2.BZContent = "奖金结算"; + mjl2.BZContent = BZContent; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; @@ -1002,6 +1053,88 @@ namespace Mtxfw.DAL return result; } + + /// + /// 佣金结算 + /// + /// 配置文件 + /// 支付客户数据 + /// 一条支付链条用户数据 + /// 支付客户直接上级 + /// 支付链条 + /// 付款金额 + /// 消费值 + /// 已分奖金比例 + /// 0热卖推荐,1会员商城 + public static Double YongJinJS(Mtxfw.Utility.Config config, Model.user_info umodel, DataRow ContactRow, int YContactID, string YContactIDS, Double pv, Double xfz, double yfbl, int ttype) + { + Model.User_Errlog mo; + DateTime dt = DateTime.Now; + double result = yfbl; + try + { + int dID = Convert.ToInt32(ContactRow["ID"].ToString()); + //Yumoney17就是余额,而且写成负数 + Double Yumoney17 = Convert.ToDouble(Convert.ToDouble(ContactRow["umoney17"]).ToString("f4")); + int ContactLevel = Convert.ToInt32(ContactRow["uLevel"].ToString()); + int buyerlevel = umodel.uLevel; + var buyerlevelname = Mtxfw.Utility.Common.GetuLevelname(buyerlevel); + var Contactlevelname = Mtxfw.Utility.Common.GetuLevelname(ContactLevel); ; + var BZContent = "业务佣金";//备注 + + Double fixed_bonus = 0//config.level3_fixed_bonus + if (fixed_bonus > 0) + { + if (pv > 0) + { + Double jaingjin = Convert.ToDouble((fixed_bonus * pv).ToString("f4")); + if (jaingjin > 0.0000) + { + var mjl2 = new Model.user_Results_jl2(); + mjl2.MemberId = dID; + mjl2.MemberId2 = 0; + mjl2.Addmoney = jaingjin; + mjl2.Cutmoney = 0; + mjl2.Totalmoney = -(Yumoney17 - jaingjin); + mjl2.addtime = dt; + mjl2.BZContent = BZContent; + mjl2.PayID = ""; + mjl2.OrdersIDs = ""; + mjl2.OrdersID = 0; + mjl2.utype = 1; + mjl2.utype2 = 0; + mjl2.Seef = 0; + mjl2.seeftime = dt; + mjl2.gtype = 0; + daojl2.Add(mjl2); + } + var flag = daoUser.UpdateMoney("umoney17", -jaingjin, dID); + if (flag > 0) + { + //增加已分比例 + return result += fixed_bonus; + } + + } + + } + } + catch (Exception ex) + { + mo = new Model.User_Errlog(); + + mo.DLID = 0; + mo.ErrType = "奖金结算,JiangJinJS"; + mo.addtime = dt; + mo.ErrBody = ex.ToString(); + mo.ErrBody2 = ex.Message; + new DAL.User_Errlog().Add(mo); + + } + return result; + } + + #region 更新奖金 public static void UpdteJJ(Mtxfw.Utility.Config config, int YID, Int64 ResultId, string ContactIDS, string UserName, Double umoney26, Double pv, ref Double FHMoney0, int gtype, DateTime dt, int ifxy) { diff --git a/Mtxfw.Model/P_Guige.cs b/Mtxfw.Model/P_Guige.cs index 6c3c0fe..8ccb3d1 100644 --- a/Mtxfw.Model/P_Guige.cs +++ b/Mtxfw.Model/P_Guige.cs @@ -19,7 +19,7 @@ namespace Mtxfw.Model private Double _G_JG1;// private Double _G_JG2;//ԭ private Double _G_JG3;//ɱ - private Double _G_JG4;//ֵ//ֵ + private Double _G_JG4;//ֵ//ֵ/ֵƷģʽ2ϰΪ׼ۣ private Double _G_JG5;///׵ֱƽ private Double _G_JG6;//˰/׵ƽ private Double _G_JG7;//ֱƽ diff --git a/Mtxfw.Model/order_info.cs b/Mtxfw.Model/order_info.cs index 620ffbd..86196c7 100644 --- a/Mtxfw.Model/order_info.cs +++ b/Mtxfw.Model/order_info.cs @@ -11,7 +11,7 @@ namespace Mtxfw.Model { } #region Model private int _id; - private int _pid;//直播ID或拼单商品ID + private int _pid;//直播ID或拼单商品ID 明明就是规格id private int _poid;//拼单父ID private int _pcount;//需拼单数量/已转售数量 private int _ypcount;//已拼单数量/已提货数量 diff --git a/Mtxfw.VipSite/Admin_Member_Products_add1.aspx b/Mtxfw.VipSite/Admin_Member_Products_add1.aspx index 1c3a264..8e9de8d 100644 --- a/Mtxfw.VipSite/Admin_Member_Products_add1.aspx +++ b/Mtxfw.VipSite/Admin_Member_Products_add1.aspx @@ -461,7 +461,7 @@ var len = 1; function onaddgg() { //var html = '