|
|
@ -958,5 +958,49 @@ namespace BBWYB.Server.Business |
|
|
|
} |
|
|
|
Console.WriteLine(schemeGroups.Count()); |
|
|
|
} |
|
|
|
|
|
|
|
public void SyncProductCategory() |
|
|
|
{ |
|
|
|
List<PurchaserExtendedInfo> insertList = new List<PurchaserExtendedInfo>(); |
|
|
|
List<long> deletePurchaserExtendedIdList = new List<long>(); |
|
|
|
|
|
|
|
var dbCategoryList = fsql.Select<PurchaserExtendedInfo>() |
|
|
|
.Where(x => x.Type == Enums.PurchaserBasicInfoType.主营类目) |
|
|
|
.ToList(); |
|
|
|
|
|
|
|
var client = opPlatformClientFactory.GetClient(AdapterEnums.PlatformType.拳探); |
|
|
|
var request = new OP_QueryProductCategoryRequest() |
|
|
|
{ |
|
|
|
PageIndex = 1, |
|
|
|
PageSize = 50, |
|
|
|
AppKey = "BBWYB2023022501", |
|
|
|
AppSecret = "3a1521deccc6819d61788a0d6baae49e9", |
|
|
|
AppToken = "9" |
|
|
|
}; |
|
|
|
|
|
|
|
var qtCategoryList = new List<OP_ProductCategoryResponse>(); |
|
|
|
var response = client.GetProductCategoryList(request); |
|
|
|
if (response.Items != null) |
|
|
|
qtCategoryList.AddRange(response.Items); |
|
|
|
|
|
|
|
|
|
|
|
//找出新增的类目
|
|
|
|
var newCategoryList = qtCategoryList.Where(c => !dbCategoryList.Any(dc => dc.Id == long.Parse(c.CategoryId))).ToList(); |
|
|
|
if (newCategoryList.Count() > 0) |
|
|
|
{ |
|
|
|
insertList.AddRange(newCategoryList.Select(c => new PurchaserExtendedInfo() |
|
|
|
{ |
|
|
|
Id = long.Parse(c.CategoryId), |
|
|
|
Name = c.CategoryName, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
Type = Enums.PurchaserBasicInfoType.主营类目 |
|
|
|
}).ToList()); |
|
|
|
} |
|
|
|
|
|
|
|
fsql.Insert(insertList).ExecuteAffrows(); |
|
|
|
|
|
|
|
//找出接口丢失的类目
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|