|
|
@ -1,6 +1,8 @@ |
|
|
|
using BBWY.Client.Models; |
|
|
|
using BBWY.Common.Http; |
|
|
|
using BBWY.Common.Models; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Net.Http; |
|
|
|
|
|
|
@ -24,9 +26,83 @@ namespace BBWY.Client.APIServices |
|
|
|
}, HttpMethod.Get); |
|
|
|
} |
|
|
|
|
|
|
|
public ApiResponse<IList<ShopResponse>> GetShopsByUserTeam(long userId) |
|
|
|
|
|
|
|
|
|
|
|
//public ApiResponse<IList<ShopResponse>> GetShopsByUserTeam(long userId)
|
|
|
|
//{
|
|
|
|
// return SendRequest<IList<ShopResponse>>(globalContext.MDSApiHost, "TaskList/Shop/GetShopsByUserTeam", $"userId={userId}", null, System.Net.Http.HttpMethod.Get);
|
|
|
|
//}
|
|
|
|
|
|
|
|
public ApiResponse<IList<Department>> GetShopDetailList() |
|
|
|
{ |
|
|
|
var response = new ApiResponse<IList<Department>>(); |
|
|
|
var response2 = SendRequest<JArray>(globalContext.MDSApiHost, "TaskList/UserDepartment/GetShopDetailList", null, null, HttpMethod.Get); |
|
|
|
if (!response.Success) |
|
|
|
{ |
|
|
|
response.Code = response2.Code; |
|
|
|
response.Msg = response2.Msg; |
|
|
|
return response; |
|
|
|
} |
|
|
|
|
|
|
|
response.Data = new List<Department>(); |
|
|
|
foreach (var jDepartment in response2.Data) |
|
|
|
{ |
|
|
|
var jayShops = jDepartment.Value<JArray>("ShopList"); |
|
|
|
if (jayShops == null || !jayShops.HasValues) |
|
|
|
continue; //排除空店部门
|
|
|
|
var d = new Department() |
|
|
|
{ |
|
|
|
Id = jDepartment.Value<string>("Id"), |
|
|
|
Name = jDepartment.Value<string>("DepartmentName") |
|
|
|
}; |
|
|
|
response.Data.Add(d); |
|
|
|
foreach (var jShop in jayShops) |
|
|
|
{ |
|
|
|
if (jShop.Value<long?>("ShopId") == null || string.IsNullOrEmpty(jShop.Value<string>("AppToken"))) |
|
|
|
continue; //排除未授权
|
|
|
|
try |
|
|
|
{ |
|
|
|
return SendRequest<IList<ShopResponse>>(globalContext.MDSApiHost, "TaskList/Shop/GetShopsByUserTeam", $"userId={userId}", null, System.Net.Http.HttpMethod.Get); |
|
|
|
var shop = new Shop() |
|
|
|
{ |
|
|
|
ShopId = jShop.Value<long>("ShopId"), |
|
|
|
AppKey = jShop.Value<string>("AppKey"), |
|
|
|
AppSecret = jShop.Value<string>("AppSecret"), |
|
|
|
AppToken = jShop.Value<string>("AppToken"), |
|
|
|
ManagePwd = jShop.Value<string>("ManagePwd"), |
|
|
|
Platform = (Platform)jShop.Value<int>("PlatformId"), |
|
|
|
PlatformCommissionRatio = jShop.Value<decimal?>("PlatformCommissionRatio") ?? 0.05M, |
|
|
|
ShopName = jShop.Value<string>("ShopName"), |
|
|
|
VenderType = jShop.Value<string>("ShopType"), |
|
|
|
TeamId = jShop.Value<string>("TeamId") |
|
|
|
}; |
|
|
|
d.ShopList.Add(shop); |
|
|
|
var jayAccounts = jShop.Value<JArray>("AccountList"); |
|
|
|
if (jayAccounts == null || !jayAccounts.HasValues) |
|
|
|
continue; |
|
|
|
shop.PurchaseAccountList = new List<PurchaseAccount>(); |
|
|
|
foreach (var jPurchaseAccount in jayAccounts) |
|
|
|
{ |
|
|
|
shop.PurchaseAccountList.Add(new PurchaseAccount() |
|
|
|
{ |
|
|
|
Id = jPurchaseAccount.Value<long>("Id"), |
|
|
|
AccountName = jPurchaseAccount.Value<string>("AccountName"), |
|
|
|
AppKey = jPurchaseAccount.Value<string>("AppKey"), |
|
|
|
AppSecret = jPurchaseAccount.Value<string>("AppSecret"), |
|
|
|
AppToken = jPurchaseAccount.Value<string>("AppToken"), |
|
|
|
ShopId = shop.ShopId |
|
|
|
//PurchasePlatformId = jPurchaseAccount.Value<long>()
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
Console.WriteLine(jShop.ToString()); |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return response; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|