TaskController.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  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. sql = $"CREATE TABLE IF NOT EXISTS ks_parse_logs_{table_suffix} LIKE ks_parse_logs;";
  290. DBContext.Execute(sql, null);
  291. sql = $"CREATE TABLE IF NOT EXISTS tk_promotion_logs_{table_suffix} LIKE tk_promotion_logs;";
  292. DBContext.Execute(sql, null);
  293. }
  294. TkLogCore.save_dailys_log = true;
  295. RedisHelper.Set("turn:save_dailys_log", 1, 86400);
  296. }
  297. catch (Exception ex)
  298. {
  299. string message = $"【创建数据标错误】\n{ex.Message}\n{ex.StackTrace}";
  300. NotifyCore.Notify(new NifyMessage
  301. {
  302. message = message,
  303. priority = NifyMessagePriority.high,
  304. tags = ["red_circle"]
  305. });
  306. }
  307. return new APIResult(new { success = true, message = "ok" });
  308. }
  309. //[HttpGet]
  310. //public async Task<ActionResult> ApiCallStatistics(int intervalDay = 1)
  311. //{
  312. // try
  313. // {
  314. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.tb);
  315. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.tb, "parse_");
  316. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.tb, "coupon_");
  317. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.wemeet, "parse_");
  318. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.bdpan, "parse_");
  319. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.dy, "parse_");
  320. // AlimamaPlus.ApiCallStatistics(intervalDay, TkChannelEnum.jd, "parse_");
  321. // }
  322. // catch (Exception ex)
  323. // {
  324. // string message = $"【报表接口异常】ApiCallStatistics\n{ex.Message}\n{ex.StackTrace}";
  325. // NotifyCore.Notify(new NifyMessage
  326. // {
  327. // message = message,
  328. // priority = NifyMessagePriority.high,
  329. // tags = ["red_circle"]
  330. // });
  331. // }
  332. // return new APIResult(new { success = true, message = "ok" });
  333. //}
  334. [HttpGet]
  335. public async Task<ActionResult> GetDrawBalance()
  336. {
  337. var list = TkPoolCore.List();
  338. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  339. string message = string.Empty;
  340. foreach (var account in list)
  341. {
  342. if (!account.enable_sync_order) continue;
  343. try
  344. {
  345. var alimama = new AlimamaPlus(account);
  346. alimama.GetDrawBalance();
  347. }
  348. catch (Exception ex)
  349. {
  350. message = $"【报表接口异常】GetDrawBalance\n{ex.Message}\n{ex.StackTrace}";
  351. NotifyCore.Notify(new NifyMessage
  352. {
  353. message = message,
  354. priority = NifyMessagePriority.high,
  355. tags = ["red_circle"]
  356. });
  357. continue;
  358. }
  359. }
  360. return new APIResult(new { success = true, message = "ok" });
  361. }
  362. [HttpGet]
  363. public async Task<ActionResult> FastReport()
  364. {
  365. string message = string.Empty;
  366. var list = TkPoolCore.List();
  367. if (list != null)
  368. {
  369. foreach (var account in list)
  370. {
  371. if (!account.enable_sync_order) continue;
  372. try
  373. {
  374. var alimama = new AlimamaPlus(account);
  375. alimama.SaveReportOverview();
  376. }
  377. catch (Exception ex)
  378. {
  379. message = $"【报表接口异常】FastReport\n{ex.Message}\n{ex.StackTrace}";
  380. NotifyCore.Notify(new NifyMessage
  381. {
  382. message = message,
  383. priority = NifyMessagePriority.high,
  384. tags = ["red_circle"]
  385. });
  386. continue;
  387. }
  388. }
  389. }
  390. string filter = "";
  391. var jd_list = new DBContext.Table("jd_pool").Where(filter, null).Select<JdPoolDTO>();
  392. if (jd_list != null)
  393. {
  394. bool any_jd_changed = false;
  395. foreach (var account in jd_list)
  396. {
  397. bool changed = false;
  398. try
  399. {
  400. account.current_daily_calls = JdPoolCore.SaveCalls(account.id, DateTime.Now.ToString("yyyyMMdd"));
  401. account.current_hourly_calls = JdPoolCore.SaveCalls(account.id, DateTime.Now.ToString("yyyyMMddHH"));
  402. changed = true;
  403. any_jd_changed = true;
  404. }
  405. catch (Exception ex)
  406. {
  407. message = $"【JD计数异常】SaveCalls\n{ex.Message}\n{ex.StackTrace}";
  408. NotifyCore.Notify(new NifyMessage
  409. {
  410. message = message,
  411. priority = NifyMessagePriority.high,
  412. tags = ["red_circle"]
  413. });
  414. continue;
  415. }
  416. if (!account.status) continue;
  417. if (!string.IsNullOrEmpty(account.cookies))
  418. {
  419. try
  420. {
  421. var plus = new JdUnionPlus(account);
  422. var data = await plus.queryTodaySpreadEffectData();
  423. account.today_clickNum = data.clickNum;
  424. account.today_cosFee = data.cosFee;
  425. account.today_cosPrice = data.cosPrice;
  426. account.today_finishCosFee = data.finishCosFee;
  427. account.today_finishCosPrice = data.finishCosPrice;
  428. account.today_finishOrderNum = data.finishOrderNum;
  429. account.today_orderNum = data.orderNum;
  430. changed = true;
  431. any_jd_changed = true;
  432. }
  433. catch (Exception ex)
  434. {
  435. if (ex.Message.Contains("no login"))
  436. {
  437. account.status = false;
  438. JdPoolCore.Disabled(account.id, account.name, ex.Message);
  439. }
  440. message = $"【JD报表接口异常】{account.id}:{account.name}\tqueryTodaySpreadEffectData\n{account.Convert2Json()}\n{ex.Message}\n{ex.StackTrace}";
  441. NotifyCore.Notify(new NifyMessage
  442. {
  443. message = message,
  444. priority = NifyMessagePriority.high,
  445. tags = ["red_circle"]
  446. });
  447. continue;
  448. }
  449. }
  450. if (changed) JdPoolCore.Update(account);
  451. }
  452. if (any_jd_changed) JdPoolCore.Refresh();
  453. }
  454. var pdd_list = new DBContext.Table("pdd_pool").Where(filter, null).Select<PddPoolDTO>();
  455. if (pdd_list != null)
  456. {
  457. bool any_pdd_changed = false;
  458. foreach (var account in pdd_list)
  459. {
  460. bool changed = false;
  461. try
  462. {
  463. account.current_daily_calls = PddPoolCore.SaveCalls(account.id, DateTime.Now.ToString("yyyyMMdd"));
  464. account.current_hourly_calls = PddPoolCore.SaveCalls(account.id, DateTime.Now.ToString("yyyyMMddHH"));
  465. changed = true;
  466. any_pdd_changed = true;
  467. }
  468. catch (Exception ex)
  469. {
  470. message = $"【Pdd计数异常】SaveCalls\n{ex.Message}\n{ex.StackTrace}";
  471. NotifyCore.Notify(new NifyMessage
  472. {
  473. message = message,
  474. priority = NifyMessagePriority.high,
  475. tags = ["red_circle"]
  476. });
  477. continue;
  478. }
  479. if (changed) PddPoolCore.Update(account);
  480. }
  481. if (any_pdd_changed) PddPoolCore.Refresh();
  482. }
  483. await EndPointCore.NotifyReload(true);
  484. return new APIResult(new { success = true, message = "ok" });
  485. }
  486. [HttpGet]
  487. public async Task<ActionResult> SaveReport()
  488. {
  489. string message = string.Empty;
  490. var list = TkPoolCore.List();
  491. if (list != null)
  492. {
  493. foreach (var account in list)
  494. {
  495. if (!account.enable_sync_order) continue;
  496. #if DEBUG
  497. if (account.id != 5) continue;
  498. #endif
  499. try
  500. {
  501. var alimama = new AlimamaPlus(account);
  502. alimama.SaveReportHourtrend(DateTime.Now.AddDays(-1));
  503. alimama.SaveReportHourtrend(DateTime.Now);
  504. if (DateTime.Now.Hour >= 12 && DateTime.Now.Hour < 16)
  505. {
  506. DateTime date = DateTime.Now.AddDays(-1);
  507. alimama.FixReport(date);
  508. }
  509. }
  510. catch (Exception ex)
  511. {
  512. message = $"【报表接口异常】SaveReport\n{ex.Message}\n{ex.StackTrace}";
  513. NotifyCore.Notify(new NifyMessage
  514. {
  515. message = message,
  516. priority = NifyMessagePriority.high,
  517. tags = ["red_circle"]
  518. });
  519. continue;
  520. }
  521. }
  522. }
  523. return new APIResult(new { success = true, message = "ok" });
  524. }
  525. [HttpGet]
  526. public async Task<ActionResult> JdSaveReport()
  527. {
  528. string message = string.Empty;
  529. var jd_list = new DBContext.Table("jd_pool").Where("", null).Select<JdPoolDTO>();
  530. if (jd_list != null)
  531. {
  532. DateTime startDate = DateTime.Now.AddDays(-1);
  533. DateTime endDate = DateTime.Now.AddDays(-1);
  534. foreach (var account in jd_list)
  535. {
  536. if (!account.status) continue;
  537. #if DEBUG
  538. if (account.id != 10) continue;
  539. #endif
  540. if (!string.IsNullOrEmpty(account.cookies))
  541. {
  542. try
  543. {
  544. var plus = new JdUnionPlus(account);
  545. _ = await plus.querySpreadEffectData(startDate, endDate);
  546. _ = await plus.queryEstimateCommList();
  547. }
  548. catch (Exception ex)
  549. {
  550. if (ex.Message.Contains("no login"))
  551. {
  552. JdPoolCore.Disabled(account.id, account.name, ex.Message);
  553. }
  554. message = $"【JD报表接口异常】{account.id}:{account.name}\tquerySpreadEffectData\n{ex.Message}\n{ex.StackTrace}";
  555. NotifyCore.Notify(new NifyMessage
  556. {
  557. message = message,
  558. priority = NifyMessagePriority.high,
  559. tags = ["red_circle"]
  560. });
  561. continue;
  562. }
  563. }
  564. }
  565. }
  566. return new APIResult(new { success = true, message = "ok" });
  567. }
  568. [HttpGet]
  569. public async Task<ActionResult> FixReport(int id, string dt)
  570. {
  571. if (!DateTime.TryParse(dt, out DateTime date))
  572. {
  573. return new APIResult(new { success = false, message = "日期错误", });
  574. }
  575. var list = TkPoolCore.List();
  576. if (list == null) return new APIResult(new { success = false, message = "没有有效账号", });
  577. string message = string.Empty;
  578. foreach (var account in list)
  579. {
  580. if (id != account.id) continue;
  581. try
  582. {
  583. var alimama = new AlimamaPlus(account);
  584. while (date.Date < DateTime.Now.Date)
  585. {
  586. alimama.FixReport(date);
  587. date = date.AddDays(1);
  588. }
  589. }
  590. catch (Exception ex)
  591. {
  592. message = $"【报表接口异常】SaveReport\n{ex.Message}\n{ex.StackTrace}";
  593. NotifyCore.Notify(new NifyMessage
  594. {
  595. message = message,
  596. priority = NifyMessagePriority.high,
  597. tags = ["red_circle"]
  598. });
  599. continue;
  600. }
  601. }
  602. return new APIResult(new { success = true, message = "ok" });
  603. }
  604. [HttpGet]
  605. public ActionResult RenewCookie(string name)
  606. {
  607. var account = new DBContext.Table("tk_pool").Get<TkPoolDTO>("name=@name", new { name });
  608. if (account == null) return new APIResult(new { success = false, message = "没有有效账号", });
  609. var alimama = new AlimamaPlus(account);
  610. (bool success, string message) = alimama.RenewCookie();
  611. return new APIResult(new { success, message });
  612. }
  613. [HttpGet]
  614. public ActionResult Reload()
  615. {
  616. TkConfigCore.Refresh();
  617. EndPointCore.Refresh();
  618. ProxyNodesCore.Refresh();
  619. TkPoolCore.Refresh();
  620. VeapiPoolCore.Refresh();
  621. ApiAccountCore.Refresh();
  622. DataokeCore.Refresh();
  623. JdPoolCore.Refresh();
  624. PddPoolCore.Refresh();
  625. PangolinPoolCore.Refresh();
  626. ElePoolCore.Refresh();
  627. MeituanPoolCore.Refresh();
  628. DeeplinkParseRuleCore.Refresh();
  629. return new APIResult(new
  630. {
  631. success = true,
  632. message = "ok",
  633. });
  634. }
  635. [HttpGet]
  636. public ActionResult ReloadAccount()
  637. {
  638. EndPointCore.Refresh();
  639. ProxyNodesCore.Refresh();
  640. TkPoolCore.Refresh();
  641. VeapiPoolCore.Refresh();
  642. JdPoolCore.Refresh();
  643. PddPoolCore.Refresh();
  644. ElePoolCore.Refresh();
  645. MeituanPoolCore.Refresh();
  646. return new APIResult(new
  647. {
  648. success = true,
  649. message = "ok",
  650. });
  651. }
  652. [HttpGet]
  653. public async Task<ActionResult> CheckDeepUrl(int accountid)
  654. {
  655. var postContent = "88✔7Fi43dJwWpV£ https://m.tb.cn/h.g92hfR4JLgn7yvG MF7997 我分享给你了一个超赞的内容,快来看看吧";
  656. var channel = "tb";
  657. var ip = "127.0.0.1";
  658. var oaid = "test-oaid";
  659. bool success = false;
  660. string message;
  661. //============================== 放弃转链-没有匹配账号 ==============================
  662. TkPoolDTO? account = TkPoolCore.GetOne(accountid);
  663. if (account == null)
  664. {
  665. return new APIResult(new
  666. {
  667. success = false,
  668. message = "没有匹配账号",
  669. });
  670. }
  671. var alimama = new AlimamaPlus(account);
  672. TkDataDTO result = new TkDataDTO();
  673. string url = AlimamaPlus.GetLink(postContent);
  674. if (string.IsNullOrEmpty(url))
  675. {
  676. return new APIResult(new
  677. {
  678. success = false,
  679. message = "无效URL",
  680. });
  681. }
  682. (success, string content) = await alimama.GetDesiredUrlAsync(url);
  683. if (content.Contains("霸下通用 web 页面-验证码"))
  684. {
  685. message = "霸下验证码";
  686. }
  687. else
  688. {
  689. message = content;
  690. }
  691. return new APIResult(new
  692. {
  693. success = true,
  694. message,
  695. });
  696. }
  697. }
  698. }