Commit 2ef40262 authored by liudong1993's avatar liudong1993

1

parent 629d3322
This diff is collapsed.
......@@ -43,7 +43,7 @@ namespace Test.Helper
if (subItem.id > 0)
{
//根据订单号 或者订单id
int OrderId = 0;
int OrderId = subItem.id;
int OrderDetailId = 0;
if (subItem.detail.Any()) {
OrderDetailId = subItem.detail?.FirstOrDefault()?.order_detail_id ?? 0;
......@@ -103,7 +103,7 @@ namespace Test.Helper
pageCount = 2;
List<OrderCommissionInfo> list = new List<OrderCommissionInfo>();
string newImaApi = "http://wx.weibaoge.cn/web/index.php?r=mall%2Fshare%2Forder&keyword=&keyword_1=order_no&date_start=&date_end=&platform=&status=all&plugin=all&send_type=-1&parent_id=0&page=" + pageIndex;
cookie = "search={'keyword':'','status':' - 1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null,'type':''}; _identity=c964edefdd891bb281844324071fea4e2c1e7d2b21aef031ed81730f4e753d06a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A48%3A%22%5B19740%2C%22Cktp5k6Wf3lVS_yjQI_uTgEEE6_ANe-5%22%2C86400%5D%22%3B%7D; HJ_SESSION_ID=tv09q5jnte4v44ca14bnvdi28s; _csrf=9a1b84c62ffd209719019cca9730bf48f33854d3acc2f31982a5ef51ceda400ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22QwYL8fmmakdUX981YM7R26-Y5YoMnXxU%22%3B%7D";
cookie = "__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={,keyword,:,,,,status,:, - 1,,,sort_prop,:,,,,sort_type,:,,,,cats,:[,9120,],,date_start,:null,,date_end,:null,,type,:,,}; HJ_SESSION_ID=ro0irvkki656gjq980lin75t1g; _csrf=12193ce0b398f8b8cc3992fa19d2412736d943b2fdf8b62de3e343c44a922674a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22f4VCgioDAiyDlVaVwqJLgd6OLayvOxmC%22%3B%7D";
string jsonData = HttpGet(newImaApi, cookie);
if (jsonData != null && !string.IsNullOrEmpty(jsonData))
......@@ -181,5 +181,66 @@ namespace Test.Helper
}
}
#region 处理徐总说的二级返佣
/// <summary>
/// 返佣
/// </summary>
public static void SetOrderTwoCommissionData() {
string citySql = $@"
SELECT o.OrderId,o.OrderNo,od.Id AS DetailId,o.UserId,u.`Name`,o.Income,o.Consignee,o.Mobile,o.ShoppingAddress,od.GoodsName,od.Specification,od.Final_Price,
od.Number,
CASE WHEN d1.Id IS NULL THEN d2.OneCommission * od.Number ELSE d1.OneCommission * od.Number END AS OneCommission,
CASE WHEN d1.Id IS NULL THEN d2.TwoCommission * od.Number ELSE d1.TwoCommission * od.Number END AS TwoCommission
FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
INNER JOIN rb_member_user u on o.UserId = u.Id
LEFT JOIN rb_goods_distributioncommission d1 on d1.GoodsId=od.GoodsId AND d1.DistributorGrade=74 and d1.SpecificationSort=od.SpecificationSort
LEFT JOIN rb_goods_distributioncommission d2 on d2.GoodsId=od.GoodsId AND d2.DistributorGrade=74 and d2.SpecificationSort=''
WHERE o.OrderId in(
SELECT t.OrderId FROM(
SELECT cm.OrderId,cm.UserId FROM rb_goods_ordercommission cm WHERE CommissionState = 2 AND TenantId =1 AND MallBaseId =1
GROUP BY cm.OrderId,cm.UserId
)t GROUP BY t.OrderId HAVING COUNT(0)=1)
AND o.OrderId >=34137 and o.OrderId <=80622 and o.OrderId <> 63803 AND o.OrderId <> 63839
AND o.UserId in(
SELECT Id FROM rb_member_user WHERE SuperiorId BETWEEN 1 and 20
) AND o.UserId <> 39370
ORDER BY o.OrderId ASC ";
DataSet OrderCommList = MySqlHelper.ExecuteDataset(MySqlHelper.defaultConnection, System.Data.CommandType.Text, citySql, null);
string Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
foreach (DataRow item in OrderCommList.Tables[0].Rows) {
int OrderId = Convert.ToInt32(item["OrderId"].ToString());
int DetailId = Convert.ToInt32(item["DetailId"].ToString());
int UserId = Convert.ToInt32(item["UserId"].ToString());
decimal TwoCommission = Convert.ToDecimal(item["TwoCommission"].ToString());
if (TwoCommission > 0)
{
//插入返佣
string InertComm = $@"
insert into rb_goods_ordercommission (OrderId,OrderDetailId,UserId,Grade,Commission,IsGoodsDistribution,CommissionState,Remark,TenantId,MallBaseId,CreateDate,UpdateDate,Type,IsRemit)
values ({OrderId},{DetailId},{UserId},2,{TwoCommission},2,2,'补充二级返佣',1,1,'{Time}','{Time}',1,2)
";
var InertCommResult = MySqlHelper.ExecuteNonQuery(MySqlHelper.defaultConnection, System.Data.CommandType.Text, InertComm, null);
if (InertCommResult > 0)
{
string UserComm = $@"update rb_distributor_info set TotalCommission=TotalCommission+{TwoCommission},CommissionWithdrawal=CommissionWithdrawal+{TwoCommission}";
var UserCommResult = MySqlHelper.ExecuteNonQuery(MySqlHelper.defaultConnection, System.Data.CommandType.Text, UserComm, null);
if (UserCommResult <= 0) {
Console.WriteLine("更新用户返佣失败 OrderId:" + OrderId + ",DetailId:" + DetailId + ",UserId:" + UserId + " TwoCommission:" + TwoCommission);
}
}
else {
Console.WriteLine("返佣插入失败 OrderId:" + OrderId + ",DetailId:" + DetailId + ",UserId:" + UserId + " TwoCommission:" + TwoCommission);
}
}
else {
Console.WriteLine("OrderId:" + OrderId + ",DetailId:" + DetailId + ",UserId:" + UserId + " TwoCommission:" + TwoCommission);
}
}
}
#endregion
}
}
......@@ -218,7 +218,7 @@ DiscountRate,IsMemberPrice,TenantId,MallBaseId,CreateDate,UpdateDate,IsComment,F
pageCount = 2;
List<OrderInfo> list = new List<OrderInfo>();
string newImaApi = "http://wx.weibaoge.cn/web/index.php?r=mall%2Forder%2Findex&keyword=&keyword_1=1&date_start=&date_end=&platform=&status=-1&plugin=all&send_type=-1&type=&page=" + pageIndex;
cookie = "search={'keyword':'','status':' - 1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null,'type':''}; _identity=c964edefdd891bb281844324071fea4e2c1e7d2b21aef031ed81730f4e753d06a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A48%3A%22%5B19740%2C%22Cktp5k6Wf3lVS_yjQI_uTgEEE6_ANe-5%22%2C86400%5D%22%3B%7D; HJ_SESSION_ID=tv09q5jnte4v44ca14bnvdi28s; _csrf=9a1b84c62ffd209719019cca9730bf48f33854d3acc2f31982a5ef51ceda400ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22QwYL8fmmakdUX981YM7R26-Y5YoMnXxU%22%3B%7D";
cookie = "__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={,keyword,:,,,,status,:, - 1,,,sort_prop,:,,,,sort_type,:,,,,cats,:[,9120,],,date_start,:null,,date_end,:null,,type,:,,}; HJ_SESSION_ID=ro0irvkki656gjq980lin75t1g; _csrf=12193ce0b398f8b8cc3992fa19d2412736d943b2fdf8b62de3e343c44a922674a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22f4VCgioDAiyDlVaVwqJLgd6OLayvOxmC%22%3B%7D";
string jsonData = HttpGet(newImaApi, cookie);
if (jsonData != null && !string.IsNullOrEmpty(jsonData))
......@@ -245,7 +245,7 @@ DiscountRate,IsMemberPrice,TenantId,MallBaseId,CreateDate,UpdateDate,IsComment,F
pageCount = 1;
List<ExpressInfo> list = new List<ExpressInfo>();
string newImaApi = "http://wx.weibaoge.cn/web/index.php?r=mall%2Forder%2Findex&keyword=&keyword_1=1&date_start=&date_end=&platform=&status=-1&plugin=all&send_type=-1&type=&page=" + pageIndex;
cookie = "search={'keyword':'','status':' - 1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null,'type':''}; _identity=c964edefdd891bb281844324071fea4e2c1e7d2b21aef031ed81730f4e753d06a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A48%3A%22%5B19740%2C%22Cktp5k6Wf3lVS_yjQI_uTgEEE6_ANe-5%22%2C86400%5D%22%3B%7D; HJ_SESSION_ID=tv09q5jnte4v44ca14bnvdi28s; _csrf=9a1b84c62ffd209719019cca9730bf48f33854d3acc2f31982a5ef51ceda400ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22QwYL8fmmakdUX981YM7R26-Y5YoMnXxU%22%3B%7D";
cookie = "__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={,keyword,:,,,,status,:, - 1,,,sort_prop,:,,,,sort_type,:,,,,cats,:[,9120,],,date_start,:null,,date_end,:null,,type,:,,}; HJ_SESSION_ID=ro0irvkki656gjq980lin75t1g; _csrf=12193ce0b398f8b8cc3992fa19d2412736d943b2fdf8b62de3e343c44a922674a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22f4VCgioDAiyDlVaVwqJLgd6OLayvOxmC%22%3B%7D";
string jsonData = HttpGet(newImaApi, cookie);
if (jsonData != null && !string.IsNullOrEmpty(jsonData))
......
......@@ -35,7 +35,7 @@ namespace Test.Helper
{
foreach (var subItem in tempImgList)
{
if (subItem.user_id > 101707 && subItem.user_id <= 106252)
if (subItem.user_id > 109233 && subItem.user_id <= 111620)
{
StringBuilder stringBuilder = new StringBuilder();
//stringBuilder.AppendFormat("update rb_member_user set Photo = '{0}',Name='{1}',SuperiorId={2} where Id = {3}", subItem.avatar, subItem.nickname, subItem.parent_id, subItem.user_id);
......@@ -70,7 +70,7 @@ namespace Test.Helper
pageCount = 2;
List<UserImage> list = new List<UserImage>();
string newImaApi = "http://wx.weibaoge.cn/web/index.php?r=mall%2Fuser%2Findex&page=" + pageIndex + "&member_level=0&platform=0&keyword=";
cookie = "search={'keyword':'','status':' - 1','sort_prop':'','sort_type':'','cats':[],'date_start':null,'date_end':null,'type':''}; _identity=c964edefdd891bb281844324071fea4e2c1e7d2b21aef031ed81730f4e753d06a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A48%3A%22%5B19740%2C%22Cktp5k6Wf3lVS_yjQI_uTgEEE6_ANe-5%22%2C86400%5D%22%3B%7D; HJ_SESSION_ID=tv09q5jnte4v44ca14bnvdi28s; _csrf=9a1b84c62ffd209719019cca9730bf48f33854d3acc2f31982a5ef51ceda400ca%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22QwYL8fmmakdUX981YM7R26-Y5YoMnXxU%22%3B%7D";
cookie = "__login_route=%2Fadmin%2Fpassport%2Flogin; __login_role=admin; search={,keyword,:,,,,status,:, - 1,,,sort_prop,:,,,,sort_type,:,,,,cats,:[,9120,],,date_start,:null,,date_end,:null,,type,:,,}; HJ_SESSION_ID=ro0irvkki656gjq980lin75t1g; _csrf=12193ce0b398f8b8cc3992fa19d2412736d943b2fdf8b62de3e343c44a922674a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22f4VCgioDAiyDlVaVwqJLgd6OLayvOxmC%22%3B%7D";
string jsonData = HttpGet(newImaApi, cookie);
if (jsonData != null && !string.IsNullOrEmpty(jsonData))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment