TaskController.cs 29 KB

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