26 changed files with 693 additions and 69 deletions
@ -0,0 +1,50 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Coldairarrow.Entity.DTO |
|||
{ |
|||
public class ItemLabelDto |
|||
{ |
|||
public string ItemId { get; set; } |
|||
|
|||
public string Title { get; set; } |
|||
|
|||
public decimal Price { get; set; } |
|||
|
|||
public string Sales { get; set; } |
|||
|
|||
public string Img { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 标签状态
|
|||
/// </summary>
|
|||
public int Status { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台
|
|||
/// </summary>
|
|||
public ItemPlatform Platform { get; set; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 平台类型
|
|||
/// </summary>
|
|||
public enum ItemPlatform |
|||
{ |
|||
/// <summary>
|
|||
/// 淘宝
|
|||
/// </summary>
|
|||
Taobao = 0, |
|||
/// <summary>
|
|||
/// 京东
|
|||
/// </summary>
|
|||
Jd = 1, |
|||
/// <summary>
|
|||
/// 拼多多
|
|||
/// </summary>
|
|||
Pdd = 2 |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
using Coldairarrow.Entity.HuiYan; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Coldairarrow.Entity.DTO |
|||
{ |
|||
public class ItemlabelInfoDto:itemlabels |
|||
{ |
|||
/// <summary>
|
|||
/// 平台
|
|||
/// </summary>
|
|||
public int Platform { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否集团过滤
|
|||
/// </summary>
|
|||
public bool HasFilter { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 宝贝ID
|
|||
/// </summary>
|
|||
public string GoodsId { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,121 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Net.Http; |
|||
using System.Text; |
|||
using System.Threading; |
|||
using System.Windows; |
|||
using 齐越慧眼.Models; |
|||
|
|||
namespace 齐越慧眼 |
|||
{ |
|||
public class ApiHelper |
|||
{ |
|||
public static string ApiBase { get; set; } = "http://localhost:5000"; |
|||
|
|||
public static string JwtToken { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 设置商品标签
|
|||
/// </summary>
|
|||
/// <param name="model"></param>
|
|||
/// <returns></returns>
|
|||
public static (bool isOk,string msg) SetItemLabel(ItemLabelDto model) |
|||
{ |
|||
var result= Http("/HuiYan/itemlabels/SetItemLabel", Newtonsoft.Json.JsonConvert.SerializeObject(model)); |
|||
|
|||
var data = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(result); |
|||
|
|||
bool isSuccess = data.Success; |
|||
|
|||
return (isSuccess, data.Msg ?? ""); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 获取标签信息
|
|||
/// </summary>
|
|||
/// <param name="ids"></param>
|
|||
/// <param name="platform"></param>
|
|||
/// <returns></returns>
|
|||
public static (bool isOk,List<ItemlabelInfoDto> datas) GetLabelByItemIds(List<string>ids,ItemPlatform platform) |
|||
{ |
|||
try |
|||
{ |
|||
var result = Http($"/HuiYan/itemlabels/GetLabelByItemIds?platform={platform}", Newtonsoft.Json.JsonConvert.SerializeObject(ids)); |
|||
|
|||
var data = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(result); |
|||
|
|||
string json = data.Data.ToString(); |
|||
|
|||
var datas = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ItemlabelInfoDto>>(json); |
|||
|
|||
bool isSuccess = data.Success; |
|||
|
|||
return (isSuccess, datas ?? new List<ItemlabelInfoDto>()); |
|||
} |
|||
catch |
|||
{ |
|||
return (false, new List<ItemlabelInfoDto>()); |
|||
} |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// http接口调用
|
|||
/// </summary>
|
|||
/// <param name="api"></param>
|
|||
/// <param name="postData"></param>
|
|||
/// <returns></returns>
|
|||
private static string Http(string api, string postData = null, bool isAgain = false) |
|||
{ |
|||
try |
|||
{ |
|||
HttpClient http = new HttpClient(); |
|||
http.Timeout = new TimeSpan(0, 0, 35); |
|||
http.DefaultRequestHeaders.Add("Authorization", "Bearer " + JwtToken); |
|||
if (postData!=null) |
|||
{ |
|||
StringContent content = new StringContent(postData); |
|||
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); |
|||
var result = http.PostAsync(ApiBase + api, content).Result.Content.ReadAsStringAsync().Result; |
|||
return result; |
|||
} |
|||
|
|||
var request = new HttpRequestMessage() { Method = HttpMethod.Get, RequestUri = new Uri(ApiBase + api) }; |
|||
|
|||
var res = http.SendAsync(request).Result; |
|||
|
|||
if (res.StatusCode == System.Net.HttpStatusCode.Unauthorized) |
|||
{ |
|||
return string.Empty; |
|||
} |
|||
else |
|||
{ |
|||
//服务器挂掉
|
|||
if (res.StatusCode != System.Net.HttpStatusCode.OK) |
|||
{ |
|||
if (isAgain) |
|||
return null; |
|||
|
|||
Thread.Sleep(60000); |
|||
return Http(api, postData, true); |
|||
} |
|||
return res.Content.ReadAsStringAsync().Result; |
|||
} |
|||
|
|||
} |
|||
catch (HttpRequestException ex) |
|||
{ |
|||
if (isAgain) |
|||
return null; |
|||
Thread.Sleep(60000); |
|||
return Http(api, postData, true); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace 齐越慧眼.Models |
|||
{ |
|||
public class ItemLabelDto |
|||
{ |
|||
public string ItemId { get; set; } |
|||
|
|||
public string Title { get; set; } |
|||
|
|||
public decimal Price { get; set; } |
|||
|
|||
public string Sales { get; set; } |
|||
|
|||
public string Img { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 标签状态
|
|||
/// </summary>
|
|||
public int Status { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 平台
|
|||
/// </summary>
|
|||
public ItemPlatform Platform { get; set; } |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 平台类型
|
|||
/// </summary>
|
|||
public enum ItemPlatform |
|||
{ |
|||
/// <summary>
|
|||
/// 淘宝
|
|||
/// </summary>
|
|||
Taobao = 0, |
|||
/// <summary>
|
|||
/// 京东
|
|||
/// </summary>
|
|||
Jd = 1, |
|||
/// <summary>
|
|||
/// 拼多多
|
|||
/// </summary>
|
|||
Pdd = 2 |
|||
} |
|||
} |
@ -0,0 +1,81 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace 齐越慧眼.Models |
|||
{ |
|||
public class ItemlabelInfoDto : itemlabels |
|||
{ |
|||
/// <summary>
|
|||
/// 平台
|
|||
/// </summary>
|
|||
public int Platform { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否集团过滤
|
|||
/// </summary>
|
|||
public bool HasFilter { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 宝贝ID
|
|||
/// </summary>
|
|||
public string GoodsId { get; set; } |
|||
} |
|||
|
|||
public class itemlabels |
|||
{ |
|||
|
|||
public String Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 创建时间
|
|||
/// </summary>
|
|||
public DateTime CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 创建人Id
|
|||
/// </summary>
|
|||
public String CreatorId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 否已删除
|
|||
/// </summary>
|
|||
public Boolean Deleted { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 宝贝ID
|
|||
/// </summary>
|
|||
public String ItemsId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否筛选
|
|||
/// </summary>
|
|||
public Boolean IsScreening { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否过滤
|
|||
/// </summary>
|
|||
public Boolean IsFilter { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否竞品
|
|||
/// </summary>
|
|||
public Boolean IsCompeting { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否加入产品库
|
|||
/// </summary>
|
|||
public Boolean IsAdded { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 添加人
|
|||
/// </summary>
|
|||
public String UserId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 团队ID
|
|||
/// </summary>
|
|||
public String TeamId { get; set; } |
|||
|
|||
} |
|||
} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@ |
|||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>client</title><link href="/js/about.js" rel="prefetch"><link href="/css/app.66edb6c9.css" rel="preload" as="style"><link href="/css/app.css" rel="preload" as="style"><link href="/css/chunk-vendors.09af4a6b.css" rel="preload" as="style"><link href="/css/chunk-vendors.css" rel="preload" as="style"><link href="/js/app.js" rel="preload" as="script"><link href="/js/chunk-vendors.js" rel="preload" as="script"><link href="/css/chunk-vendors.09af4a6b.css" rel="stylesheet"><link href="/css/chunk-vendors.css" rel="stylesheet"><link href="/css/app.66edb6c9.css" rel="stylesheet"><link href="/css/app.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.js"></script><script src="/js/app.js"></script></body></html> |
|||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>client</title><link href="/css/app.aed7bccd.css" rel="preload" as="style"><link href="/css/app.css" rel="preload" as="style"><link href="/css/chunk-vendors.09af4a6b.css" rel="preload" as="style"><link href="/css/chunk-vendors.css" rel="preload" as="style"><link href="/js/app.js" rel="preload" as="script"><link href="/js/chunk-vendors.js" rel="preload" as="script"><link href="/css/chunk-vendors.09af4a6b.css" rel="stylesheet"><link href="/css/chunk-vendors.css" rel="stylesheet"><link href="/css/app.aed7bccd.css" rel="stylesheet"><link href="/css/app.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but client doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.js"></script><script src="/js/app.js"></script></body></html> |
After Width: | Height: | Size: 30 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue