TaskController.cs 28 KB

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