新分配方案改了一部分
This commit is contained in:
@@ -31,10 +31,11 @@ namespace Mtxfw.DAL
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="umodel"></param>
|
||||
/// <param name="pv"></param>
|
||||
/// <param name="pv">付款金额</param>
|
||||
/// <param name="xfz">消费值</param>
|
||||
/// <param name="gtype"></param>
|
||||
/// <param name="dt"></param>
|
||||
/// <param name="ttype"></param>
|
||||
/// <param name="ttype">0热卖推荐,1会员商城</param>
|
||||
/// <param name="ptype"></param>
|
||||
/// <param name="peitype"></param>
|
||||
/// <param name="orderid"></param>
|
||||
@@ -43,7 +44,7 @@ namespace Mtxfw.DAL
|
||||
/// <param name="City"></param>
|
||||
/// <param name="County"></param>
|
||||
/// <param name="Tradingarea"></param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// 奖金结算
|
||||
/// 奖金结算(批发差价)
|
||||
/// </summary>
|
||||
/// <param name="config">配置文件</param>
|
||||
/// <param name="umodel">支付客户数据</param>
|
||||
/// <param name="ContactRow">一条支付链条用户数据</param>
|
||||
/// <param name="YContactID">支付客户直接上级</param>
|
||||
/// <param name="YContactIDS">支付链条</param>
|
||||
/// <param name="pv">消费金额</param>
|
||||
/// <param name="pv">付款金额</param>
|
||||
/// <param name="xfz">消费值</param>
|
||||
/// <param name="yfbl">已分奖金比例</param>
|
||||
public static Double JiangJinJS(Mtxfw.Utility.Config config, Model.user_info umodel, DataRow ContactRow, int YContactID,string YContactIDS, Double pv,double yfbl)
|
||||
/// <param name="ttype">0热卖推荐,1会员商城</param>
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 佣金结算
|
||||
/// </summary>
|
||||
/// <param name="config">配置文件</param>
|
||||
/// <param name="umodel">支付客户数据</param>
|
||||
/// <param name="ContactRow">一条支付链条用户数据</param>
|
||||
/// <param name="YContactID">支付客户直接上级</param>
|
||||
/// <param name="YContactIDS">支付链条</param>
|
||||
/// <param name="pv">付款金额</param>
|
||||
/// <param name="xfz">消费值</param>
|
||||
/// <param name="yfbl">已分奖金比例</param>
|
||||
/// <param name="ttype">0热卖推荐,1会员商城</param>
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user