小程序首页做完后的备份

This commit is contained in:
lym
2026-03-29 01:05:28 +08:00
parent ab0d429a4a
commit 14203dad93
18 changed files with 2029 additions and 853 deletions

View File

@@ -98,6 +98,13 @@ namespace Mtxfw.DAL
if (ttype == 0)
{
uplevel = UpdteSelfuLevel(gtype, umodel, config, ptype, pv);
//升到2级及以上后要审视是业绩达到升到更高级标准防止因为一开始低于二级导致错过业绩升级
if (uplevel>1)
{
umodel.uLevel = uplevel;
ReviseselfLevel(gtype, umodel, config, uplevel);
}
}
@@ -106,6 +113,8 @@ namespace Mtxfw.DAL
int uds = 1, uds0 = 1, uds1 = 1;
int YContactID = umodel.ContactID;
//直接推荐人等级
int ContactLevel = 0;
string YContactIDS = umodel.ContactIDS;
ASuperiorsIDS = (umodel.ContactIDS).Split(',');
Double yfbl = 0;
@@ -115,34 +124,52 @@ namespace Mtxfw.DAL
{
//
DataSet ds = daoUser.GetList1("ID,ContactIDS,ContactID,umoney17,umoney18,uLevel", "gtype=" + gtype + " and UserState='正常' And IFStores=0 And uLevel17=0 And id=" + ASuperiorsIDS[ak]);
if (ds.Tables[0].Rows.Count > 0)
{
int dID = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"].ToString());
//string YContactID = ds.Tables[0].Rows[0]["ContactID"].ToString();
//string YContactIDS = ds.Tables[0].Rows[0]["ContactIDS"].ToString();
Double umoney18 = Convert.ToDouble((Convert.ToDouble(ds.Tables[0].Rows[0]["umoney18"]) + pv).ToString("f2"));
//Double Yumoney19 = Convert.ToDouble((Convert.ToDouble(ds.Tables[0].Rows[0]["umoney19"]) + pv).ToString("f2"));
int YuLevel = Convert.ToInt32(ds.Tables[0].Rows[0]["uLevel"].ToString());
//int YuLevel4 = Convert.ToInt32(ds.Tables[0].Rows[0]["uLevel4"].ToString());
//int YuLevel11 = Convert.ToInt32(ds.Tables[0].Rows[0]["uLevel11"].ToString());
//int YIFBecomeAgents = Convert.ToInt32(ds.Tables[0].Rows[0]["IFBecomeAgents"].ToString());
//已分的奖金比例
//推荐链条中的人等级比被推荐人等级高,才可以分奖金
if (umodel.uLevel < (YuLevel))
{
daoUser.UpdateMoney("umoney18", pv, dID);
daoUser.UpdateMoney("umoney19", pv, dID);
var isLast = ak == 1;
//热卖商品,且遍历到当前会员是付款仁直接推荐人,则计算佣金
if(ttype == 0 && YuLevel == YContactID)
///总业绩(排除自己购买)
daoUser.UpdateMoney("umoney18", pv, dID);
//本月业绩
daoUser.UpdateMoney("umoney19", pv, dID);
//遍历到当前会员是付款人直接推荐人
if (dID == YContactID && YuLevel>0)
{
//获取直接推荐人的等级
ContactLevel = YuLevel;
//直接推荐人,且大于普通会员级别
if (YuLevel > 0)
{
//计算佣金
YongJinJS(config, umodel, ds.Tables[0].Rows[0], YContactID, YContactIDS, pv, xfz, yfbl, ttype);
}
}
//推荐链条中的人等级比直接推荐人等级高,或者是购买者直接推荐人,才可以分奖金
if ((ContactLevel < YuLevel && ContactLevel > 0)|| dID == YContactID)
{
var isLast = ak == 1;
////遍历到当前会员是付款仁直接推荐人,则计算佣金
//if (dID == 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);
@@ -153,10 +180,11 @@ namespace Mtxfw.DAL
/////如果符合条件更新自己的等级 移到上面了,这里 注释掉了,如果今后没影响,记得删掉,留着没意义
//var uplevel = UpdteSelfuLevel(gtype, umodel, config, ptype, pv);
///如果热卖商城的商品,更新上级的等级
if (uplevel > 0 && ttype == 0)
/////如果热卖商城的商品,更新上级的等级
//if (uplevel > 0 && ttype == 0)
if ( ttype == 0)
{
UpdteContacttLevel(gtype, umodel, config, ds.Tables[0].Rows[0], YContactID, YContactIDS, uplevel);
UpdteContacttLevel(gtype, umodel, config, ds.Tables[0].Rows[0], YContactID, YContactIDS, uplevel,umoney18);
///上面更新金额和等级的几个方法顺序不能颠倒,否则会出错
}
@@ -206,43 +234,73 @@ namespace Mtxfw.DAL
var uplevel3_amount = config.direct_upgrade_level3_amount_condition;
var uplevel4_amount = config.direct_upgrade_level4_amount_condition;
var uplevel5_amount = config.direct_upgrade_level5_amount_condition;
if (duLevel < ptype)
{
var flag = daoUser.UpdateuLevel("uLevel", ptype, dID);
if (ptype == 1)
{
//买1级商品提升到1级会员并加积分
daoUser.UpdateMoney("umoney30", pv, dID);
}
return flag ? 1 : 0;
}
else if (uplevel1_amount > 0 && pv >= uplevel1_amount && duLevel < 1)
//if (duLevel < ptype)
//{
// var flag = daoUser.UpdateuLevel("uLevel", ptype, dID);
// if (ptype == 1)
// {
// //买1级商品提升到1级会员并加积分
// daoUser.UpdateMoney("umoney30", pv, dID);
// }
// return flag ? 1 : 0;
//}
//else
//必须先判断大的,再判断小的,否则只算小的,不算大的
if (uplevel5_amount > 0 && pv >= uplevel5_amount && duLevel <5)
{
//买1级商品提升到1级会员并加积分
daoUser.UpdateMoney("umoney30", pv, dID);
var flag = daoUser.UpdateuLevel("uLevel", 1, dID);
return flag ? 1 : 0;
//daoUser.UpdateMoney("umoney30", pv, dID);
var flag = daoUser.UpdateuLevel("uLevel", 5, dID);
return flag ? 5 : 0;
}
else if (uplevel2_amount > 0 && pv >= uplevel2_amount && duLevel < 2)
else if (uplevel4_amount > 0 && pv >= uplevel4_amount && duLevel < 4)
{
var flag = daoUser.UpdateuLevel("uLevel", 2, dID);
return flag ? 2 : 0;
var flag = daoUser.UpdateuLevel("uLevel", 4, dID);
return flag ? 4 : 0;
}
else if (uplevel3_amount > 0 && pv >= uplevel3_amount && duLevel < 3)
{
var flag = daoUser.UpdateuLevel("uLevel", 3, dID);
return flag ? 3 : 0;
}
else if (uplevel4_amount > 0 && pv >= uplevel4_amount && duLevel < 4)
else if (uplevel2_amount > 0 && pv >= uplevel2_amount && duLevel < 2)
{
var flag = daoUser.UpdateuLevel("uLevel", 4, dID);
return flag ? 4 : 0;
var flag = daoUser.UpdateuLevel("uLevel", 2, dID);
return flag ? 2 : 0;
}
else if (uplevel5_amount > 0 && pv >= uplevel5_amount && duLevel < 4)
else if (uplevel1_amount > 0 && pv >= uplevel1_amount && duLevel < 1)
{
var flag = daoUser.UpdateuLevel("uLevel", 5, dID);
return flag ? 3 : 0;
var flag = daoUser.UpdateuLevel("uLevel", 1, dID);
return flag ? 1 : 0;
}
//if (uplevel1_amount > 0 && pv >= uplevel1_amount && duLevel < 1)
//{
// //买1级商品提升到1级会员并加积分
// //daoUser.UpdateMoney("umoney30", pv, dID);
// var flag = daoUser.UpdateuLevel("uLevel", 1, dID);
// return flag ? 1 : 0;
//}
//else if (uplevel2_amount > 0 && pv >= uplevel2_amount && duLevel < 2)
//{
// var flag = daoUser.UpdateuLevel("uLevel", 2, dID);
// return flag ? 2 : 0;
//}
//else if (uplevel3_amount > 0 && pv >= uplevel3_amount && duLevel < 3)
//{
// var flag = daoUser.UpdateuLevel("uLevel", 3, dID);
// return flag ? 3 : 0;
//}
//else if (uplevel4_amount > 0 && pv >= uplevel4_amount && duLevel < 4)
//{
// var flag = daoUser.UpdateuLevel("uLevel", 4, dID);
// return flag ? 4 : 0;
//}
//else if (uplevel5_amount > 0 && pv >= uplevel5_amount && duLevel < 4)
//{
// var flag = daoUser.UpdateuLevel("uLevel", 5, dID);
// return flag ? 3 : 0;
//}
}
}
@@ -272,7 +330,8 @@ namespace Mtxfw.DAL
/// <param name="YContactID">直属上级</param>
/// <param name="YContactIDS">上级链条</param>
/// <param name="selflevel">我当前上升到的等级</param>
public static void UpdteContacttLevel(int gtype, Model.user_info umodel, Mtxfw.Utility.Config config, DataRow Rows,int YContactID, string YContactIDS,int selflevel)
/// <param name="zyj">团队总业绩</param>
public static void UpdteContacttLevel(int gtype, Model.user_info umodel, Mtxfw.Utility.Config config, DataRow Rows,int YContactID, string YContactIDS,int selflevel,Double zyj)
{
Model.User_Errlog mo;
DateTime dt = DateTime.Now;
@@ -281,23 +340,23 @@ namespace Mtxfw.DAL
{
var rowid = Convert.ToInt32(Rows["ID"].ToString());
var rowlevel = Convert.ToInt32(Rows["uLevel"].ToString());
//只给直属上级升级,如果不是直属上级就不升级了
if (YContactID != rowid)
{
return;
}
////只给直属上级升级,如果不是直属上级就不升级了
//if (YContactID != rowid)
//{
// return;
//}
//如果直接上级等级小于1,就不升级了.从第1级开始这种类别的升级
if (rowlevel < 1)
{
return;
}
////如果直接上级等级小2,就不升级了.从第2级开始这种类别的升级
//if (rowlevel < 2)
//{
// return;
//}
//如果当前级别超过直接上级,直接上级就不能通过他不升级了
if (selflevel> rowlevel)
{
return;
}
////如果当前级别超过直接上级,直接上级就不能通过他不升级了
//if (selflevel> rowlevel)
//{
// return;
//}
if (umodel != null)
{
var uplevel5_amount = config.upgrade_level5_amount_condition;
@@ -306,74 +365,72 @@ namespace Mtxfw.DAL
var upgrade_level5 = config.upgrade_level5_person_condition;
var upgrade_level3 = config.upgrade_level3_person_condition;
var upgrade_level4 = config.upgrade_level4_person_condition;
var umoneyyjze = umodel.umoney18;
var umoneyyjze = zyj;// umodel.umoney18;
var uplevel = 0;
var tjcount = 0;
switch (selflevel)
tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel > 1");
switch (rowlevel)
{
//case 2:
// if (rowlevel == 2)
// {
// // rowlevel是否升到2级的条件
// if (uplevel2_amount>0 && upgrade_level2>0)
// {
// tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
// if (tjcount >= upgrade_level2 && umoneyyjze >= uplevel2_amount)
// {
// uplevel = 2;
// }
// }
// }
// break;
case 3:
//
if (rowlevel == 3)
{
case 2:
// rowlevel是否升到3级的条件
if (uplevel3_amount > 0 && upgrade_level3 > 0)
{
tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
//tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
if (tjcount >= upgrade_level3 && umoneyyjze >= uplevel3_amount)
{
uplevel = 3;
}
}
}
break;
case 4:
if (rowlevel == 4)
{
case 3:
//
// rowlevel是否升到4级的条件
if (uplevel4_amount > 0 && upgrade_level4 > 0)
{
tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
// tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
if (tjcount >= upgrade_level4 && umoneyyjze >= uplevel4_amount)
{
uplevel = 4;
}
}
}
break;
case 5:
if (rowlevel == 4)
{
case 4:
// rowlevel是否升到5级的条件
if (uplevel5_amount > 0 && upgrade_level5 > 0)
{
tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
// tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
if (tjcount >= upgrade_level5 && umoneyyjze >= uplevel5_amount)
{
uplevel = 5;
}
}
}
break;
//case 5:
// // rowlevel是否升到5级的条件
// if (uplevel5_amount > 0 && upgrade_level5 > 0)
// {
// // tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
// if (tjcount >= upgrade_level5 && umoneyyjze >= uplevel5_amount)
// {
// uplevel = 5;
// }
// }
// break;
}
if (uplevel > 0)
{
@@ -396,6 +453,121 @@ namespace Mtxfw.DAL
}
/// <summary>
/// 补充因级别低时错过的业绩奖励当升级到2级时补上业绩升级
/// </summary>
/// <param name="gtype"></param>
/// <param name="umodel"></param>
/// <param name="config"></param>
/// <param name="selflevel"></param>
public static void ReviseselfLevel(int gtype, Model.user_info umodel, Mtxfw.Utility.Config config, int selflevel)
{
Model.User_Errlog mo;
DateTime dt = DateTime.Now;
try
{
var rowid = umodel.Id;
var rowlevel = selflevel;
if (umodel != null)
{
var uplevel5_amount = config.upgrade_level5_amount_condition;
var uplevel3_amount = config.upgrade_level3_amount_condition;
var uplevel4_amount = config.upgrade_level4_amount_condition;
var upgrade_level5 = config.upgrade_level5_person_condition;
var upgrade_level3 = config.upgrade_level3_person_condition;
var upgrade_level4 = config.upgrade_level4_person_condition;
//总业绩
var umoneyyjze = umodel.umoney18;
var uplevel = 0;
var tjcount = 0;
//健康大使及以上级别人数
tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel > 1");
switch (rowlevel)
{
case 2:
// rowlevel是否升到3级的条件
if (uplevel3_amount > 0 && upgrade_level3 > 0)
{
//tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
if (tjcount >= upgrade_level3 && umoneyyjze >= uplevel3_amount)
{
uplevel = 3;
}
}
break;
case 3:
//
// rowlevel是否升到4级的条件
if (uplevel4_amount > 0 && upgrade_level4 > 0)
{
// tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
if (tjcount >= upgrade_level4 && umoneyyjze >= uplevel4_amount)
{
uplevel = 4;
}
}
break;
case 4:
// rowlevel是否升到5级的条件
if (uplevel5_amount > 0 && upgrade_level5 > 0)
{
// tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
if (tjcount >= upgrade_level5 && umoneyyjze >= uplevel5_amount)
{
uplevel = 5;
}
}
break;
//case 5:
// // rowlevel是否升到5级的条件
// if (uplevel5_amount > 0 && upgrade_level5 > 0)
// {
// // tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and ContactID=" + rowid + " and uLevel=" + rowlevel + "");
// if (tjcount >= upgrade_level5 && umoneyyjze >= uplevel5_amount)
// {
// uplevel = 5;
// }
// }
// break;
}
if (uplevel > 0)
{
daoUser.UpdateuLevel("uLevel", uplevel, rowid);
}
}
}
catch (Exception ex)
{
mo = new Model.User_Errlog();
mo.DLID = 0;
mo.ErrType = "更新自身会员级别";
mo.addtime = dt;
mo.ErrBody = ex.ToString();
mo.ErrBody2 = ex.Message;
new DAL.User_Errlog().Add(mo);
}
}
public static void UpdteuLevel(int gtype, Mtxfw.Utility.Config config, int dID, string YContactIDS, int YuLevel, int YuLevel4, int YuLevel11, int YIFBecomeAgents, Double Yumoney18, Double Yumoney19, DateTime dt)
{
int duLevel = YuLevel;
@@ -945,6 +1117,7 @@ namespace Mtxfw.DAL
Model.User_Errlog mo;
DateTime dt = DateTime.Now;
double result = yfbl;
Double jfje = xfz;
try
{
@@ -958,59 +1131,80 @@ namespace Mtxfw.DAL
var BZContent = "";//备注
if (ttype == 0)
{
// jfje = pv;
BZContent = "热卖商品批发差价";
}
else
{
// jfje = xfz;
BZContent = "商城商品批发差价";
}
//当前奖金比例
Double fixed_bonus = 0;
//当前级别对应的最大奖金比例 - 下级已分比例 等于当前等级剩余可分奖金比例
//热卖商品分配方案
if (ttype == 0)
//if (ttype == 0)
//{
// 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;
// }
//}
switch (ContactLevel)
{
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;
}
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;
case 5:
fixed_bonus = config.level5_fixed_bonus - yfbl;
break;
}
if (fixed_bonus > 0)
{
if (pv > 0)
if (jfje > 0)
{
Double jaingjin = Convert.ToDouble((fixed_bonus * pv).ToString("f4"));
Double jaingjin = Convert.ToDouble((fixed_bonus * jfje).ToString("f4"));
if (jaingjin > 0.0000)
{
var mjl2 = new Model.user_Results_jl2();
@@ -1074,15 +1268,25 @@ namespace Mtxfw.DAL
{
Model.User_Errlog mo;
DateTime dt = DateTime.Now;
double result = yfbl;
Double result = yfbl;
Double jsje = 0;
// 热卖商品按 金额计算佣金 ,商城商品按消费值计算佣金
if (ttype == 0)
{
jsje = pv;
}
else
{
jsje = xfz;
}
try
{
var uplevel2_amount = config.direct_upgrade_level2_amount_condition;
//var uplevel2_amount = config.direct_upgrade_level2_amount_condition;
///热卖商品只有到达升级到2级金额的才能拿佣金
if (pv < uplevel2_amount)
{
result = 0;
}
//if (pv < uplevel2_amount)
//{
// result = 0;
//}
int dID = Convert.ToInt32(ContactRow["ID"].ToString());
//Yumoney17就是余额而且写成负数
Double Yumoney17 = Convert.ToDouble(Convert.ToDouble(ContactRow["umoney17"]).ToString("f4"));
@@ -1091,13 +1295,13 @@ namespace Mtxfw.DAL
var buyerlevelname = Mtxfw.Utility.Common.GetuLevelname(buyerlevel);
var Contactlevelname = Mtxfw.Utility.Common.GetuLevelname(ContactLevel); ;
var BZContent = "业务佣金";//备注
Double fixed_bonus = 0;//config.level3_fixed_bonus
//获取业务佣金比例
Double fixed_bonus = config.level0_direct_superior_bonus_ratio;
if (fixed_bonus > 0)
{
if (pv > 0)
if (jsje > 0)
{
Double jaingjin = Convert.ToDouble((fixed_bonus * pv).ToString("f4"));
Double jaingjin = Convert.ToDouble((fixed_bonus * jsje).ToString("f4"));
if (jaingjin > 0.0000)
{
var mjl2 = new Model.user_Results_jl2();

View File

@@ -341,6 +341,33 @@ namespace Mtxfw.DAL
parameters[2].Value = OID;
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
}
/// <summary>
/// 核销订单
/// </summary>
public int UpdateHxState(DateTime SelValue2, string OID,string hxm)
{
string SelValue = "2";
StringBuilder strSql = new StringBuilder();
strSql.Append("update order_info set ");
strSql.Append("O_Payed=@SelValue,O_Payed_Date=@SelValue2");
strSql.Append(" where id=@OID and orderhxm =@hxm");
SqlParameter[] parameters = {
new SqlParameter("@SelValue", SqlDbType.VarChar,50),
new SqlParameter("@SelValue2", SqlDbType.DateTime),
new SqlParameter("@OID", SqlDbType.VarChar,50),
new SqlParameter("@hxm", SqlDbType.VarChar, 50)};
parameters[0].Value = SelValue;
parameters[1].Value = SelValue2;
parameters[2].Value = OID;
parameters[3].Value = hxm;
return Mtxfw.Utility.SqlDbHelper_U.ExecuteCmd(strSql.ToString(), parameters);
}
/// <summary>
/// 更新运单号
/// </summary>