TkController.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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.Security.Cryptography;
  9. using Microsoft.AspNetCore.Authentication;
  10. using TencentCloud.Ecm.V20190719.Models;
  11. using COSXML.Network;
  12. using System.Linq;
  13. using static dodohold.core.ZTOExpress.CreateOrderArgs;
  14. using MySqlX.XDevAPI;
  15. using TencentCloud.Ame.V20190916.Models;
  16. using YunhuiKit;
  17. namespace molilian.api.Controllers
  18. {
  19. [ApiController]
  20. [Route("[controller]/[action]")]
  21. public class TkController : ControllerBase
  22. {
  23. protected IHttpContextAccessor _accessor;
  24. public TkController(IHttpContextAccessor accessor)
  25. {
  26. _accessor = accessor;
  27. }
  28. /// <summary>
  29. /// oppo调用
  30. /// </summary>
  31. /// <param name="s">正文</param>
  32. /// <param name="c">渠道。tb/jd</param>
  33. /// <param name="a">分配的客户端账号</param>
  34. /// <param name="t">11位时间戳</param>
  35. /// <param name="sign">签名</param>
  36. /// <param name="ip">客户的IP</param>
  37. /// <param name="oaid">客户的唯一ID</param>
  38. /// <returns></returns>
  39. [HttpPost]
  40. public async Task<ActionResult> unionParse([FromBody] JsonElement form, [FromQuery] string a = "", [FromQuery] int t = 0, [FromQuery] string sign = "")
  41. {
  42. //正文
  43. var content = form.Read("s", string.Empty);
  44. var channel = form.Read("c", string.Empty);
  45. var ip = form.Read("ip", string.Empty);
  46. var oaid = form.Read("oaid", string.Empty);
  47. var clickId = form.Read("clickId", string.Empty);
  48. var commerceType = form.Read<int>("commerceType", 0);
  49. //验证签名
  50. if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(sign))
  51. {
  52. return new APIResult(new { success = false, message = "验证错误" }, APIResultCodeEnum.Unauthorized);
  53. }
  54. DateTime time1 = t.Convert2Datetime();
  55. if (time1 < DateTime.Now.AddMinutes(-10))
  56. {
  57. return new APIResult(new { success = false, message = "验证错误2" }, APIResultCodeEnum.Unauthorized);
  58. }
  59. var account = await ApiAccountCore.GetOneAsync(a);
  60. if (account == null)
  61. {
  62. return new APIResult(new { success = false, message = "验证错误3" }, APIResultCodeEnum.Unauthorized);
  63. }
  64. string app_sign = $"{account.api_secret}@{t}".MD5();
  65. if (sign != app_sign)
  66. {
  67. return new APIResult(new { success = false, message = "验证错误4" }, APIResultCodeEnum.Unauthorized);
  68. }
  69. return await UnionParseCore.UnionParseAsync(content, channel, commerceType, ip, oaid, 0, clickId);
  70. }
  71. [HttpPost]
  72. public async Task<ActionResult> unsafeParse([FromBody] JsonElement form)
  73. {
  74. var content = form.Read("s", string.Empty);
  75. var channel = form.Read("c", string.Empty);
  76. var ip = form.Read("ip", string.Empty);
  77. var oaid = form.Read("oaid", string.Empty);
  78. var clickId = form.Read("clickId", string.Empty);
  79. int accountid = form.Read("aid", 0);
  80. var commerceType = form.Read<int>("commerceType", 0);
  81. #if DEBUG
  82. //ip = "127.0.0.1";
  83. //oaid = "test-oaid";
  84. #endif
  85. return await UnionParseCore.UnionParseAsync(content, channel, commerceType, ip, oaid, accountid, clickId);
  86. }
  87. [HttpPost]
  88. public async Task<ActionResult> unsafeBatchParse([FromBody] JsonElement form)
  89. {
  90. var content = form.PathReadArray("s[]", string.Empty);
  91. var channel = form.Read("c", string.Empty);
  92. var ip = form.Read("ip", string.Empty);
  93. var oaid = form.Read("oaid", string.Empty);
  94. var clickId = form.Read("clickId", string.Empty);
  95. int accountid = form.Read("aid", 0);
  96. int count = form.Read("count", 0);
  97. var commerceType = form.Read<int>("commerceType", 0);
  98. #if DEBUG
  99. //ip = "127.0.0.1";
  100. //oaid = "test-oaid";
  101. #endif
  102. for (int i = 0; i < count; i++)
  103. {
  104. _ = await UnionParseCore.UnionParseAsync(content[i], channel, commerceType, ip, oaid, accountid, clickId);
  105. }
  106. return new APIResult(new { msg = "ok" });
  107. }
  108. [HttpPost]
  109. public async Task<ActionResult> unionCoupon([FromBody] JsonElement form, [FromQuery] string a = "", [FromQuery] int t = 0, [FromQuery] string sign = "")
  110. {
  111. //正文
  112. var content = form.Read("s", string.Empty);
  113. var dplink = form.Read("dp", string.Empty);
  114. var channel = form.Read("c", string.Empty);
  115. var ip = form.Read("ip", string.Empty);
  116. var oaid = form.Read("oaid", string.Empty);
  117. var clickId = form.Read("clickId", string.Empty);
  118. //验证签名
  119. if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(sign))
  120. {
  121. return new APIResult(new { success = false, message = "验证错误" }, APIResultCodeEnum.Unauthorized);
  122. }
  123. DateTime time1 = t.Convert2Datetime();
  124. if (time1 < DateTime.Now.AddMinutes(-10))
  125. {
  126. return new APIResult(new { success = false, message = "验证错误2" }, APIResultCodeEnum.Unauthorized);
  127. }
  128. var account = await ApiAccountCore.GetOneAsync(a);
  129. if (account == null)
  130. {
  131. return new APIResult(new { success = false, message = "验证错误3" }, APIResultCodeEnum.Unauthorized);
  132. }
  133. string app_sign = $"{account.api_secret}@{t}".MD5();
  134. if (sign != app_sign)
  135. {
  136. return new APIResult(new { success = false, message = "验证错误4" }, APIResultCodeEnum.Unauthorized);
  137. }
  138. return await UnionCouponCore.UnionCouponAsync(content, dplink, channel, ip, oaid, clickId);
  139. }
  140. [HttpPost]
  141. public async Task<ActionResult> unsafeCoupon([FromBody] JsonElement form)
  142. {
  143. var content = form.Read("s", string.Empty);
  144. var dplink = form.Read("dp", string.Empty);
  145. var channel = form.Read("c", string.Empty);
  146. var ip = form.Read("ip", string.Empty);
  147. var oaid = form.Read("oaid", string.Empty);
  148. var clickId = form.Read("clickId", string.Empty);
  149. #if DEBUG
  150. ip = "127.0.0.1";
  151. oaid = "test-oaid";
  152. #endif
  153. return await UnionCouponCore.UnionCouponAsync(content, dplink, channel, ip, oaid, clickId);
  154. }
  155. /// <summary>
  156. /// 第三方调用
  157. /// </summary>
  158. /// <param name="s"></param>
  159. /// <param name="s2"></param>
  160. /// <returns></returns>
  161. [HttpGet]
  162. public async Task<ActionResult> parse(string s, string s2 = "", string ip = "", string oaid = "")
  163. {
  164. AlimamaPlus alimama = null;
  165. ip = AlimamaPlus.OppoDecode(ip);
  166. oaid = AlimamaPlus.OppoDecode(oaid);
  167. var result = AlimamaPlus.GetFormattedObject(s, ip, oaid);
  168. string body = "";
  169. string content = s.UrlDecode();
  170. string content2 = s2.UrlDecode();
  171. string account_name = string.Empty;
  172. result.rawContent = content;
  173. result.rawContent2 = content2;
  174. try
  175. {
  176. if (AlimamaPlus.ShouldIgnoreRequest(ip, oaid, out string reason))
  177. {
  178. result.success = false;
  179. result.message = "放弃转链";
  180. result.reason = reason;
  181. _ = TkLogCore.LogAsync(result);
  182. return new APIResult(new
  183. {
  184. result.success,
  185. result.message,
  186. result.content,
  187. result.couponAmount,
  188. result.taoToken,
  189. result.shortLinkurl,
  190. result.deeplink_url,
  191. });
  192. }
  193. var account = await TkPoolCore.GetOneAsync(TkPoolCore.TkAction.parse);
  194. if (account == null)
  195. {
  196. result.success = false;
  197. result.message = "放弃转链";
  198. result.reason = "没有匹配账号";
  199. _ = TkLogCore.LogAsync(result);
  200. return new APIResult(new
  201. {
  202. result.success,
  203. result.message,
  204. result.content,
  205. result.couponAmount,
  206. result.taoToken,
  207. result.shortLinkurl,
  208. result.deeplink_url,
  209. });
  210. }
  211. result.accountId = account.id;
  212. result.accountName = account.company;
  213. account_name = account.name;
  214. alimama = new AlimamaPlus(account);
  215. if (alimama.ShouldIgnoreOtherAff(s2))
  216. {
  217. result.success = false;
  218. result.message = "放弃转链";
  219. result.reason = "其他推广链接";
  220. _ = TkLogCore.LogAsync(result);
  221. return new APIResult(new
  222. {
  223. result.success,
  224. result.message,
  225. result.content,
  226. result.couponAmount,
  227. result.taoToken,
  228. result.shortLinkurl,
  229. result.deeplink_url,
  230. });
  231. }
  232. result = await alimama.UnionParseAsync(content, 0, result);
  233. }
  234. catch (Exception ex)
  235. {
  236. if (ex.Message.Contains("was canceled"))
  237. {
  238. result.success = false;
  239. result.message = "放弃转链";
  240. result.reason = "请求超时";
  241. }
  242. else
  243. {
  244. //new LoggerLibrary("api_error", "parse")
  245. //.Info(s, s2)
  246. //.Info($"【taobao】{account_name}", body)
  247. //.Info(ex.Message, ex.StackTrace)
  248. //.SaveAsync();
  249. NotifyCore.Notify(new NifyMessage
  250. {
  251. message = $"【转链接口异常】{result.accountName}\n{content}\n{content2}\n{body}\n\n{ex.Message}\n{ex.StackTrace}",
  252. priority = NifyMessagePriority.high,
  253. tags = ["red_circle"]
  254. });
  255. result.success = false;
  256. result.message = "放弃转链";
  257. result.reason = "转链接口异常";
  258. }
  259. }
  260. _ = TkLogCore.LogAsync(result, alimama);
  261. return new APIResult(new
  262. {
  263. result.success,
  264. result.message,
  265. result.content,
  266. result.couponAmount,
  267. result.taoToken,
  268. result.shortLinkurl,
  269. result.deeplink_url,
  270. });
  271. }
  272. [HttpGet]
  273. public async Task<ActionResult> jd_parse(string s, string s2 = "", string ip = "", string oaid = "")
  274. {
  275. var result = JdUnionPlus.GetFormattedObject(s, ip, oaid);
  276. string body = "";
  277. string content = s.UrlDecode();
  278. string content2 = s2.UrlDecode();
  279. try
  280. {
  281. if (AlimamaPlus.ShouldIgnoreRequest(ip, oaid, out string reason))
  282. {
  283. result.success = false;
  284. result.message = "放弃转链";
  285. result.reason = reason;
  286. result.rawContent = content;
  287. result.rawContent2 = content2;
  288. _ = TkLogCore.LogAsync(result);
  289. return new APIResult(result);
  290. }
  291. var api = DataokeCore.GetOne();
  292. if (api == null)
  293. {
  294. result.success = false;
  295. result.message = "放弃转链";
  296. result.reason = "没有匹配账号";
  297. result.rawContent = content;
  298. result.rawContent2 = content2;
  299. _ = TkLogCore.LogAsync(result);
  300. return new APIResult(result);
  301. }
  302. var account = await JdPoolCore.GetOneAsync();
  303. if (account == null)
  304. {
  305. result.success = false;
  306. result.message = "放弃转链";
  307. result.reason = "没有匹配账号";
  308. result.rawContent = content;
  309. result.rawContent2 = content2;
  310. _ = TkLogCore.LogAsync(result);
  311. return new APIResult(result);
  312. }
  313. result = DataokeCore.JdParse(result, api, account, content);
  314. }
  315. catch (Exception ex)
  316. {
  317. _ = new LoggerLibrary("api_error")
  318. .Info(s, s2)
  319. .Info("【jd】", body)
  320. .Info(ex.Message, ex.StackTrace)
  321. .SaveAsync();
  322. NotifyCore.Notify(new NifyMessage
  323. {
  324. message = $"【转链接口异常】\n{content}\n{content2}\n{body}\n\n{ex.Message}\n{ex.StackTrace}",
  325. priority = NifyMessagePriority.high,
  326. tags = ["red_circle"]
  327. });
  328. result.success = false;
  329. result.message = "放弃转链";
  330. result.reason = "转链接口异常";
  331. }
  332. result.rawContent = content;
  333. result.rawContent2 = content2;
  334. _ = TkLogCore.LogAsync(result);
  335. return new APIResult(new
  336. {
  337. result.success,
  338. result.message,
  339. result.shortLinkurl,
  340. result.itemId,
  341. result.itemName,
  342. result.deeplink_url,
  343. });
  344. }
  345. [HttpGet]
  346. public async Task<ActionResult> Reload()
  347. {
  348. await EndPointCore.NotifyReload();
  349. return new APIResult(new
  350. {
  351. success = true,
  352. message = "ok",
  353. });
  354. }
  355. [HttpGet]
  356. public async Task<ActionResult> dplist([FromQuery] string query = "", [FromQuery] string a = "", [FromQuery] int t = 0, [FromQuery] string sign = "")
  357. {
  358. //验证签名
  359. if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(sign))
  360. {
  361. return new APIResult(new { success = false, message = "验证错误" }, APIResultCodeEnum.Unauthorized);
  362. }
  363. DateTime time1 = t.Convert2Datetime();
  364. if (time1 < DateTime.Now.AddMinutes(-10))
  365. {
  366. return new APIResult(new { success = false, message = "验证错误2" }, APIResultCodeEnum.Unauthorized);
  367. }
  368. var account = await ApiAccountCore.GetOneAsync(a);
  369. if (account == null)
  370. {
  371. return new APIResult(new { success = false, message = "验证错误3" }, APIResultCodeEnum.Unauthorized);
  372. }
  373. string app_sign = $"{account.api_secret}@{t}".MD5();
  374. if (sign != app_sign)
  375. {
  376. return new APIResult(new { success = false, message = "验证错误4" }, APIResultCodeEnum.Unauthorized);
  377. }
  378. if (string.IsNullOrEmpty(query))
  379. {
  380. return new APIResult(new { success = false, message = "查询条件不能为空" });
  381. }
  382. int[] report_account_ids = account.report_account_ids.ToArray<int>(',');
  383. int[] report_exclude_account_ids = account.report_exclude_account_ids.ToArray<int>(',');
  384. string filter = $"batchId=@query";
  385. var account_list = await TkPoolCore.ListAsync();
  386. List<int> account_ids = [];
  387. if (account_list.Any())
  388. {
  389. account_ids = account_list.Where(e => e.enable_fake_click).Select(e => e.id).ToList();
  390. if (report_account_ids.Length > 0)
  391. {
  392. account_ids = account_ids.Intersect(report_account_ids).ToList();
  393. }
  394. if (report_exclude_account_ids.Length > 0)
  395. {
  396. account_ids = account_ids.Except(report_exclude_account_ids).ToList();
  397. }
  398. filter += $" AND accountId IN @account_ids";
  399. }
  400. string orderBy = "paid_time ASC";
  401. var data = new DBContext.Table("tk_order_tracking")
  402. .Where(filter, new { query, account_ids })
  403. .Order(orderBy)
  404. .Select<TkOrderTrackingDTO>();
  405. //fake_click_link_type
  406. List<object> list = [];
  407. foreach (var item in data)
  408. {
  409. list.Add(new { pid = item.accountId, url = item.deeplinkUrl, item.shortLinkUrl, count = item.click_num, time = item.exp_time });
  410. }
  411. var clientIp = _accessor.HttpContext.GetUserIp();
  412. LoggerLibrary log = new LoggerLibrary("api", "dplist");
  413. log.Info($"{clientIp}\t{query}\tcount:{list.Count}");
  414. var ids = data.Select(e => e.Id).ToArray();
  415. log.Info(string.Join(',', ids));
  416. _ = log.SaveAsync();
  417. var update = new DBContext.Table("tk_order_tracking")
  418. .Add("last_pull_time", DateTime.Now)
  419. .Add("last_pull_account", account.name)
  420. .Add("clicked_num:", "clicked_num+1")
  421. .Where("id IN @ids", new { ids })
  422. .Update();
  423. return new APIResult(new
  424. {
  425. success = true,
  426. message = list.Count == 0 ? "none" : "ok",
  427. count = list.Count,
  428. data = list,
  429. });
  430. }
  431. [HttpGet]
  432. public async Task<ActionResult> unsafeParseDpList([FromQuery] string a = "", [FromQuery] string query = "")
  433. {
  434. if (string.IsNullOrEmpty(a))
  435. {
  436. return new APIResult(new { success = false, message = "验证错误" }, APIResultCodeEnum.Unauthorized);
  437. }
  438. var account = await ApiAccountCore.GetOneAsync(a);
  439. if (account == null || !account.enable_report)
  440. {
  441. return new APIResult(new { success = false, message = "验证错误3" }, APIResultCodeEnum.Unauthorized);
  442. }
  443. if (string.IsNullOrEmpty(query))
  444. {
  445. return new APIResult(new { success = false, message = "查询条件不能为空" });
  446. }
  447. int[] report_account_ids = account.report_account_ids.TryToArray<int>(',');
  448. int[] report_exclude_account_ids = account.report_exclude_account_ids.TryToArray<int>(',');
  449. string filter = $"batchId=@query";
  450. var account_list = await TkPoolCore.ListAsync();
  451. List<int> account_ids = [];
  452. if (account_list.Any())
  453. {
  454. account_ids = account_list.Where(e => e.enable_fake_click).Select(e => e.id).ToList();
  455. if (report_account_ids.Length > 0)
  456. {
  457. account_ids = account_ids.Intersect(report_account_ids).ToList();
  458. }
  459. if (report_exclude_account_ids.Length > 0)
  460. {
  461. account_ids = account_ids.Except(report_exclude_account_ids).ToList();
  462. }
  463. filter += $" AND accountId IN @account_ids";
  464. }
  465. string orderBy = "paid_time ASC";
  466. var data = new DBContext.Table("tk_order_tracking")
  467. .Where(filter, new { query, account_ids })
  468. .Order(orderBy)
  469. .Select<TkOrderTrackingDTO>();
  470. List<object> list = [];
  471. foreach (var item in data)
  472. {
  473. list.Add(new { pid = item.accountId, url = item.deeplinkUrl, item.shortLinkUrl, count = item.click_num, time = item.exp_time });
  474. }
  475. var clientIp = _accessor.HttpContext.GetUserIp();
  476. LoggerLibrary log = new LoggerLibrary("api", "unsafeParseDpList");
  477. log.Info($"{clientIp}\t{query}\tcount:{list.Count}");
  478. var ids = data.Select(e => e.Id).ToArray();
  479. log.Info(string.Join(',', ids));
  480. _ = log.SaveAsync();
  481. return new APIResult(new
  482. {
  483. success = true,
  484. message = list.Count == 0 ? "none" : "ok",
  485. count = list.Count,
  486. data = list,
  487. });
  488. }
  489. [HttpPost]
  490. public async Task<ActionResult> dataReport([FromBody] JsonElement form, [FromQuery] string a = "", [FromQuery] int t = 0, [FromQuery] string sign = "")
  491. {
  492. bool debug = form.Read("debug", false);
  493. var clientIp = _accessor.HttpContext.GetUserIp();
  494. var log = new LoggerLibrary("ApiReportCore", "dataReport");
  495. log.Info(clientIp);
  496. //验证签名
  497. if (string.IsNullOrEmpty(a) || string.IsNullOrEmpty(sign))
  498. {
  499. _ = log.Info($"a:{a}\tt:{t}\tsign:{sign}\t", $"message:验证错误")
  500. .Info(form.GetRawText())
  501. .SaveAsync();
  502. return new APIResult(new { success = false, message = "验证错误" }, APIResultCodeEnum.Unauthorized);
  503. }
  504. DateTime time1 = t.Convert2Datetime();
  505. if (time1 < DateTime.Now.AddMinutes(-10))
  506. {
  507. _ = log.Info($"a:{a}\tt:{t}\tsign:{sign}\t", $"message:验证错误2")
  508. .Info(form.GetRawText())
  509. .SaveAsync();
  510. return new APIResult(new { success = false, message = "验证错误2" }, APIResultCodeEnum.Unauthorized);
  511. }
  512. var account = await ApiAccountCore.GetOneAsync(a);
  513. if (account == null || !account.enable_report)
  514. {
  515. _ = log.Info($"a:{a}\tt:{t}\tsign:{sign}\t", $"message:验证错误3")
  516. .Info(form.GetRawText())
  517. .SaveAsync();
  518. return new APIResult(new { success = false, message = "验证错误3" }, APIResultCodeEnum.Unauthorized);
  519. }
  520. string app_sign = $"{account.api_secret}@{t}".MD5();
  521. if (sign != app_sign)
  522. {
  523. _ = log.Info($"a:{a}\tt:{t}\tsign:{sign}\tapp_sign:{app_sign}", $"message:验证错误4")
  524. .Info(form.GetRawText())
  525. .SaveAsync();
  526. return new APIResult(new { success = false, message = "验证错误4" }, APIResultCodeEnum.Unauthorized);
  527. }
  528. try
  529. {
  530. //0:全分销类型;-1:各分销类型,1:goods 2: live 3:video 4: profile 5: unknown
  531. int distributiontype = form.Read("distributiontype", 0);
  532. //0:全平台;-1:各平台;1:淘宝 2:京东 2:多多
  533. int platform = form.Read("platform", 0);
  534. var data = await ApiReportCore.ReportDailysAsync(form, clientIp, debug);
  535. _ = log.Info(form.GetRawText(), data.Convert2Json()).SaveAsync();
  536. return new APIResult(new { success = true, platform, distributiontype, data });
  537. }
  538. catch (Exception ex)
  539. {
  540. _ = log.Info(form.GetRawText()).Info(ex.Message, ex.StackTrace).SaveAsync();
  541. return new APIResult(new { success = false, message = "内部错误" });
  542. }
  543. }
  544. [HttpPost]
  545. public async Task<ActionResult> unsafeDataReport([FromBody] JsonElement form)
  546. {
  547. bool debug = form.Read("debug", false);
  548. var clientIp = _accessor.HttpContext.GetUserIp();
  549. var log = new LoggerLibrary("ApiReportCore", "unsafeDataReport");
  550. log.Info(clientIp);
  551. try
  552. {
  553. //0:全分销类型;-1:各分销类型,1:goods 2: live 3:video 4: profile 5: unknown
  554. int distributiontype = form.Read("distributiontype", 0);
  555. //0:全平台;-1:各平台;1:淘宝 2:京东
  556. int platform = form.Read("platform", 0);
  557. var data = await ApiReportCore.ReportDailysAsync(form, clientIp, debug);
  558. _ = log.Info(form.GetRawText(), data.Convert2Json()).SaveAsync();
  559. return new APIResult(new { success = true, platform, distributiontype, data });
  560. }
  561. catch (Exception ex)
  562. {
  563. _ = log.Info(form.GetRawText()).Info(ex.Message, ex.StackTrace).SaveAsync();
  564. return new APIResult(new { success = false, message = "内部错误" });
  565. }
  566. }
  567. }
  568. }