|
|
@ -21,6 +21,7 @@ namespace BBWY.Server.Business |
|
|
|
{ |
|
|
|
public class JDBusiness : PlatformSDKBusiness |
|
|
|
{ |
|
|
|
private DingDingBusiness dingDingBusiness; |
|
|
|
public override Enums.Platform Platform => Enums.Platform.京东; |
|
|
|
|
|
|
|
private readonly string searchFields = "orderId,venderId,orderType,payType,orderTotalPrice,orderSellerPrice,orderPayment,freightPrice,orderState,orderStateRemark,orderRemark,orderStartTime,orderEndTime,modified,consigneeInfo,itemInfoList,couponDetailList,taxFee,venderRemark,pin,waybill,storeOrder,storeId,sellerDiscount"; |
|
|
@ -36,7 +37,10 @@ namespace BBWY.Server.Business |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
public JDBusiness(IMemoryCache memoryCache, NLogManager nLogManager) : base(memoryCache, nLogManager) { } |
|
|
|
public JDBusiness(IMemoryCache memoryCache, NLogManager nLogManager, DingDingBusiness dingDingBusiness) : base(memoryCache, nLogManager) |
|
|
|
{ |
|
|
|
this.dingDingBusiness = dingDingBusiness; |
|
|
|
} |
|
|
|
|
|
|
|
private IJdClient GetJdClient(string appKey, string appSecret) |
|
|
|
{ |
|
|
@ -1294,7 +1298,7 @@ namespace BBWY.Server.Business |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public override void StartJDPromotionDelayTask(StartPromotionTaskDelayRequest request |
|
|
|
public override void StartJDPromotionDelayTask(StartPromotionTaskDelayRequest request) |
|
|
|
{ |
|
|
|
Thread.Sleep(60 * 1000); |
|
|
|
try |
|
|
@ -1307,23 +1311,53 @@ namespace BBWY.Server.Business |
|
|
|
throw; |
|
|
|
} |
|
|
|
|
|
|
|
Thread.Sleep(30 * 1000); |
|
|
|
Thread.Sleep(10000); |
|
|
|
|
|
|
|
#region 检查奶妈sku是否完全生效
|
|
|
|
var lastQueryJoinCount = 0; |
|
|
|
var isJoinCompleted = false; |
|
|
|
{ |
|
|
|
var i = 0; |
|
|
|
while (i < 2) |
|
|
|
var repeatCount = 0; |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
i++; |
|
|
|
var promotionTaskSkuList = GetPromotionTaskSku(request.AppKey, request.AppSecret, request.AppToken, request.JDPromotionId); |
|
|
|
if (promotionTaskSkuList.Any(s => s.Value<int>("bind_type") == 1 && s.Value<int>("sku_status") == 0)) |
|
|
|
var currentQueryJoinCount = promotionTaskSkuList.Count(s => s.Value<int>("bind_type") == 1 && s.Value<int>("sku_status") == 1); |
|
|
|
if (currentQueryJoinCount == request.JoinSkuCount) |
|
|
|
{ |
|
|
|
Thread.Sleep(30000); |
|
|
|
continue; |
|
|
|
isJoinCompleted = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
if (lastQueryJoinCount == 0) |
|
|
|
lastQueryJoinCount = currentQueryJoinCount; |
|
|
|
else if (lastQueryJoinCount == currentQueryJoinCount) |
|
|
|
{ |
|
|
|
repeatCount++; |
|
|
|
if (repeatCount > 2) |
|
|
|
break; |
|
|
|
} |
|
|
|
lastQueryJoinCount = currentQueryJoinCount; |
|
|
|
Thread.Sleep(30000); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 发送钉钉消息
|
|
|
|
try |
|
|
|
{ |
|
|
|
var ddMsg = new StringBuilder(); |
|
|
|
ddMsg.AppendLine($"活动名称:{request.ActivityName}"); |
|
|
|
ddMsg.AppendLine("任务状态:开始"); |
|
|
|
if (!isJoinCompleted) |
|
|
|
{ |
|
|
|
ddMsg.AppendLine($"任务奶妈数:{request.JoinSkuCount}"); |
|
|
|
ddMsg.AppendLine($"参与奶妈数:{lastQueryJoinCount}"); |
|
|
|
ddMsg.AppendLine("参与任务的奶妈数异常请检查"); |
|
|
|
} |
|
|
|
if (!string.IsNullOrEmpty(request.PJZSDingDingKey) && !string.IsNullOrEmpty(request.PJZSDingDingWebHook)) |
|
|
|
dingDingBusiness.SendDingDingBotMessage(request.PJZSDingDingKey, request.PJZSDingDingWebHook, ddMsg.ToString()); |
|
|
|
} |
|
|
|
catch { } |
|
|
|
#endregion
|
|
|
|
|
|
|
|
RollBackWhenStartPromotionError(request.AppKey, request.AppSecret, request.AppToken, request.DeleteGiftSkuList, request.MainProductSpu, request.FullTitle, request.BrandName, true); |
|
|
|