|
@@ -565,7 +565,7 @@ namespace molilian.core
|
|
|
client.Timeout = GetRequestTimeout(result.elapsedTime2);
|
|
client.Timeout = GetRequestTimeout(result.elapsedTime2);
|
|
|
//var response = client.Request(url);
|
|
//var response = client.Request(url);
|
|
|
var response = await client.RequestAsync(url);
|
|
var response = await client.RequestAsync(url);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
stopwatch.Stop();
|
|
stopwatch.Stop();
|
|
|
result.elapsedTime3 = (int)stopwatch.ElapsedMilliseconds;
|
|
result.elapsedTime3 = (int)stopwatch.ElapsedMilliseconds;
|
|
|
|
|
|
|
@@ -593,10 +593,23 @@ namespace molilian.core
|
|
|
|
|
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- body = response.Body();
|
|
|
|
|
- JsonElement root = body.Convert2JsonElement();
|
|
|
|
|
|
|
+ if (response.ResponseMessage.StatusCode == System.Net.HttpStatusCode.Found)
|
|
|
|
|
+ {
|
|
|
|
|
+ _ = new LoggerLibrary("api_error", "fail")
|
|
|
|
|
+ .Info($"302:{response.ResponseMessage.Headers.Location}")
|
|
|
|
|
+ .SaveAsync();
|
|
|
|
|
+ throw new Exception("302 Found, was canceled");
|
|
|
|
|
+ }
|
|
|
|
|
+ JsonElement root;
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ body = response.Body();
|
|
|
|
|
+ root = body.Convert2JsonElement();
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception ex)
|
|
|
|
|
+ {
|
|
|
|
|
+ throw new Exception(body);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
bool success = root.Read<bool>("success", false);
|
|
bool success = root.Read<bool>("success", false);
|
|
|
string message = root.Read("message", string.Empty);
|
|
string message = root.Read("message", string.Empty);
|
|
@@ -609,6 +622,8 @@ namespace molilian.core
|
|
|
string couponLinkTaoToken = root.PathRead("data.couponLinkTaoToken", string.Empty);
|
|
string couponLinkTaoToken = root.PathRead("data.couponLinkTaoToken", string.Empty);
|
|
|
string couponShortLinkUrl = root.PathRead("data.couponShortLinkUrl", string.Empty);
|
|
string couponShortLinkUrl = root.PathRead("data.couponShortLinkUrl", string.Empty);
|
|
|
decimal couponAmount = root.PathRead<decimal>("data.couponAmount", 0);
|
|
decimal couponAmount = root.PathRead<decimal>("data.couponAmount", 0);
|
|
|
|
|
+ string couponEffectiveEndTime = root.PathRead("data.couponEffectiveEndTime", string.Empty);
|
|
|
|
|
+ string couponEffectiveStartTime = root.PathRead("data.couponEffectiveStartTime", string.Empty);
|
|
|
|
|
|
|
|
string itemId = root.PathRead("data.itemId", string.Empty);
|
|
string itemId = root.PathRead("data.itemId", string.Empty);
|
|
|
string itemName = root.PathRead("data.itemName", string.Empty);
|
|
string itemName = root.PathRead("data.itemName", string.Empty);
|
|
@@ -656,6 +671,7 @@ namespace molilian.core
|
|
|
shortLinkurl = GetLink(content);
|
|
shortLinkurl = GetLink(content);
|
|
|
switch (message)
|
|
switch (message)
|
|
|
{
|
|
{
|
|
|
|
|
+ case "该商品已经下架或未加入淘宝客":
|
|
|
case "该链接不支持转化,请更换链接尝试":
|
|
case "该链接不支持转化,请更换链接尝试":
|
|
|
case "网络错误":
|
|
case "网络错误":
|
|
|
break;
|
|
break;
|
|
@@ -686,6 +702,8 @@ namespace molilian.core
|
|
|
result.message = message;
|
|
result.message = message;
|
|
|
result.content = content;
|
|
result.content = content;
|
|
|
result.couponAmount = couponAmount;
|
|
result.couponAmount = couponAmount;
|
|
|
|
|
+ result.couponEffectiveEndTime = couponEffectiveEndTime;
|
|
|
|
|
+ result.couponEffectiveStartTime = couponEffectiveStartTime;
|
|
|
result.taoToken = taoToken;
|
|
result.taoToken = taoToken;
|
|
|
result.shortLinkurl = shortLinkurl;
|
|
result.shortLinkurl = shortLinkurl;
|
|
|
result.deeplink_url = deeplink_url;
|
|
result.deeplink_url = deeplink_url;
|
|
@@ -847,6 +865,7 @@ namespace molilian.core
|
|
|
shortLinkurl = GetLink(content);
|
|
shortLinkurl = GetLink(content);
|
|
|
switch (message)
|
|
switch (message)
|
|
|
{
|
|
{
|
|
|
|
|
+ case "该商品已经下架或未加入淘宝客":
|
|
|
case "该链接不支持转化,请更换链接尝试":
|
|
case "该链接不支持转化,请更换链接尝试":
|
|
|
case "网络错误":
|
|
case "网络错误":
|
|
|
break;
|
|
break;
|