parse_2.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. using dodohold.core;
  2. using System.Text.RegularExpressions;
  3. using System.Diagnostics;
  4. using System.Text.Json;
  5. using TencentCloud.Fmu.V20191213.Models;
  6. using System;
  7. namespace molilian.core
  8. {
  9. public partial class AlimamaPlus
  10. {
  11. public void UnionParse2(string content, ref TkDataDTO result)
  12. {
  13. if ("veapi".Equals(_api) && _api_id > 0)
  14. {
  15. var account = VeapiPoolCore.Get(_api_id);
  16. if (account != null)
  17. {
  18. var core = new VeapiPlus(account.name, account.key, account.sessionKey);
  19. core.UnionParse(content, ref result);
  20. return;
  21. }
  22. }
  23. UnionParse(content, ref result);
  24. }
  25. public async Task<TkDataDTO> UnionParse2Async(string content, TkDataDTO result)
  26. {
  27. if ("veapi".Equals(_api) && _api_id > 0)
  28. {
  29. var account = VeapiPoolCore.Get(_api_id);
  30. if (account != null)
  31. {
  32. var core = new VeapiPlus(account.name, account.key, account.sessionKey);
  33. result = await core.UnionParseAsync(content, result);
  34. return result;
  35. }
  36. }
  37. result = await UnionParseAsync(content, result);
  38. return result;
  39. }
  40. /// <summary>
  41. /// 提取url里面的id参数
  42. /// </summary>
  43. /// <param name="url"></param>
  44. /// <returns></returns>
  45. static string? ExtractItemId(string url)
  46. {
  47. Match match = Regex.Match(url, @"(?:\?|&)id=(\d+)");
  48. if (match.Success)
  49. {
  50. return match.Groups[1].Value;
  51. }
  52. return null;
  53. }
  54. /// <summary>
  55. /// 是否淘宝链接
  56. /// </summary>
  57. /// <param name="url"></param>
  58. /// <returns></returns>
  59. private static (bool, string) IsTaobaoUrl(string url)
  60. {
  61. if (url.Contains("//a.m.taobao.com/i"))
  62. {
  63. //第一种提取方法
  64. string itemId = url.GetContentPart("//a.m.taobao.com/i", ".htm");
  65. if (!string.IsNullOrEmpty(itemId))
  66. {
  67. string resultUrl = $"https://item.taobao.com/item.htm?id={itemId}";
  68. return (true, resultUrl);
  69. }
  70. }
  71. if (url.Contains("//item.taobao.com/item.htm?") ||
  72. url.Contains("//h5.m.taobao.com/awp/core/detail.htm?") ||
  73. url.Contains("//new.m.taobao.com/detail.htm?") ||
  74. url.Contains("//outfliggys.m.taobao.com/app/trip/rx-travel-detail") ||
  75. url.Contains("//detail.m.tmall.com/item.htm?") ||
  76. url.Contains("//tmallx.tmall.com/app/tmallx-src/goods-detail") ||
  77. url.Contains("//detail.tmall.com/item.htm?") ||
  78. url.Contains("//detail.tmall.hk/hk/item.htm?"))
  79. {
  80. string? itemId = ExtractItemId(url);
  81. if (!string.IsNullOrEmpty(itemId))
  82. {
  83. string resultUrl = $"https://item.taobao.com/item.htm?id={itemId}";
  84. return (true, resultUrl);
  85. }
  86. }
  87. return (false, url);
  88. }
  89. /// <summary>
  90. /// 排除已知的淘客链接
  91. /// </summary>
  92. /// <param name="url"></param>
  93. /// <returns></returns>
  94. static bool IsAffLink(string url)
  95. {
  96. if (!url.StartsWith("https://") || !url.StartsWith("https://")) url = "https://" + url;
  97. Uri uri = new(url);
  98. if (uri.Host.Equals("s.click.taobao.com", StringComparison.OrdinalIgnoreCase) ||
  99. uri.Host.Equals("uland.taobao.com", StringComparison.OrdinalIgnoreCase))
  100. {
  101. return true;
  102. }
  103. //if (uri.Host.Equals("m.tb.cn", StringComparison.OrdinalIgnoreCase) &&
  104. // uri.AbsolutePath.StartsWith("/h.") &&
  105. // string.IsNullOrEmpty(uri.Query) && // No query parameters
  106. // !url.Contains("?tk=")) // No "tk" parameter
  107. //{
  108. // return true;
  109. //}
  110. return false;
  111. }
  112. /// <summary>
  113. /// 判断淘客的¥羊角符号
  114. /// </summary>
  115. /// <param name="content"></param>
  116. /// <returns></returns>
  117. static bool ContainsSpecialFormat(string content)
  118. {
  119. // 使用正则表达式匹配内容中是否含有特定格式的字符串
  120. //string pattern = @"¥[a-zA-Z0-9\s]+¥";
  121. string pattern = @"[$¥🗝₴€₤£₳✔《💰🔑🎵✔️💲🔐📲]+[a-zA-Z0-9\s]+[$¥🗝₴€₤£₳✔《💰🔑🎵✔️💲🔐📲]*";
  122. return Regex.IsMatch(content, pattern);
  123. }
  124. /// <summary>
  125. /// 从http获取跳转的url
  126. /// </summary>
  127. /// <param name="url"></param>
  128. /// <returns></returns>
  129. (bool, string) GetDesiredUrl(string url)
  130. {
  131. string result;
  132. try
  133. {
  134. Uri uri = new(url);
  135. if (!uri.Host.Equals("m.tb.cn", StringComparison.OrdinalIgnoreCase)) return (false, "不是淘宝短网址");
  136. string desiredUrlPattern = "var url = '(.*?)'";
  137. WebClientUtility client = new()
  138. {
  139. Proxy = _proxy,
  140. UserAgent = Sayaka.Common.ProviderFakeUserAgent.RandomComputer
  141. };
  142. #if DEBUG
  143. client.Proxy = null;
  144. #else
  145. client.Timeout = TimeSpan.FromMilliseconds(3000);
  146. #endif
  147. var response = client.Request(url);
  148. var responseBody = response.Body();
  149. result = responseBody;
  150. if (response.Successed)
  151. {
  152. if (response.ResponseMessage.IsSuccessStatusCode)
  153. {
  154. Match match = Regex.Match(responseBody, desiredUrlPattern);
  155. if (match.Success)
  156. {
  157. result = match.Groups[1].Value; // 返回匹配的 URL
  158. if (string.IsNullOrEmpty(result)) return (false, "没有匹配的URL");
  159. return (true, result);
  160. }
  161. }
  162. else
  163. {
  164. result = $"{response.ResponseMessage.StatusCode}\n{responseBody}";
  165. }
  166. }
  167. else
  168. {
  169. throw response.ResponseException;
  170. }
  171. }
  172. catch (Exception ex)
  173. {
  174. result = $"{ex.Message}\n{ex.StackTrace}";
  175. }
  176. return (false, result);
  177. }
  178. private (bool, string, LinkTypeEnum, string) InternalTextProcessing(string content)
  179. {
  180. bool success;
  181. string result;
  182. LinkTypeEnum link_type = LinkTypeEnum.unknown;
  183. string url = GetLink(content);
  184. if (!string.IsNullOrEmpty(url))
  185. {
  186. //排除已知的淘客链接
  187. if (IsAffLink(url)) return (false, "排除淘客链接", LinkTypeEnum.other_aff, url);
  188. //直接提取
  189. (success, result) = IsTaobaoUrl(url);
  190. if (success) return (true, result, LinkTypeEnum.goods, result);
  191. //https://uland.taobao.com/coupon/edetail?af=4&e=%2B0aTAvEt16MoRnbUfHBdCarU9683KT3AsB67n92UtFJMmdsrkidbOWBzzpT26idJbwZX%2BHY%2B8QD9zJXNeOSc1euXSPKeLUBBWr02LqsxPV8Bf6pSMNy5GSw6iqMObXLLk3toOSlQXmUUcLJJYP0Uq5lvDADUDTeHRiuxU0i9W%2BtrC8Oh6piEfdwyUIuKQbeM8rUgQejRG616MoRnbUfHBdCarU9683KT3AsB67n92UtFv6uIFQszbmWWPZ8ka7%2BkV5xXydLt%2FcnuZ4%2BBFYnwwiUaCWC3TckcCwMW8xe3XqOGsb8uv9wbhxdkKJ0hxTrTkj7DNgliTXDluAYBRglsbQ%3D%3D&traceId=212cbaa417178512249145009e05a8&union_lens=lensId%3APUB%401717851219%402103c04a_0c89_18ff7e96612_9d39%40031w5YJSc7jl3U7gYjdvuCMM%40eyJmbG9vcklkIjo4NTAvEt16MoRnbUfHBdCarU9683JDaxNfPy83okP3kLScwCkGiuMcyC4PcynGV0YWlsX2h0bSIsInNyY0Zsb29ySWQiiOiiI4MDY3NCIsImNyZWF0aXZpdHlHcm91cElkIjowfQieie%3BtkScm%3AselectionPlaza_site_4358%3Bscm%3A1007.30148.329090.pub_search-item_c02df4bb-631f-4cc1-a9d5-abe802b8e134_&un=bfc196d23e155d289f2917200ca32a93&share_crt_v=1&un_site=0&ut_sk=1.utdid_null_1717851225204.TaoPassword-Outside.lianmeng-app&spm=a2159r.13376465.0.0&sp_tk=d2hLeFdDNHpKb3Y%3D&cpp=1&shareurl=true&short_name=h.gVx6mvI
  192. //从http获取跳转的url
  193. (success, result) = GetDesiredUrl(url);
  194. if (success)
  195. {
  196. //排除已知的淘客链接
  197. if (IsAffLink(result)) return (false, "排除淘客链接", LinkTypeEnum.other_aff, url);
  198. (success, result) = IsTaobaoUrl(result);
  199. if (success) return (true, result, LinkTypeEnum.goods, result);
  200. link_type = GetLinkType(result);
  201. }
  202. else
  203. {
  204. link_type = GetLinkType(url);
  205. }
  206. return (false, result, link_type, url);
  207. }
  208. //判断淘客的¥羊角符号
  209. if (ContainsSpecialFormat(content)) return (false, "排除淘口令", LinkTypeEnum.other_aff, null);
  210. return (false, "纯口令 没链接", link_type, null);
  211. }
  212. private LinkTypeEnum GetLinkType(string url)
  213. {
  214. if (string.IsNullOrEmpty(url)) return LinkTypeEnum.unknown;
  215. if (url.StartsWith("https://huodong.m.taobao.com/act/talent/live.html")) return LinkTypeEnum.live;
  216. if (url.StartsWith("https://web.m.taobao.com/app/tnode/web/index")) return LinkTypeEnum.video;
  217. string pattern = @"^https://shop\d+\.m\.taobao\.com";
  218. if (Regex.IsMatch(url, pattern))
  219. {
  220. return LinkTypeEnum.profile;
  221. }
  222. return LinkTypeEnum.unknown;
  223. }
  224. private void alimamaParse(string content, ref TkDataDTO result)
  225. {
  226. string t = $"{DateTime.Now.Convert2UnixTimestamp(true)}";
  227. Random random = new();
  228. double randomNumber = random.NextDouble();
  229. string randomString = randomNumber.ToString()[2..];
  230. string cna = _cookies.GetContentPart("cna=", ";");
  231. string firstFiveCharacters = cna[..Math.Min(5, cna.Length)];
  232. var variableMap = new
  233. {
  234. url = content,
  235. union_lens = $"b_pvid:a219t._portal_v2_tool_links_page_home_index_htm_{t}_{randomString}_{firstFiveCharacters}",
  236. lensScene = "PUB",
  237. spmB = "_portal_v2_tool_links_page_home_index_htm"
  238. }.Convert2Json(true).UrlEncode();
  239. variableMap = variableMap.Replace(" ", "%20");
  240. string url = "https://pub.alimama.com/openapi/param2/1/gateway.unionpub/xt.entry.json?" +
  241. $"t={t}&_tb_token_={_tb_token}&floorId={_floorId}&refpid={_refpid}&variableMap={variableMap}";
  242. var client = new WebClientUtility().SetContentType("application/json;charset=utf-8")
  243. .AddHeaders("X-Requested-With", "XMLHttpRequest")
  244. .AddHeaders("Cookie", _cookies);
  245. client.Proxy = _proxy;
  246. #if DEBUG
  247. client.Proxy = null;
  248. #endif
  249. if (!string.IsNullOrEmpty(_user_agent)) client.UserAgent = _user_agent;
  250. client.Timeout = TimeSpan.FromMilliseconds(1000);
  251. var response = client.Request(url);
  252. var body = string.Empty;
  253. try
  254. {
  255. if (!response.Successed)
  256. {
  257. result.channel = TkChannelEnum.tb;
  258. result.accountId = _accountId;
  259. result.accountName = _accountName;
  260. result.link_type = LinkTypeEnum.unknown;
  261. result.success = false;
  262. result.message = "fail";
  263. if (response.ResponseException != null)
  264. {
  265. new LoggerLibrary("api_error", "fail")
  266. .Info(response.ResponseException.Message, response.ResponseException.StackTrace)
  267. .Save();
  268. throw response.ResponseException;
  269. }
  270. return;
  271. }
  272. body = response.Body();
  273. JsonElement root = body.Convert2JsonElement();
  274. bool success = root.Read<bool>("success", false);
  275. string message = root.Read("message", string.Empty);
  276. string info_message = root.PathRead("info.message", string.Empty);
  277. if (!string.IsNullOrEmpty(info_message)) message = info_message;
  278. string taoToken = root.PathRead("data.taoToken", string.Empty);
  279. string shortLinkurl = root.PathRead("data.shortLinkurl", string.Empty);
  280. string couponLinkTaoToken = root.PathRead("data.couponLinkTaoToken", string.Empty);
  281. string couponShortLinkUrl = root.PathRead("data.couponShortLinkUrl", string.Empty);
  282. decimal couponAmount = root.PathRead<decimal>("data.couponAmount", 0);
  283. string itemId = root.PathRead("data.itemId", string.Empty);
  284. string itemName = root.PathRead("data.itemName", string.Empty);
  285. decimal promotionPrice = root.PathRead<decimal>("data.promotionPrice", 0);
  286. string sellerNickName = root.PathRead("data.sellerNickName", string.Empty);
  287. string shopTitle = root.PathRead("data.shopTitle", string.Empty);
  288. string pic = root.PathRead("data.pic", string.Empty);
  289. string qrCodeUrl = root.PathRead("data.qrCodeUrl", string.Empty);
  290. if (response.ResponseMessage != null)
  291. {
  292. switch (response.ResponseMessage.StatusCode)
  293. {
  294. case System.Net.HttpStatusCode.OK:
  295. {
  296. if (couponAmount > 0 && !string.IsNullOrEmpty(couponLinkTaoToken) && !string.IsNullOrEmpty(couponShortLinkUrl))
  297. {
  298. taoToken = couponLinkTaoToken;
  299. shortLinkurl = couponShortLinkUrl;
  300. }
  301. string shortLink = GetLink(taoToken);
  302. content = ReplaceUrls(content, shortLink);
  303. }
  304. break;
  305. case System.Net.HttpStatusCode.Found:
  306. string location = response.ResponseMessage.Headers.Location.OriginalString;
  307. if (!string.IsNullOrEmpty(location) && location.Contains("www.alimama.com/member/login.htm"))
  308. {
  309. success = false;
  310. message = "nologin";
  311. }
  312. break;
  313. default:
  314. {
  315. success = false;
  316. message = "other";
  317. }
  318. break;
  319. }
  320. }
  321. if (!success)
  322. {
  323. shortLinkurl = GetLink(content);
  324. switch (message)
  325. {
  326. case "该链接不支持转化,请更换链接尝试":
  327. case "网络错误":
  328. break;
  329. default:
  330. var _headers = response.ResponseMessage.Headers;
  331. var headers = "";
  332. foreach (var h in _headers)
  333. {
  334. foreach (var Value in h.Value)
  335. {
  336. headers += $"{h.Key}: {Value}\n";
  337. }
  338. }
  339. new LoggerLibrary("api_error", "fail")
  340. .Info(message, content)
  341. .Info(headers, body)
  342. .Save();
  343. break;
  344. }
  345. }
  346. string deeplink_url = GetDeeplink(shortLinkurl);
  347. result.channel = TkChannelEnum.tb;
  348. result.accountId = _accountId;
  349. result.accountName = _accountName;
  350. result.link_type = success ? LinkTypeEnum.goods : result.link_type;
  351. result.success = success;
  352. result.message = message;
  353. result.content = content;
  354. result.couponAmount = couponAmount;
  355. result.taoToken = taoToken;
  356. result.shortLinkurl = shortLinkurl;
  357. result.deeplink_url = deeplink_url;
  358. result.itemId = itemId;
  359. result.itemName = itemName;
  360. result.promotionPrice = promotionPrice;
  361. result.sellerNickName = sellerNickName;
  362. result.shopTitle = shopTitle;
  363. result.pic = pic;
  364. result.qrCodeUrl = qrCodeUrl;
  365. }
  366. catch
  367. {
  368. if (response.ResponseMessage?.StatusCode == System.Net.HttpStatusCode.OK)
  369. {
  370. if (body.Contains("<p>抱歉!页面无法访问……</p>"))
  371. {
  372. throw new APIException("抱歉!页面无法访问……");
  373. }
  374. }
  375. throw;
  376. }
  377. }
  378. private async Task<TkDataDTO> alimamaParseAsync(string content, TkDataDTO result)
  379. {
  380. string t = $"{DateTime.Now.Convert2UnixTimestamp(true)}";
  381. Random random = new();
  382. double randomNumber = random.NextDouble();
  383. string randomString = randomNumber.ToString()[2..];
  384. string cna = _cookies.GetContentPart("cna=", ";");
  385. string firstFiveCharacters = cna[..Math.Min(5, cna.Length)];
  386. var variableMap = new
  387. {
  388. url = content,
  389. union_lens = $"b_pvid:a219t._portal_v2_tool_links_page_home_index_htm_{t}_{randomString}_{firstFiveCharacters}",
  390. lensScene = "PUB",
  391. spmB = "_portal_v2_tool_links_page_home_index_htm"
  392. }.Convert2Json(true).UrlEncode();
  393. variableMap = variableMap.Replace(" ", "%20");
  394. string url = "https://pub.alimama.com/openapi/param2/1/gateway.unionpub/xt.entry.json?" +
  395. $"t={t}&_tb_token_={_tb_token}&floorId={_floorId}&refpid={_refpid}&variableMap={variableMap}";
  396. var client = new WebClientUtility().SetContentType("application/json;charset=utf-8")
  397. .AddHeaders("X-Requested-With", "XMLHttpRequest")
  398. .AddHeaders("Cookie", _cookies);
  399. client.Proxy = _proxy;
  400. if (!string.IsNullOrEmpty(_user_agent)) client.UserAgent = _user_agent;
  401. client.Timeout = TimeSpan.FromMilliseconds(1000);
  402. #if DEBUG
  403. client.Proxy = null;
  404. client.Timeout = TimeSpan.FromMilliseconds(10000);
  405. #endif
  406. var response = client.Request(url);
  407. var body = string.Empty;
  408. try
  409. {
  410. if (!response.Successed)
  411. {
  412. result.channel = TkChannelEnum.tb;
  413. result.accountId = _accountId;
  414. result.accountName = _accountName;
  415. result.link_type = LinkTypeEnum.unknown;
  416. result.success = false;
  417. result.message = "fail";
  418. if (response.ResponseException != null)
  419. {
  420. new LoggerLibrary("api_error", "fail")
  421. .Info(response.ResponseException.Message, response.ResponseException.StackTrace)
  422. .Save();
  423. throw response.ResponseException;
  424. }
  425. return result;
  426. }
  427. body = response.Body();
  428. //{"code":601,"info":{"ok":false,"message":"nologin"}}
  429. JsonElement root = body.Convert2JsonElement();
  430. bool success = root.Read<bool>("success", false);
  431. string message = root.Read("message", string.Empty);
  432. string info_message = root.PathRead("info.message", string.Empty);
  433. if (!string.IsNullOrEmpty(info_message)) message = info_message;
  434. string taoToken = root.PathRead("data.taoToken", string.Empty);
  435. string shortLinkurl = root.PathRead("data.shortLinkurl", string.Empty);
  436. string couponLinkTaoToken = root.PathRead("data.couponLinkTaoToken", string.Empty);
  437. string couponShortLinkUrl = root.PathRead("data.couponShortLinkUrl", string.Empty);
  438. decimal couponAmount = root.PathRead<decimal>("data.couponAmount", 0);
  439. string couponEffectiveEndTime = root.PathRead("data.couponEffectiveEndTime", string.Empty);
  440. string couponEffectiveStartTime = root.PathRead("data.couponEffectiveStartTime", string.Empty);
  441. string itemId = root.PathRead("data.itemId", string.Empty);
  442. string itemName = root.PathRead("data.itemName", string.Empty);
  443. decimal promotionPrice = root.PathRead<decimal>("data.promotionPrice", 0);
  444. string sellerNickName = root.PathRead("data.sellerNickName", string.Empty);
  445. string shopTitle = root.PathRead("data.shopTitle", string.Empty);
  446. string pic = root.PathRead("data.pic", string.Empty);
  447. string qrCodeUrl = root.PathRead("data.qrCodeUrl", string.Empty);
  448. if (response.ResponseMessage != null)
  449. {
  450. switch (response.ResponseMessage.StatusCode)
  451. {
  452. case System.Net.HttpStatusCode.OK:
  453. {
  454. if (couponAmount > 0 && !string.IsNullOrEmpty(couponLinkTaoToken) && !string.IsNullOrEmpty(couponShortLinkUrl))
  455. {
  456. taoToken = couponLinkTaoToken;
  457. shortLinkurl = couponShortLinkUrl;
  458. }
  459. string shortLink = GetLink(taoToken);
  460. content = ReplaceUrls(content, shortLink);
  461. }
  462. break;
  463. case System.Net.HttpStatusCode.Found:
  464. string location = response.ResponseMessage.Headers.Location.OriginalString;
  465. if (!string.IsNullOrEmpty(location) && location.Contains("www.alimama.com/member/login.htm"))
  466. {
  467. success = false;
  468. message = "nologin";
  469. }
  470. break;
  471. default:
  472. {
  473. success = false;
  474. message = "other";
  475. }
  476. break;
  477. }
  478. }
  479. if (!success)
  480. {
  481. shortLinkurl = GetLink(content);
  482. switch (message)
  483. {
  484. case "该链接不支持转化,请更换链接尝试":
  485. case "网络错误":
  486. break;
  487. default:
  488. var _headers = response.ResponseMessage.Headers;
  489. var headers = "";
  490. foreach (var h in _headers)
  491. {
  492. foreach (var Value in h.Value)
  493. {
  494. headers += $"{h.Key}: {Value}\n";
  495. }
  496. }
  497. new LoggerLibrary("api_error", "fail")
  498. .Info(message, content)
  499. .Info(headers, body)
  500. .Save();
  501. break;
  502. }
  503. }
  504. if (success)
  505. {
  506. if (string.IsNullOrEmpty(itemName))
  507. {
  508. itemName = GetTitle(taoToken);
  509. }
  510. }
  511. else
  512. {
  513. itemName = GetTitle(content);
  514. }
  515. string deeplink_url = GetDeeplink(shortLinkurl);
  516. result.channel = TkChannelEnum.tb;
  517. result.accountId = _accountId;
  518. result.accountName = _accountName;
  519. if (success)
  520. {
  521. switch (result.link_type)
  522. {
  523. case LinkTypeEnum.profile:
  524. case LinkTypeEnum.goods:
  525. break;
  526. default:
  527. result.link_type = LinkTypeEnum.goods;
  528. break;
  529. }
  530. }
  531. result.success = success;
  532. result.message = message;
  533. result.content = content;
  534. result.couponAmount = couponAmount;
  535. result.couponEffectiveEndTime = couponEffectiveEndTime;
  536. result.couponEffectiveStartTime = couponEffectiveStartTime;
  537. result.taoToken = taoToken;
  538. result.shortLinkurl = shortLinkurl;
  539. result.deeplink_url = deeplink_url;
  540. result.itemId = itemId;
  541. result.itemName = itemName;
  542. result.promotionPrice = promotionPrice;
  543. result.sellerNickName = sellerNickName;
  544. result.shopTitle = shopTitle;
  545. result.pic = pic;
  546. result.qrCodeUrl = qrCodeUrl;
  547. }
  548. catch
  549. {
  550. if (response.ResponseMessage?.StatusCode == System.Net.HttpStatusCode.OK)
  551. {
  552. if (body.Contains("<p>抱歉!页面无法访问……</p>"))
  553. {
  554. throw new APIException("抱歉!页面无法访问……");
  555. }
  556. }
  557. throw;
  558. }
  559. return result;
  560. }
  561. }
  562. }