TaskController.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. using molilian.core;
  2. using dodohold.core;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Org.BouncyCastle.Ocsp;
  5. using System.Text.Json;
  6. using System.Runtime.InteropServices;
  7. using System.Net;
  8. using System.Threading.Channels;
  9. using TencentCloud.Cdwch.V20200915.Models;
  10. using COSXML.Network;
  11. using System.Security.Cryptography;
  12. using System.Threading;
  13. namespace molilian.api.Controllers
  14. {
  15. [ApiController]
  16. [Route("[controller]_70160bd632/[action]")]
  17. public class TaskController : ControllerBase
  18. {
  19. protected IHttpContextAccessor _accessor;
  20. public TaskController(IHttpContextAccessor accessor)
  21. {
  22. _accessor = accessor;
  23. }
  24. [HttpGet]
  25. public ActionResult BatchInsertLogDB(int limit = 100)
  26. {
  27. int total = TkLogCore.BatchInsertLogDB(limit);
  28. return new APIResult(new { success = true, message = "ok", limit, total });
  29. }
  30. [HttpGet]
  31. public async Task<ActionResult> GetSettleBills(int sleep = 2000)
  32. {
  33. var list = TkPoolCore.List();
  34. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  35. string message = string.Empty;
  36. int total = 0;
  37. foreach (var account in list)
  38. {
  39. if (!account.enable_sync_order) continue;
  40. #if DEBUG
  41. if (13 != account.id) continue;
  42. #endif
  43. try
  44. {
  45. var alimama = new AlimamaPlus(account);
  46. total += alimama.GetSettleBills(sleep);
  47. }
  48. catch (Exception ex)
  49. {
  50. message = $"【收益接口异常】\t{account.name}\n{ex.Message}\n{ex.StackTrace}";
  51. NotifyCore.Notify(new NifyMessage
  52. {
  53. message = message,
  54. priority = NifyMessagePriority.high,
  55. tags = ["red_circle"]
  56. });
  57. continue;
  58. }
  59. }
  60. return new APIResult(new { success = true, message = "ok", total });
  61. }
  62. [HttpGet]
  63. public async Task<ActionResult> GetHistoryOrders(int id, int sleep, DateTime startTime, DateTime endTime)
  64. {
  65. var list = TkPoolCore.List();
  66. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  67. if (id == 0) return new APIResult(new { success = false, message = "没有有效账号", });
  68. string message = string.Empty;
  69. int total = 0;
  70. foreach (var account in list)
  71. {
  72. if (id != account.id) continue;
  73. try
  74. {
  75. //DateTime endTime = DateTime.Now;
  76. //DateTime startTime = endTime.AddDays(-90);
  77. if (account.id == 3) endTime = DateTime.Parse("2024-04-07");
  78. var alimama = new AlimamaPlus(account);
  79. total += alimama.GetHistoryOrders(sleep, startTime, endTime);
  80. }
  81. catch (Exception ex)
  82. {
  83. message = $"【历史订单接口异常】[{account.id}]{account.company}\n{ex.Message}\n{ex.StackTrace}";
  84. NotifyCore.Notify(new NifyMessage
  85. {
  86. message = message,
  87. priority = NifyMessagePriority.high,
  88. tags = ["red_circle"]
  89. });
  90. continue;
  91. }
  92. }
  93. return new APIResult(new { success = true, message = "ok", total });
  94. }
  95. [HttpGet]
  96. public async Task<ActionResult> GetIncyOrders(int sleep = 2000)
  97. {
  98. var list = TkPoolCore.List();
  99. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  100. string message = string.Empty;
  101. int total = 0;
  102. foreach (var account in list)
  103. {
  104. #if DEBUG
  105. if (account.id != 17) continue;
  106. #endif
  107. if (!account.enable_sync_order) continue;
  108. try
  109. {
  110. var alimama = new AlimamaPlus(account);
  111. total += alimama.GetIncyOrders(sleep);
  112. }
  113. catch (Exception ex)
  114. {
  115. message = $"【新增订单接口异常】[{account.id}]{account.company}\n{ex.Message}\n{ex.StackTrace}";
  116. NotifyCore.Notify(new NifyMessage
  117. {
  118. message = message,
  119. priority = NifyMessagePriority.high,
  120. tags = ["red_circle"]
  121. });
  122. continue;
  123. }
  124. }
  125. return new APIResult(new { success = true, message = "ok", total });
  126. }
  127. [HttpGet]
  128. public async Task<ActionResult> GetHistoryRefundOrders(int id, int sleep, DateTime startTime, DateTime endTime)
  129. {
  130. var list = TkPoolCore.List();
  131. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  132. if (id == 0) return new APIResult(new { success = false, message = "没有有效账号", });
  133. string message = string.Empty;
  134. int total = 0;
  135. foreach (var account in list)
  136. {
  137. if (id != account.id) continue;
  138. try
  139. {
  140. //DateTime endTime = DateTime.Now;
  141. //DateTime startTime = endTime.AddDays(-90);
  142. if (account.id == 3) endTime = DateTime.Parse("2024-04-07");
  143. var alimama = new AlimamaPlus(account);
  144. total += alimama.GetHistoryRefundOrders(sleep, startTime, endTime);
  145. }
  146. catch (Exception ex)
  147. {
  148. message = $"【维权订单接口异常】[{account.id}]{account.company}\n{ex.Message}\n{ex.StackTrace}";
  149. NotifyCore.Notify(new NifyMessage
  150. {
  151. message = message,
  152. priority = NifyMessagePriority.high,
  153. tags = ["red_circle"]
  154. });
  155. continue;
  156. }
  157. }
  158. return new APIResult(new { success = true, message = "ok", total });
  159. }
  160. [HttpGet]
  161. public async Task<ActionResult> GetIncyRefundOrders(int sleep = 2000)
  162. {
  163. var list = TkPoolCore.List();
  164. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  165. string message = string.Empty;
  166. int total = 0;
  167. foreach (var account in list)
  168. {
  169. #if DEBUG
  170. if (account.id != 17) continue;
  171. #endif
  172. if (!account.enable_sync_order) continue;
  173. try
  174. {
  175. var alimama = new AlimamaPlus(account);
  176. total += alimama.GetIncyRefundOrders(sleep);
  177. }
  178. catch (Exception ex)
  179. {
  180. message = $"【维权订单接口异常】[{account.id}]{account.company}\n{ex.Message}\n{ex.StackTrace}";
  181. NotifyCore.Notify(new NifyMessage
  182. {
  183. message = message,
  184. priority = NifyMessagePriority.high,
  185. tags = ["red_circle"]
  186. });
  187. continue;
  188. }
  189. }
  190. return new APIResult(new { success = true, message = "ok", total });
  191. }
  192. [HttpGet]
  193. public async Task<ActionResult> GetViolationuWarning()
  194. {
  195. var list = TkPoolCore.List();
  196. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  197. string message = string.Empty;
  198. foreach (var account in list)
  199. {
  200. try
  201. {
  202. var alimama = new AlimamaPlus(account);
  203. alimama.GetViolationuWarning();
  204. }
  205. catch (Exception ex)
  206. {
  207. message = $"【报表接口异常】FastReport\n{ex.Message}\n{ex.StackTrace}";
  208. NotifyCore.Notify(new NifyMessage
  209. {
  210. message = message,
  211. priority = NifyMessagePriority.high,
  212. tags = ["red_circle"]
  213. });
  214. continue;
  215. }
  216. }
  217. return new APIResult(new { success = true, message = "ok" });
  218. }
  219. [HttpGet]
  220. public async Task<ActionResult> DailyLogs(int intervalDay = 1)
  221. {
  222. try
  223. {
  224. //本节点统计
  225. AlimamaPlus.NodeDailyLogs(intervalDay, "parse_", "tb");
  226. AlimamaPlus.NodeDailyLogs(intervalDay, "coupon_", "tb");
  227. AlimamaPlus.NodeDailyLogs(intervalDay); //第三方老的统计
  228. if (CenterHub.IsCenter)
  229. {
  230. JdUnionPlus.DailyLogs(intervalDay);
  231. ToolParsePlus.DailyLogs(intervalDay);
  232. //中心服务器统计
  233. AlimamaPlus.AllDailyLogs(intervalDay, "parse_", "tb");
  234. AlimamaPlus.AllDailyLogs(intervalDay, "coupon_", "tb");
  235. AlimamaPlus.AllDailyLogs(intervalDay);
  236. }
  237. }
  238. catch (Exception ex)
  239. {
  240. string message = $"【报表接口异常】DailyLogs\n{ex.Message}\n{ex.StackTrace}";
  241. NotifyCore.Notify(new NifyMessage
  242. {
  243. message = message,
  244. priority = NifyMessagePriority.high,
  245. tags = ["red_circle"]
  246. });
  247. }
  248. if (intervalDay > 0)
  249. {
  250. try
  251. {
  252. AlimamaPlus.ApiCallStatistics(1, intervalDay, TkChannelEnum.tb);
  253. AlimamaPlus.ApiCallStatistics(2, intervalDay, TkChannelEnum.tb);
  254. }
  255. catch (Exception ex)
  256. {
  257. string message = $"【API报表更新异常】ApiCallStatistics\n{ex.Message}\n{ex.StackTrace}";
  258. NotifyCore.Notify(new NifyMessage
  259. {
  260. message = message,
  261. priority = NifyMessagePriority.high,
  262. tags = ["red_circle"]
  263. });
  264. }
  265. }
  266. return new APIResult(new { success = true, message = "ok" });
  267. }
  268. [HttpGet]
  269. public async Task<ActionResult> DailyTable(int days = 7)
  270. {
  271. try
  272. {
  273. for (int i = 0; i < days; i++)
  274. {
  275. string table_suffix = DateTime.Now.AddDays(i).ToString("yyyyMMdd");
  276. string sql = $"CREATE TABLE IF NOT EXISTS tk_parse_logs_{table_suffix} LIKE tk_parse_logs;";
  277. DBContext.Execute(sql, null);
  278. sql = $"CREATE TABLE IF NOT EXISTS jd_parse_logs_{table_suffix} LIKE jd_parse_logs;";
  279. DBContext.Execute(sql, null);
  280. }
  281. TkLogCore.save_dailys_log = true;
  282. RedisHelper.Set("turn:save_dailys_log", 1, 86400);
  283. }
  284. catch (Exception ex)
  285. {
  286. string message = $"【创建数据标错误】\n{ex.Message}\n{ex.StackTrace}";
  287. NotifyCore.Notify(new NifyMessage
  288. {
  289. message = message,
  290. priority = NifyMessagePriority.high,
  291. tags = ["red_circle"]
  292. });
  293. }
  294. return new APIResult(new { success = true, message = "ok" });
  295. }
  296. [HttpGet]
  297. public async Task<ActionResult> ApiCallStatistics(int intervalDay = 1)
  298. {
  299. try
  300. {
  301. AlimamaPlus.ApiCallStatistics(1, intervalDay, TkChannelEnum.tb);
  302. AlimamaPlus.ApiCallStatistics(2, intervalDay, TkChannelEnum.tb);
  303. }
  304. catch (Exception ex)
  305. {
  306. string message = $"【API报表更新异常】ApiCallStatistics\n{ex.Message}\n{ex.StackTrace}";
  307. NotifyCore.Notify(new NifyMessage
  308. {
  309. message = message,
  310. priority = NifyMessagePriority.high,
  311. tags = ["red_circle"]
  312. });
  313. }
  314. return new APIResult(new { success = true, message = "ok" });
  315. }
  316. //[HttpGet]
  317. //public async Task<ActionResult> ApiCallStatistics(int intervalDay = 1)
  318. //{
  319. // try
  320. // {
  321. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.tb);
  322. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.tb, "parse_");
  323. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.tb, "coupon_");
  324. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.wemeet, "parse_");
  325. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.bdpan, "parse_");
  326. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.dy, "parse_");
  327. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.jd, "parse_");
  328. // }
  329. // catch (Exception ex)
  330. // {
  331. // string message = $"【报表接口异常】ApiCallStatistics\n{ex.Message}\n{ex.StackTrace}";
  332. // NotifyCore.Notify(new NifyMessage
  333. // {
  334. // message = message,
  335. // priority = NifyMessagePriority.high,
  336. // tags = ["red_circle"]
  337. // });
  338. // }
  339. // return new APIResult(new { success = true, message = "ok" });
  340. //}
  341. [HttpGet]
  342. public async Task<ActionResult> GetDrawBalance()
  343. {
  344. var list = TkPoolCore.List();
  345. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  346. string message = string.Empty;
  347. foreach (var account in list)
  348. {
  349. if (!account.enable_sync_order) continue;
  350. try
  351. {
  352. var alimama = new AlimamaPlus(account);
  353. alimama.GetDrawBalance();
  354. }
  355. catch (Exception ex)
  356. {
  357. message = $"【报表接口异常】GetDrawBalance\n{ex.Message}\n{ex.StackTrace}";
  358. NotifyCore.Notify(new NifyMessage
  359. {
  360. message = message,
  361. priority = NifyMessagePriority.high,
  362. tags = ["red_circle"]
  363. });
  364. continue;
  365. }
  366. }
  367. return new APIResult(new { success = true, message = "ok" });
  368. }
  369. [HttpGet]
  370. public async Task<ActionResult> FastReport()
  371. {
  372. string message = string.Empty;
  373. var list = TkPoolCore.List();
  374. if (list != null)
  375. {
  376. foreach (var account in list)
  377. {
  378. if (!account.enable_sync_order) continue;
  379. try
  380. {
  381. var alimama = new AlimamaPlus(account);
  382. alimama.SaveReportOverview();
  383. }
  384. catch (Exception ex)
  385. {
  386. message = $"【报表接口异常】FastReport\n{ex.Message}\n{ex.StackTrace}";
  387. NotifyCore.Notify(new NifyMessage
  388. {
  389. message = message,
  390. priority = NifyMessagePriority.high,
  391. tags = ["red_circle"]
  392. });
  393. continue;
  394. }
  395. }
  396. }
  397. string filter = "";
  398. #if DEBUG
  399. filter = "id IN (7,8)";
  400. #endif
  401. var jd_list = new DBContext.Table("jd_pool").Where(filter, null).Select<JdPoolDTO>();
  402. if (jd_list != null)
  403. {
  404. bool any_jd_changed = false;
  405. foreach (var account in jd_list)
  406. {
  407. bool changed = false;
  408. try
  409. {
  410. account.current_daily_calls = JdPoolCore.SaveCalls(account.id, DateTime.Now.ToString("yyyyMMdd"));
  411. account.current_hourly_calls = JdPoolCore.SaveCalls(account.id, DateTime.Now.ToString("yyyyMMddHH"));
  412. changed = true;
  413. any_jd_changed = true;
  414. }
  415. catch (Exception ex)
  416. {
  417. message = $"【JD计数异常】SaveCalls\n{ex.Message}\n{ex.StackTrace}";
  418. NotifyCore.Notify(new NifyMessage
  419. {
  420. message = message,
  421. priority = NifyMessagePriority.high,
  422. tags = ["red_circle"]
  423. });
  424. continue;
  425. }
  426. if (!account.status) continue;
  427. if (!string.IsNullOrEmpty(account.cookies))
  428. {
  429. try
  430. {
  431. var plus = new JdUnionPlus(account);
  432. var data = await plus.queryTodaySpreadEffectData();
  433. account.today_clickNum = data.clickNum;
  434. account.today_cosFee = data.cosFee;
  435. account.today_cosPrice = data.cosPrice;
  436. account.today_finishCosFee = data.finishCosFee;
  437. account.today_finishCosPrice = data.finishCosPrice;
  438. account.today_finishOrderNum = data.finishOrderNum;
  439. account.today_orderNum = data.orderNum;
  440. changed = true;
  441. any_jd_changed = true;
  442. }
  443. catch (Exception ex)
  444. {
  445. if (ex.Message.Contains("no login"))
  446. {
  447. account.status = false;
  448. JdPoolCore.Disabled(account.id, account.name, ex.Message);
  449. }
  450. message = $"【JD报表接口异常】{account.id}:{account.name}\tqueryTodaySpreadEffectData\n{account.Convert2Json()}\n{ex.Message}\n{ex.StackTrace}";
  451. NotifyCore.Notify(new NifyMessage
  452. {
  453. message = message,
  454. priority = NifyMessagePriority.high,
  455. tags = ["red_circle"]
  456. });
  457. continue;
  458. }
  459. }
  460. if (changed) JdPoolCore.Update(account);
  461. }
  462. if (any_jd_changed) JdPoolCore.Refresh();
  463. }
  464. await EndPointCore.NotifyReload(true);
  465. return new APIResult(new { success = true, message = "ok" });
  466. }
  467. [HttpGet]
  468. public async Task<ActionResult> SaveReport()
  469. {
  470. string message = string.Empty;
  471. var list = TkPoolCore.List();
  472. if (list != null)
  473. {
  474. foreach (var account in list)
  475. {
  476. if (!account.enable_sync_order) continue;
  477. #if DEBUG
  478. if (account.id != 5) continue;
  479. #endif
  480. try
  481. {
  482. var alimama = new AlimamaPlus(account);
  483. alimama.SaveReportHourtrend(DateTime.Now.AddDays(-1));
  484. alimama.SaveReportHourtrend(DateTime.Now);
  485. if (DateTime.Now.Hour >= 12 && DateTime.Now.Hour < 16)
  486. {
  487. DateTime date = DateTime.Now.AddDays(-1);
  488. alimama.FixReport(date);
  489. }
  490. }
  491. catch (Exception ex)
  492. {
  493. message = $"【报表接口异常】SaveReport\n{ex.Message}\n{ex.StackTrace}";
  494. NotifyCore.Notify(new NifyMessage
  495. {
  496. message = message,
  497. priority = NifyMessagePriority.high,
  498. tags = ["red_circle"]
  499. });
  500. continue;
  501. }
  502. }
  503. }
  504. return new APIResult(new { success = true, message = "ok" });
  505. }
  506. [HttpGet]
  507. public async Task<ActionResult> JdSaveReport()
  508. {
  509. string message = string.Empty;
  510. var jd_list = new DBContext.Table("jd_pool").Where("", null).Select<JdPoolDTO>();
  511. if (jd_list != null)
  512. {
  513. foreach (var account in jd_list)
  514. {
  515. if (!account.status) continue;
  516. #if DEBUG
  517. if (account.id != 10) continue;
  518. #endif
  519. if (!string.IsNullOrEmpty(account.cookies))
  520. {
  521. try
  522. {
  523. var plus = new JdUnionPlus(account);
  524. _ = await plus.querySpreadEffectData(DateTime.Now.AddDays(-1));
  525. _ = await plus.queryEstimateCommList();
  526. }
  527. catch (Exception ex)
  528. {
  529. if (ex.Message.Contains("no login"))
  530. {
  531. JdPoolCore.Disabled(account.id, account.name, ex.Message);
  532. }
  533. message = $"【JD报表接口异常】{account.id}:{account.name}\tquerySpreadEffectData\n{ex.Message}\n{ex.StackTrace}";
  534. NotifyCore.Notify(new NifyMessage
  535. {
  536. message = message,
  537. priority = NifyMessagePriority.high,
  538. tags = ["red_circle"]
  539. });
  540. continue;
  541. }
  542. }
  543. }
  544. }
  545. return new APIResult(new { success = true, message = "ok" });
  546. }
  547. [HttpGet]
  548. public async Task<ActionResult> FixReport(int id, string dt)
  549. {
  550. if (!DateTime.TryParse(dt, out DateTime date))
  551. {
  552. return new APIResult(new { success = false, message = "日期错误", });
  553. }
  554. var list = TkPoolCore.List();
  555. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  556. string message = string.Empty;
  557. foreach (var account in list)
  558. {
  559. if (id != account.id) continue;
  560. try
  561. {
  562. var alimama = new AlimamaPlus(account);
  563. while (date.Date < DateTime.Now.Date)
  564. {
  565. alimama.FixReport(date);
  566. date = date.AddDays(1);
  567. }
  568. }
  569. catch (Exception ex)
  570. {
  571. message = $"【报表接口异常】SaveReport\n{ex.Message}\n{ex.StackTrace}";
  572. NotifyCore.Notify(new NifyMessage
  573. {
  574. message = message,
  575. priority = NifyMessagePriority.high,
  576. tags = ["red_circle"]
  577. });
  578. continue;
  579. }
  580. }
  581. return new APIResult(new { success = true, message = "ok" });
  582. }
  583. [HttpGet]
  584. public ActionResult RenewCookie(string name)
  585. {
  586. var account = new DBContext.Table("tk_pool").Get<TkPoolDTO>("name=@name", new { name });
  587. if (account == null) return new APIResult(new { success = false, message = "没有有效账号", });
  588. var alimama = new AlimamaPlus(account);
  589. (bool success, string message) = alimama.RenewCookie();
  590. return new APIResult(new { success, message });
  591. }
  592. [HttpGet]
  593. public ActionResult Reload()
  594. {
  595. TkConfigCore.Refresh();
  596. EndPointCore.Refresh();
  597. ProxyNodesCore.Refresh();
  598. TkPoolCore.Refresh();
  599. VeapiPoolCore.Refresh();
  600. ApiAccountCore.Refresh();
  601. DataokeCore.Refresh();
  602. JdPoolCore.Refresh();
  603. PddPoolCore.Refresh();
  604. PangolinPoolCore.Refresh();
  605. return new APIResult(new
  606. {
  607. success = true,
  608. message = "ok",
  609. });
  610. }
  611. [HttpGet]
  612. public ActionResult ReloadAccount()
  613. {
  614. EndPointCore.Refresh();
  615. ProxyNodesCore.Refresh();
  616. TkPoolCore.Refresh();
  617. VeapiPoolCore.Refresh();
  618. JdPoolCore.Refresh();
  619. return new APIResult(new
  620. {
  621. success = true,
  622. message = "ok",
  623. });
  624. }
  625. [HttpGet]
  626. public async Task<ActionResult> CheckDeepUrl(int accountid)
  627. {
  628. var postContent = "88✔7Fi43dJwWpV£ https://m.tb.cn/h.g92hfR4JLgn7yvG MF7997 我分享给你了一个超赞的内容,快来看看吧";
  629. var channel = "tb";
  630. var ip = "127.0.0.1";
  631. var oaid = "test-oaid";
  632. bool success = false;
  633. string message;
  634. //============================== 放弃转链-没有匹配账号 ==============================
  635. TkPoolDTO? account = TkPoolCore.GetOne(accountid);
  636. if (account == null)
  637. {
  638. return new APIResult(new
  639. {
  640. success = false,
  641. message = "没有匹配账号",
  642. });
  643. }
  644. var alimama = new AlimamaPlus(account);
  645. TkDataDTO result = new TkDataDTO();
  646. string url = AlimamaPlus.GetLink(postContent);
  647. if (string.IsNullOrEmpty(url))
  648. {
  649. return new APIResult(new
  650. {
  651. success = false,
  652. message = "无效URL",
  653. });
  654. }
  655. (success, string content) = await alimama.GetDesiredUrlAsync(url);
  656. if (content.Contains("霸下通用 web 页面-验证码"))
  657. {
  658. message = "霸下验证码";
  659. }
  660. else
  661. {
  662. message = content;
  663. }
  664. return new APIResult(new
  665. {
  666. success = true,
  667. message,
  668. });
  669. }
  670. }
  671. }