HomeController.cs 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5. using System.Data;
  6. using System.Threading.Tasks;
  7. using Microsoft.AspNetCore.Mvc;
  8. using Microsoft.Extensions.Logging;
  9. using MySystem.PxcModels;
  10. using System.Threading;
  11. using Library;
  12. using LitJson;
  13. namespace MySystem.Controllers
  14. {
  15. public class HomeController : Controller
  16. {
  17. private readonly ILogger<HomeController> _logger;
  18. public HomeController(ILogger<HomeController> logger)
  19. {
  20. _logger = logger;
  21. }
  22. public IActionResult Index()
  23. {
  24. return View();
  25. }
  26. public IActionResult Error()
  27. {
  28. string isapi = Request.Headers["Api"].ToString();
  29. if (isapi != "1")
  30. {
  31. if (Response.StatusCode == 500)
  32. {
  33. return Redirect("/public/errpage/pc/500.html");
  34. }
  35. else if (Response.StatusCode == 502)
  36. {
  37. return Redirect("/public/errpage/pc/502.html");
  38. }
  39. else if (Response.StatusCode == 404)
  40. {
  41. return Redirect("/public/errpage/pc/404.html");
  42. }
  43. }
  44. return View();
  45. }
  46. private static object o = new object();
  47. public string addmer(string mid, int k = 0)
  48. {
  49. MerchantConfirmService.Instance.Start(mid, k);
  50. return "ok";
  51. }
  52. public string setqrcode(int uid = 0)
  53. {
  54. return "ok";
  55. }
  56. public string userqrcode(int uid)
  57. {
  58. WebCMSEntities db = new WebCMSEntities();
  59. Users user = db.Users.FirstOrDefault(m => m.Id == uid);
  60. if (user != null)
  61. {
  62. MakeReferenceQrCodeService.Instance.Start(user.Id.ToString());
  63. return "ok";
  64. }
  65. db.Dispose();
  66. return "fail";
  67. }
  68. public string getqrcode(int uid, int pid)
  69. {
  70. WebCMSEntities db = new WebCMSEntities();
  71. Users user = db.Users.FirstOrDefault(m => m.Id == uid);
  72. if (user != null)
  73. {
  74. return MakeReferenceQrCodeService.Instance.MergeQrCode(user, pid);
  75. }
  76. db.Dispose();
  77. return "fail";
  78. }
  79. private void th1()
  80. {
  81. Thread th = new Thread(th1do);
  82. th.IsBackground = true;
  83. th.Start();
  84. }
  85. private void th1do()
  86. {
  87. WebCMSEntities db = new WebCMSEntities();
  88. Users user = db.Users.FirstOrDefault(m => m.Id == 2);
  89. if (user != null)
  90. {
  91. user.SeoTitle = "111111";
  92. Thread.Sleep(5000);
  93. user.SeoDescription = "222222";
  94. db.SaveChanges();
  95. }
  96. db.Dispose();
  97. }
  98. private void th2()
  99. {
  100. Thread th = new Thread(th2do);
  101. th.IsBackground = true;
  102. th.Start();
  103. }
  104. private void th2do()
  105. {
  106. Thread.Sleep(2000);
  107. WebCMSEntities db = new WebCMSEntities();
  108. Users user = db.Users.FirstOrDefault(m => m.Id == 2);
  109. if (user != null)
  110. {
  111. user.SeoKeyword = "看看有没有值写入";
  112. db.SaveChanges();
  113. }
  114. db.Dispose();
  115. }
  116. // 补激活奖励
  117. public string setmeruser(string date)
  118. {
  119. StatService.Instance.dosomething1(date);
  120. return "ok";
  121. }
  122. // 补流量费奖励
  123. public string addflux(string date)
  124. {
  125. StatService.Instance.doFluxRecord(date);
  126. return "ok";
  127. }
  128. public string chkactprize(int Id = 0)
  129. {
  130. if (Id > 0)
  131. {
  132. StatService.Instance.dosomething3(Id);
  133. }
  134. return "ok";
  135. }
  136. public string mutilactprize()
  137. {
  138. List<int> ids = new List<int>();
  139. WebCMSEntities db = new WebCMSEntities();
  140. SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
  141. foreach (int id in ids)
  142. {
  143. PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == id);
  144. if (pos != null)
  145. {
  146. SpModels.ActivateRecord act = spdb.ActivateRecord.FirstOrDefault(m => m.SnNo == pos.PosSn && m.SeoTitle != "0" && !string.IsNullOrEmpty(m.SeoTitle));
  147. if (act != null)
  148. {
  149. pos.SeoKeyword = act.SeoTitle;
  150. db.SaveChanges();
  151. StatService.Instance.dosomething3(pos.Id);
  152. }
  153. }
  154. }
  155. db.Dispose();
  156. spdb.Dispose();
  157. return "ok";
  158. }
  159. public string checkOrder(int id)
  160. {
  161. AlipayPayBack2Service.Instance.checkOrder(id);
  162. return "ok";
  163. }
  164. public string scanBind()
  165. {
  166. SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
  167. PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
  168. var Binds = spdb.BindRecord.Select(m => new { m.Id, m.CreateTime, m.Status, m.MerNo, m.MerSnNo }).OrderBy(m => m.Id).ToList();
  169. foreach (var Bind in Binds)
  170. {
  171. var tran = db.Database.BeginTransaction();
  172. try
  173. {
  174. PxcModels.MachineForSnNo posFor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == Bind.MerSnNo) ?? new PxcModels.MachineForSnNo();
  175. PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
  176. if (pos != null)
  177. {
  178. if (pos.BindingState == 0)
  179. {
  180. pos.BindingState = 1;
  181. pos.BindingTime = Bind.CreateTime;
  182. PxcModels.MachineForMerNo merFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Bind.MerNo);
  183. if (merFor == null)
  184. {
  185. merFor = db.MachineForMerNo.Add(new PxcModels.MachineForMerNo()
  186. {
  187. MerNo = Bind.MerNo,
  188. SnId = pos.Id,
  189. }).Entity;
  190. }
  191. db.SaveChanges();
  192. tran.Commit();
  193. function.WriteLog(pos.PosSn, "补充绑定数据");
  194. }
  195. }
  196. }
  197. catch (Exception ex)
  198. {
  199. tran.Rollback();
  200. function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n" + Bind.Id, "同步SP绑定数据到MAIN异常");
  201. }
  202. tran.Dispose();
  203. }
  204. spdb.SaveChanges();
  205. spdb.Dispose();
  206. db.SaveChanges();
  207. db.Dispose();
  208. return "ok";
  209. }
  210. public string scanMerchant()
  211. {
  212. SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
  213. PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
  214. var Mers = spdb.Merchants.OrderBy(m => m.Id).ToList();
  215. foreach (var Mer in Mers)
  216. {
  217. var tran = db.Database.BeginTransaction();
  218. try
  219. {
  220. PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Mer.MerNo) ?? new PxcModels.MachineForMerNo();
  221. PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId) ?? new PxcModels.PosMachinesTwo();
  222. if (pos.BindingState == 1)
  223. {
  224. PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new PxcModels.Users();
  225. int TopUserId = 0;
  226. if (!string.IsNullOrEmpty(user.ParentNav))
  227. {
  228. TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
  229. }
  230. int BrandId = int.Parse(Mer.ProductType);
  231. if (Mer.MerNo.StartsWith("M900"))
  232. {
  233. BrandId = 3;
  234. }
  235. bool check = db.PosMerchantInfo.Any(m => m.KqMerNo == Mer.MerNo);
  236. if (!check)
  237. {
  238. PxcModels.PosMerchantInfo add = db.PosMerchantInfo.Add(new PxcModels.PosMerchantInfo()
  239. {
  240. CreateDate = Mer.CreateTime,
  241. UpdateDate = Mer.UpdateTime,
  242. TopUserId = TopUserId,
  243. MerUserType = user.MerchantType,
  244. BrandId = BrandId,
  245. SnStoreId = pos.StoreId,
  246. SnType = pos.PosSnType,
  247. UserId = pos.UserId,
  248. MgrName = Mer.AgentName,
  249. MerStatus = 1,
  250. KqSnNo = Mer.SnNo,
  251. KqMerNo = Mer.MerNo,
  252. MerIdcardNo = Mer.MerIdcardNo,
  253. MerRealName = Mer.MerRealName,
  254. MerchantMobile = Mer.MerMobile,
  255. MerchantName = Mer.MerName,
  256. MerchantNo = Mer.MerNo.Length > 16 ? Mer.MerNo.Substring(0, 16) : Mer.MerNo,
  257. }).Entity;
  258. db.SaveChanges();
  259. pos.BindMerchantId = add.Id;
  260. db.SaveChanges();
  261. tran.Commit();
  262. function.WriteLog(Mer.MerNo, "补充商户数据");
  263. }
  264. }
  265. }
  266. catch (Exception ex)
  267. {
  268. tran.Rollback();
  269. function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n" + Mer.Id, "同步SP商户数据到MAIN异常");
  270. }
  271. tran.Dispose();
  272. }
  273. spdb.Dispose();
  274. db.Dispose();
  275. return "ok";
  276. }
  277. public string scanTrade()
  278. {
  279. SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
  280. PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
  281. IQueryable<SpModels.TradeRecord> trades = spdb.TradeRecord.OrderBy(m => m.Id);
  282. foreach (SpModels.TradeRecord trade in trades.ToList())
  283. {
  284. bool op = true;
  285. if (trade.SerEntryMode == "N")
  286. {
  287. if (trade.TradeAmount == 9900 || trade.TradeAmount == 19900 || trade.TradeAmount == 29900)
  288. {
  289. op = false;
  290. PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == trade.MerNo) ?? new PxcModels.MachineForMerNo();
  291. PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
  292. if (pos != null)
  293. {
  294. if (trade.SerEntryMode == "N" && trade.ProductType == "1")
  295. {
  296. pos.SeoKeyword = trade.TradeAmount.ToString("f2");
  297. db.SaveChanges();
  298. }
  299. }
  300. }
  301. }
  302. if (op)
  303. {
  304. PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == trade.MerNo) ?? new PxcModels.MachineForMerNo();
  305. PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);
  306. if (pos != null)
  307. {
  308. if (pos.BindMerchantId > 0)
  309. {
  310. PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new PxcModels.Users();
  311. int TopUserId = 0;
  312. if (!string.IsNullOrEmpty(user.ParentNav))
  313. {
  314. TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
  315. }
  316. bool check = db.TradeRecord.Any(m => m.RecordNo == trade.TradeSerialNo);
  317. if (!check)
  318. {
  319. decimal TradeAmount = trade.TradeAmount;
  320. int BankCardType = -1;
  321. int QrPayFlag = 0;
  322. if (pos.BrandId == 1 || pos.BrandId == 3)
  323. {
  324. TradeAmount = TradeAmount / 100;
  325. BankCardType = int.Parse(trade.BankCardType);
  326. if (trade.TradeType == "02") QrPayFlag = 1;
  327. }
  328. else if (pos.BrandId == 2)
  329. {
  330. if (trade.TradeType == "CREDIT_BY_CARD")
  331. {
  332. BankCardType = 1;
  333. }
  334. else if (trade.TradeType == "DEBIT_BY_CARD")
  335. {
  336. BankCardType = 0;
  337. }
  338. if (trade.TradeType == "CLOUD_PAY") QrPayFlag = 1;
  339. }
  340. int BrandId = int.Parse(trade.ProductType);
  341. if (trade.MerNo.StartsWith("M900"))
  342. {
  343. BrandId = 3;
  344. }
  345. db.TradeRecord.Add(new PxcModels.TradeRecord()
  346. {
  347. CreateDate = trade.CreateDate,
  348. UpdateDate = trade.UpdateDate,
  349. RecordNo = trade.TradeSerialNo, //单号
  350. UserId = pos.UserId, //创客
  351. MerchantId = pos.BindMerchantId, //商户
  352. MerNo = trade.MerNo, //渠道商户编号
  353. MerHelpFlag = 0, //是否属于扶持周期内商户
  354. HelpMonthCount = 0, //扶持第几个月
  355. MerBuddyType = user.MerchantType, //商户创客类型
  356. SnNo = trade.TradeSnNo, //渠道SN号
  357. // TradeDate = DateTime.Parse(trade.TradeTime), //交易日期
  358. TradeSerialNo = trade.ChannelSerial, //交易流水号
  359. TradeAmount = TradeAmount, //交易金额
  360. BankCardType = BankCardType, //银行卡类型
  361. QrPayFlag = QrPayFlag, //云闪付标识
  362. BrandId = BrandId, //品牌
  363. Remark = trade.Remark, //备注
  364. TopUserId = TopUserId, //顶级创客
  365. MerUserId = pos.UserId, //商户直属创客
  366. });
  367. if (BankCardType == 1)
  368. {
  369. pos.CreditTrade += TradeAmount;
  370. }
  371. else if (BankCardType == 0)
  372. {
  373. pos.DebitCardTrade += TradeAmount;
  374. }
  375. else if (pos.CreditTrade >= 1000 && pos.ActivationState == 0 && pos.BindingTime > DateTime.Now.AddDays(-20))
  376. {
  377. // pos.IsPurchase = 0;
  378. pos.ActivationState = 1;
  379. pos.ActivationTime = DateTime.Now;
  380. PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
  381. if (merchant != null)
  382. {
  383. merchant.ActiveStatus = 1;
  384. merchant.MerStandardDate = DateTime.Now;
  385. db.SaveChanges();
  386. }
  387. }
  388. db.SaveChanges();
  389. function.WriteLog(trade.Id.ToString(), "补充交易数据");
  390. }
  391. }
  392. }
  393. }
  394. }
  395. spdb.Dispose();
  396. db.Dispose();
  397. return "ok";
  398. }
  399. // public string add100()
  400. // {
  401. // WebCMSEntities db = new WebCMSEntities();
  402. // List<int> uids = new List<int>();
  403. // uids.Add(1053);
  404. // foreach (int uid in uids)
  405. // {
  406. // int ParentUserId = uid;
  407. // int machineCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.PosSnType == 0); //判断是否拥有3台购买机
  408. // int ActiveCount = db.PosMachinesTwo.Count(m => m.UserId == ParentUserId && m.ActivationState == 1); //判断是否拥有3台激活机(不限购买或赠送)
  409. // if (machineCount + ActiveCount >= 3)
  410. // {
  411. // UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == ParentUserId);
  412. // if (account == null)
  413. // {
  414. // account = db.UserAccount.Add(new UserAccount()
  415. // {
  416. // Id = ParentUserId,
  417. // UserId = ParentUserId,
  418. // }).Entity;
  419. // db.SaveChanges();
  420. // }
  421. // decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
  422. // decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
  423. // decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
  424. // account.BalanceAmount += 100;
  425. // account.TotalAmount += 100;
  426. // decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
  427. // decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
  428. // decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
  429. // UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
  430. // {
  431. // CreateDate = DateTime.Now,
  432. // UpdateDate = DateTime.Now,
  433. // UserId = ParentUserId, //创客
  434. // ChangeType = 112, //变动类型
  435. // ChangeAmount = 100, //变更金额
  436. // BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
  437. // AfterTotalAmount = AfterTotalAmount, //变更后总金额
  438. // BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
  439. // AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
  440. // BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
  441. // AfterBalanceAmount = AfterBalanceAmount, //变更后余额
  442. // }).Entity;
  443. // db.SaveChanges();
  444. // RedisDbconn.Instance.Set("UserAccount:" + ParentUserId, account);
  445. // //推荐下单上级获得30天的机具循环天数
  446. // var posList = db.PosMachinesTwo.Select(m => new { m.Id, m.UserId, m.BindingState, m.RecycEndDate }).Where(m => m.UserId == ParentUserId && m.BindingState == 0 && m.RecycEndDate != null).ToList();
  447. // foreach (var subPos in posList)
  448. // {
  449. // PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == subPos.Id);
  450. // if (pos != null)
  451. // {
  452. // pos.RecycEndDate = pos.RecycEndDate.Value.AddDays(30);
  453. // }
  454. // }
  455. // db.SaveChanges();
  456. // }
  457. // }
  458. // db.Dispose();
  459. // return "finish";
  460. // }
  461. //交易不到1000的机具,顶级姓名-代理姓名-客户姓名-客户电话-开机日期-SN // TODO:做到BS后台导出,按绑定时间查
  462. public IActionResult PosTable()
  463. {
  464. WebCMSEntities db = new WebCMSEntities();
  465. List<PosMachinesTwo> poses = db.PosMachinesTwo.Where(m => m.CreditTrade < 1000 && m.BindingState == 1).ToList();
  466. List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
  467. foreach (PosMachinesTwo pos in poses)
  468. {
  469. PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
  470. Users user = db.Users.FirstOrDefault(m => m.Id == pos.UserId) ?? new Users();
  471. Users puser = db.Users.FirstOrDefault(m => m.Id == user.ParentUserId) ?? new Users();
  472. Users ppuser = db.Users.FirstOrDefault(m => m.Id == puser.ParentUserId) ?? new Users();
  473. Dictionary<string, string> item = new Dictionary<string, string>();
  474. string TopRealName = "";
  475. string TopMakerCode = "";
  476. string TopMobile = "";
  477. string ParentNav = user.ParentNav;
  478. if (!string.IsNullOrEmpty(ParentNav))
  479. {
  480. string[] navlist = ParentNav.Trim(',').Replace(",,", ",").Split(',');
  481. if (navlist.Length > 1)
  482. {
  483. int TopId = int.Parse(function.CheckInt(navlist[1]));
  484. Users tuser = db.Users.FirstOrDefault(m => m.Id == TopId) ?? new Users();
  485. TopRealName = tuser.RealName;
  486. TopMakerCode = tuser.MakerCode;
  487. TopMobile = tuser.Mobile;
  488. }
  489. }
  490. item.Add("TopRealName", TopRealName); //顶级姓名
  491. item.Add("TopMakerCode", TopMakerCode); //顶级编号
  492. item.Add("UpUpRealName", ppuser.RealName); //上上级姓名
  493. item.Add("UpRealName", puser.RealName); //上级姓名
  494. item.Add("RealName", user.RealName); //代理姓名
  495. item.Add("MakerCode", user.MakerCode); //代理编号
  496. item.Add("Mobile", user.Mobile); //代理手机号
  497. item.Add("MerchantName", merchant.MerchantName); //客户姓名
  498. item.Add("MerchantMobile", merchant.MerchantMobile); //客户电话
  499. item.Add("OpenTime", pos.BindingTime == null ? "" : pos.BindingTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); //开机日期
  500. item.Add("Sn", pos.PosSn); //SN
  501. list.Add(item);
  502. }
  503. db.Dispose();
  504. ViewBag.list = list;
  505. return View();
  506. }
  507. public string resetall(int k = 0, int b = 1)
  508. {
  509. DataTable dt = dbconn.dtable("select Id from Users where AuthFlag=1");
  510. foreach (DataRow dr in dt.Rows)
  511. {
  512. if (k == 1)
  513. {
  514. reset(int.Parse(dr["Id"].ToString()));
  515. }
  516. else if (k == 2)
  517. {
  518. resetpos(int.Parse(dr["Id"].ToString()), b);
  519. }
  520. }
  521. return "ok";
  522. }
  523. public string reset(int uid)
  524. {
  525. WebCMSEntities db = new WebCMSEntities();
  526. List<Users> users = db.Users.Where(m => m.ParentUserId == uid).OrderByDescending(m => m.AuthDate).ToList();
  527. RedisDbconn.Instance.Clear("MyMakerList:" + uid);
  528. RedisDbconn.Instance.Clear("MyMakerForNotAuth:" + uid);
  529. RedisDbconn.Instance.Clear("TotalUser:" + uid + "*");
  530. RedisDbconn.Instance.Clear("TotalUser:Auth:" + uid);
  531. foreach (Users user in users)
  532. {
  533. RedisDbconn.Instance.AddInt("TotalUser:" + uid);
  534. RedisDbconn.Instance.AddInt("TotalUser:" + uid + ":" + user.CreateDate.Value.ToString("yyyyMM"));
  535. RedisDbconn.Instance.AddInt("TotalUser:" + uid + ":" + user.CreateDate.Value.ToString("yyyyMMdd"));
  536. if (user.AuthFlag == 1)
  537. {
  538. RedisDbconn.Instance.AddList("MyMakerList:" + uid, new MyMakerItem()
  539. {
  540. UserId = user.Id,
  541. RealName = user.RealName,
  542. UserLevel = user.UserLevel,
  543. });
  544. RedisDbconn.Instance.AddInt("TotalUser:Auth:" + uid);
  545. }
  546. else
  547. {
  548. RedisDbconn.Instance.AddList("MyMakerForNotAuth:" + uid, new MyMakerItem()
  549. {
  550. UserId = user.Id,
  551. RealName = user.RealName,
  552. UserLevel = user.UserLevel,
  553. });
  554. RedisDbconn.Instance.AddInt("TotalUser:NoAuth:" + uid);
  555. }
  556. RedisDbconn.Instance.Set("Users:" + user.Id, user);
  557. }
  558. db.Dispose();
  559. return "finish";
  560. }
  561. public string resetpos(int uid, int kind)
  562. {
  563. WebCMSEntities db = new WebCMSEntities();
  564. string IdBrand = uid + "_" + kind;
  565. UserMachineData machineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
  566. if (machineData == null)
  567. {
  568. machineData = db.UserMachineData.Add(new UserMachineData()
  569. {
  570. IdBrand = IdBrand
  571. }).Entity;
  572. db.SaveChanges();
  573. }
  574. machineData.BindCount = db.PosMachinesTwo.Count(m => m.Status > -1 && m.BuyUserId == uid && m.BrandId == kind && m.BindingState == 1);
  575. machineData.UnBindCount = db.PosMachinesTwo.Count(m => m.Status > -1 && m.BuyUserId == uid && m.BrandId == kind && m.BindingState == 0);
  576. machineData.TotalMachineCount = machineData.BindCount + machineData.UnBindCount;
  577. db.SaveChanges();
  578. RedisDbconn.Instance.Set("UserMachineData:" + IdBrand, machineData);
  579. RedisDbconn.Instance.SetExpire("UserMachineData:" + IdBrand, function.get_Random(1800, 5400));
  580. db.Dispose();
  581. return "finish";
  582. }
  583. // 更新分仓库存
  584. public string resetstorestock()
  585. {
  586. WebCMSEntities db = new WebCMSEntities();
  587. DataTable dt = dbconn.dtable("select s.Id,LaveNum,count(p.Id) as CurLaveNum from StoreHouse s left join PosMachinesTwo p on s.Id=p.StoreId and s.BrandId=p.BrandId and p.UserId=0 group by s.Id HAVING LaveNum!=count(p.Id)");
  588. foreach (DataRow dr in dt.Rows)
  589. {
  590. int Id = int.Parse(function.CheckInt(dr["Id"].ToString()));
  591. int CurLaveNum = int.Parse(function.CheckInt(dr["CurLaveNum"].ToString()));
  592. StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
  593. if (store != null)
  594. {
  595. store.LaveNum = CurLaveNum;
  596. db.SaveChanges();
  597. RedisDbconn.Instance.Set("StoreHouse:" + Id, store);
  598. }
  599. }
  600. db.Dispose();
  601. return "ok";
  602. }
  603. public string resetstorestock2(int id)
  604. {
  605. WebCMSEntities db = new WebCMSEntities();
  606. DataTable dt = dbconn.dtable("select Id,LaveNum,(select count(Id) from PosMachinesTwo where StoreId=s.Id and UserId=0) as CurLaveNum from StoreHouse s where Id=" + id);
  607. foreach (DataRow dr in dt.Rows)
  608. {
  609. int Id = int.Parse(function.CheckInt(dr["Id"].ToString()));
  610. int CurLaveNum = int.Parse(function.CheckInt(dr["CurLaveNum"].ToString()));
  611. StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
  612. if (store != null)
  613. {
  614. store.LaveNum = CurLaveNum;
  615. db.SaveChanges();
  616. RedisDbconn.Instance.Set("StoreHouse:" + Id, store);
  617. }
  618. }
  619. db.Dispose();
  620. return "ok";
  621. }
  622. public string chkpwd(string pwd)
  623. {
  624. return function.MD532(pwd);
  625. }
  626. //重置本月团队交易额
  627. public string resetMonthTrade()
  628. {
  629. return "";
  630. }
  631. public string traderecord(int kind, int id = 0)
  632. {
  633. OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
  634. if (kind == 1)
  635. {
  636. OtherMySqlConn.op("delete from TradeRecordTest;insert into TradeRecordTest (Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo) select Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo from TradeRecord order by CreateDate;");
  637. }
  638. else if (kind == 2)
  639. {
  640. OtherMySqlConn.op("delete from TradeRecord where Id<" + id + ";insert into TradeRecord (Id,Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo) select Id,Sort,QueryCount,Status,Version,CreateDate,UpdateDate,CreateMan,UpdateMan,SeoTitle,SeoKeyword,SeoDescription,MerUserId,TopUserId,Remark,BrandId,DirectFlag,CapFlag,QrPayFlag,BankCardType,TradeAmount,TradeSerialNo,ClearDate,TradeDate,SnNo,MerBuddyType,HelpMonthCount,MerHelpFlag,MerNo,MerchantId,UserId,RecordNo from TradeRecordTest order by Id;");
  641. }
  642. // OtherMySqlConn.connstr = ;
  643. return "ok";
  644. }
  645. public string test()
  646. {
  647. string result = "ok";
  648. OtherMySqlConn.connstr = "server=47.109.31.237;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;";
  649. DataTable dt = OtherMySqlConn.dtable("select * from ProfitSubsidyDetail where TradeMonth='202204'");
  650. WebCMSEntities db = new WebCMSEntities();
  651. foreach (DataRow dr in dt.Rows)
  652. {
  653. int BrandId = int.Parse(function.CheckInt(dr["BrandId"].ToString()));
  654. int MerchantId = int.Parse(function.CheckInt(dr["MerchantId"].ToString()));
  655. int SubsidyUserId = int.Parse(function.CheckInt(dr["SubsidyUserId"].ToString()));
  656. int SubsidyType = int.Parse(function.CheckInt(dr["SubsidyType"].ToString()));
  657. ulong MerHelpFlag = ulong.Parse(function.CheckInt(dr["MerHelpFlag"].ToString()));
  658. decimal SubsidyProfitRate = decimal.Parse(function.CheckNum(dr["SubsidyProfitRate"].ToString()));
  659. decimal CreditTradeAmt = decimal.Parse(function.CheckNum(dr["CreditTradeAmt"].ToString()));
  660. decimal QrCreditTradeAmt = decimal.Parse(function.CheckNum(dr["QrCreditTradeAmt"].ToString()));
  661. decimal NonQrCreditTradeAmt = decimal.Parse(function.CheckNum(dr["NonQrCreditTradeAmt"].ToString()));
  662. decimal CreditProfitRate = decimal.Parse(function.CheckNum(dr["CreditProfitRate"].ToString()));
  663. decimal SubsidyProfit = decimal.Parse(function.CheckNum(dr["SubsidyProfit"].ToString()));
  664. string TradeMonth = dr["TradeMonth"].ToString();
  665. string SnNo = dr["SnNo"].ToString();
  666. string MerNo = dr["MerNo"].ToString();
  667. string RecordNo = dr["RecordNo"].ToString();
  668. MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == SnNo) ?? new MachineForSnNo();
  669. PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId) ?? new PosMachinesTwo();
  670. PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == MerchantId) ?? new PosMerchantInfo();
  671. ProfitSubsidyDetail item = db.ProfitSubsidyDetail.FirstOrDefault(m => m.SubsidyUserId == SubsidyUserId && m.TradeMonth == TradeMonth && m.MerchantId == MerchantId && m.SnNo == SnNo);
  672. if (item == null)
  673. {
  674. db.ProfitSubsidyDetail.Add(new ProfitSubsidyDetail()
  675. {
  676. CreateDate = DateTime.Now,
  677. UpdateDate = DateTime.Now,
  678. RecordNo = RecordNo, //流水号
  679. BrandId = BrandId, //品牌
  680. ProductName = RelationClass.GetKqProductBrandInfo(BrandId), //产品名称
  681. TradeMonth = TradeMonth, //交易月份
  682. MerchantId = MerchantId, //商户
  683. MerNo = MerNo, //渠道商户编号
  684. SnNo = SnNo, //渠道SN号
  685. MerRegTime = pos.BindingTime, //渠道注册时间
  686. MerStandardDate = merchant.MerStandardDate, //商户激活时间
  687. BelongUserId = merchant.UserId, //商户归属人
  688. MerHelpFlag = MerHelpFlag, //是否属于扶持周期内商户
  689. SubsidyUserId = SubsidyUserId, //补贴人
  690. SubsidyType = SubsidyType, //分润补贴类型
  691. SubsidyProfitRate = SubsidyProfitRate, //创客活动期内直营商户分润万分之十
  692. CreditTradeAmt = CreditTradeAmt, //商户贷记卡交易总金额
  693. QrCreditTradeAmt = QrCreditTradeAmt, //商户(云闪付)贷记卡交易总金额
  694. NonQrCreditTradeAmt = NonQrCreditTradeAmt, //商户(非云闪付)贷记卡交易总金额
  695. CreditProfitRate = CreditProfitRate, //(非云闪付)贷记卡交易分润比例
  696. SubsidyProfit = SubsidyProfit, //商户(非云闪付)贷记卡交易分润补贴金额
  697. });
  698. // db.SaveChanges();
  699. result += "增加--SubsidyUserId:" + SubsidyUserId + ";SnNo" + SnNo + ";SubsidyProfit" + SubsidyProfit + ";";
  700. }
  701. else
  702. {
  703. if (item.SubsidyProfit < SubsidyProfit)
  704. {
  705. item.SubsidyProfitRate = SubsidyProfitRate; //创客活动期内直营商户分润万分之十
  706. item.SubsidyProfit = SubsidyProfit; //商户(非云闪付)贷记卡交易分润补贴金额
  707. result += "更新--SubsidyUserId:" + SubsidyUserId + ";SnNo" + SnNo + ";SubsidyProfit" + SubsidyProfit + ";";
  708. // db.SaveChanges();
  709. }
  710. }
  711. }
  712. // OtherMySqlConn.connstr = ;
  713. db.Dispose();
  714. return result;
  715. }
  716. public string test2()
  717. {
  718. string result = "ok";
  719. OtherMySqlConn.connstr = "server=47.108.231.170;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;";
  720. DataTable dt = OtherMySqlConn.dtable("select SubsidyUserId,BrandId,sum(SubsidyProfitRate) as SubsidyProfit from ProfitSubsidyDetail where TradeMonth='202204' and SubsidyUserId>0 GROUP BY SubsidyUserId,BrandId");
  721. WebCMSEntities db = new WebCMSEntities();
  722. DateTime checkDate = DateTime.Parse("2022-05-20 00:00:00");
  723. foreach (DataRow dr in dt.Rows)
  724. {
  725. int BrandId = int.Parse(function.CheckInt(dr["BrandId"].ToString()));
  726. int SubsidyUserId = int.Parse(function.CheckInt(dr["SubsidyUserId"].ToString()));
  727. decimal SubsidyProfit = decimal.Parse(function.CheckNum(dr["SubsidyProfit"].ToString()));
  728. UserAccountRecord userAccountRecord = db.UserAccountRecord.FirstOrDefault(m => m.Id > 86538 && m.CreateDate > checkDate && m.UserId == SubsidyUserId && m.ProductType == BrandId && m.ChangeType == 111);
  729. if (userAccountRecord == null)
  730. {
  731. UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == SubsidyUserId);
  732. if (account == null)
  733. {
  734. account = db.UserAccount.Add(new UserAccount()
  735. {
  736. Id = SubsidyUserId,
  737. UserId = SubsidyUserId,
  738. }).Entity;
  739. db.SaveChanges();
  740. }
  741. decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
  742. decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
  743. decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
  744. // account.BalanceAmount += SubsidyProfit;
  745. // account.TotalAmount += SubsidyProfit;
  746. decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
  747. decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
  748. decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
  749. userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
  750. {
  751. CreateDate = DateTime.Now,
  752. UpdateDate = DateTime.Now,
  753. UserId = SubsidyUserId, //创客
  754. ProductType = BrandId,
  755. ChangeType = 111, //变动类型
  756. ChangeAmount = SubsidyProfit, //变更金额
  757. BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
  758. AfterTotalAmount = AfterTotalAmount, //变更后总金额
  759. BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
  760. AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
  761. BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
  762. AfterBalanceAmount = AfterBalanceAmount, //变更后余额
  763. Remark = "直拓商户补贴",
  764. }).Entity;
  765. db.SaveChanges();
  766. }
  767. else
  768. {
  769. userAccountRecord.ChangeAmount = SubsidyProfit;
  770. db.SaveChanges();
  771. }
  772. }
  773. // OtherMySqlConn.connstr = ;
  774. db.Dispose();
  775. return result;
  776. }
  777. public string prize888()
  778. {
  779. WebCMSEntities db = new WebCMSEntities();
  780. OtherMySqlConn.connstr = "server=47.108.231.170;port=3306;user=KxsMainServer;password=Rw2imhXQQt5ODWIF;database=KxsMainServer;charset=utf8;";
  781. List<Users> users = new List<Users>();
  782. string preMonth = "2022-04";
  783. string thisMonth = "2022-05";
  784. string nextMonth = "2022-06";
  785. var orders = db.Orders.Select(m => new { m.UserId, m.TotalPrice, m.Status }).Where(m => m.TotalPrice == 88 && m.Status > 0).ToList();
  786. foreach (var order in orders)
  787. {
  788. int uid = order.UserId;
  789. Users user = db.Users.FirstOrDefault(m => m.Id == order.UserId) ?? new Users();
  790. DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmount) from TradeRecord where CreateDate>='" + preMonth + "-01 00:00:00' and CreateDate<'" + thisMonth + "-01 00:00:00' and UserId in (select Id from Users where ParentNav like '%," + uid + ",%' or Id=" + uid + ")");
  791. if (dt.Rows.Count > 0)
  792. {
  793. user.ActiveRewardAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
  794. }
  795. dt = OtherMySqlConn.dtable("select sum(TradeAmount) from TradeRecord where CreateDate>='" + thisMonth + "-01 00:00:00' and CreateDate<'" + nextMonth + "-01 00:00:00' and UserId in (select Id from Users where ParentNav like '%," + uid + ",%' or Id=" + uid + ")");
  796. if (dt.Rows.Count > 0)
  797. {
  798. user.ProfitRewardRate = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString()));
  799. }
  800. users.Add(user);
  801. }
  802. List<int> gotList = new List<int>();
  803. foreach (Users user in users)
  804. {
  805. decimal preMonthAmt = user.ActiveRewardAmount;
  806. decimal thisMonthAmt = user.ProfitRewardRate;
  807. if (thisMonthAmt >= 2000000 && thisMonthAmt >= preMonthAmt * 2)
  808. {
  809. List<Users> subusers = users.Where(m => m.ParentUserId == user.Id).ToList();
  810. if (subusers.Count > 0)
  811. {
  812. decimal thisMonthAmtSelf = user.ProfitRewardRate;
  813. foreach (Users subuser in subusers)
  814. {
  815. if (subuser.ProfitRewardRate >= 2000000 && subuser.ProfitRewardRate >= subuser.ActiveRewardAmount * 2)
  816. {
  817. thisMonthAmtSelf -= subuser.ProfitRewardRate;
  818. }
  819. }
  820. if (thisMonthAmtSelf >= 2000000 && thisMonthAmtSelf >= preMonthAmt * 2)
  821. {
  822. if (!gotList.Contains(user.Id))
  823. {
  824. function.WriteLog(user.RealName + "--" + user.MakerCode + "--满足条件--上月交易:" + preMonthAmt + "--本月交易:" + thisMonthAmt, "888奖励日志");
  825. gotList.Add(user.Id);
  826. }
  827. }
  828. else
  829. {
  830. function.WriteLog(user.RealName + "--" + user.MakerCode + "--未满足条件--上月交易:" + preMonthAmt + "--本月交易:" + thisMonthAmt, "888奖励日志");
  831. }
  832. }
  833. else
  834. {
  835. if (!gotList.Contains(user.Id))
  836. {
  837. function.WriteLog(user.RealName + "--" + user.MakerCode + "--满足条件--上月交易:" + preMonthAmt + "--本月交易:" + thisMonthAmt, "888奖励日志");
  838. gotList.Add(user.Id);
  839. }
  840. }
  841. }
  842. else
  843. {
  844. function.WriteLog(user.RealName + "--" + user.MakerCode + "--未满足条件--上月交易:" + preMonthAmt + "--本月交易:" + thisMonthAmt, "888奖励日志");
  845. }
  846. }
  847. db.Dispose();
  848. return "ok";
  849. }
  850. // 大盟主标记扫描
  851. public string leaderflag()
  852. {
  853. WebCMSEntities db = new WebCMSEntities();
  854. List<PosCoupons> coupons = db.PosCoupons.Where(m => m.LeaderUserId > 0 && m.IsUse == 1).ToList();
  855. foreach (PosCoupons coupon in coupons)
  856. {
  857. MachineApply apply = db.MachineApply.FirstOrDefault(m => m.SwapSnExpand.Contains(coupon.ExchangeCode));
  858. if(apply != null)
  859. {
  860. Orders order = db.Orders.FirstOrDefault(m => m.Id == apply.QueryCount);
  861. if(order != null)
  862. {
  863. if(!string.IsNullOrEmpty(order.SnNos))
  864. {
  865. string[] SwapSnExpands = order.SnNos.TrimEnd('\n').Split('\n');
  866. foreach(string no in SwapSnExpands)
  867. {
  868. ChildNo(db, no, coupon.LeaderUserId);
  869. }
  870. }
  871. }
  872. }
  873. }
  874. db.SaveChanges();
  875. db.Dispose();
  876. return "ok";
  877. }
  878. List<string> nos = new List<string>();
  879. private void ChildNo(WebCMSEntities db, string CheckNo, int LeaderUserId)
  880. {
  881. MachineApply apply = db.MachineApply.FirstOrDefault(m => m.SwapSnExpand.Contains(CheckNo));
  882. if(apply != null)
  883. {
  884. Orders order = db.Orders.FirstOrDefault(m => m.Id == apply.QueryCount);
  885. if(order != null)
  886. {
  887. if(!string.IsNullOrEmpty(order.SnNos))
  888. {
  889. string[] SwapSnExpands = order.SnNos.TrimEnd('\n').Split('\n');
  890. foreach(string no in SwapSnExpands)
  891. {
  892. ChildNo(db, no, LeaderUserId);
  893. }
  894. }
  895. else
  896. {
  897. MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == CheckNo) ?? new MachineForSnNo();
  898. PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m=>m.Id == forSnNo.SnId);
  899. if(pos != null)
  900. {
  901. pos.LeaderUserId = LeaderUserId;
  902. Library.function.WriteLog(LeaderUserId + ":" + pos.PosSn + ":" + apply.SwapSnExpand.TrimEnd('\n').Split('\n').Length, "大盟主奖励标记机具");
  903. }
  904. }
  905. }
  906. }
  907. else
  908. {
  909. MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == CheckNo) ?? new MachineForSnNo();
  910. PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m=>m.Id == forSnNo.SnId);
  911. if(pos != null)
  912. {
  913. pos.LeaderUserId = LeaderUserId;
  914. Library.function.WriteLog(LeaderUserId + ":" + pos.PosSn, "大盟主奖励标记机具");
  915. }
  916. }
  917. }
  918. // 重置盛付通多余交易的创客
  919. public string resetsftmore()
  920. {
  921. List<int> uids = new List<int>();
  922. uids.Add(124462);
  923. uids.Add(2502);
  924. uids.Add(3745);
  925. uids.Add(4328);
  926. uids.Add(121845);
  927. uids.Add(130602);
  928. uids.Add(1056);
  929. uids.Add(121168);
  930. uids.Add(13411);
  931. uids.Add(130577);
  932. uids.Add(236);
  933. uids.Add(3885);
  934. uids.Add(130952);
  935. uids.Add(59192);
  936. uids.Add(130921);
  937. uids.Add(123676);
  938. uids.Add(130455);
  939. uids.Add(123782);
  940. uids.Add(131043);
  941. uids.Add(129545);
  942. uids.Add(125816);
  943. uids.Add(54293);
  944. uids.Add(122904);
  945. uids.Add(128513);
  946. uids.Add(6764);
  947. uids.Add(23075);
  948. uids.Add(121415);
  949. uids.Add(128049);
  950. uids.Add(200);
  951. uids.Add(23459);
  952. uids.Add(131113);
  953. uids.Add(70313);
  954. uids.Add(131085);
  955. uids.Add(122361);
  956. uids.Add(123537);
  957. uids.Add(128360);
  958. uids.Add(128691);
  959. uids.Add(9702);
  960. uids.Add(121749);
  961. uids.Add(128086);
  962. uids.Add(130933);
  963. uids.Add(131134);
  964. uids.Add(54550);
  965. uids.Add(122043);
  966. uids.Add(1893);
  967. uids.Add(120965);
  968. uids.Add(4696);
  969. uids.Add(122211);
  970. uids.Add(129466);
  971. uids.Add(131275);
  972. uids.Add(51704);
  973. uids.Add(99807);
  974. uids.Add(124154);
  975. uids.Add(203);
  976. uids.Add(36608);
  977. uids.Add(131126);
  978. uids.Add(75269);
  979. uids.Add(129565);
  980. uids.Add(131130);
  981. uids.Add(33532);
  982. uids.Add(130144);
  983. uids.Add(131316);
  984. uids.Add(131039);
  985. uids.Add(130206);
  986. uids.Add(121364);
  987. uids.Add(32898);
  988. uids.Add(120664);
  989. uids.Add(131229);
  990. uids.Add(76236);
  991. uids.Add(124642);
  992. uids.Add(126131);
  993. uids.Add(127858);
  994. uids.Add(515);
  995. uids.Add(40717);
  996. uids.Add(129457);
  997. uids.Add(127543);
  998. uids.Add(120614);
  999. uids.Add(126802);
  1000. uids.Add(191);
  1001. List<int> mids = new List<int>();
  1002. mids.Add(23501);
  1003. mids.Add(28905);
  1004. mids.Add(28913);
  1005. mids.Add(29376);
  1006. mids.Add(29397);
  1007. mids.Add(29788);
  1008. mids.Add(29837);
  1009. mids.Add(29886);
  1010. mids.Add(29738);
  1011. mids.Add(29923);
  1012. mids.Add(29953);
  1013. mids.Add(29978);
  1014. mids.Add(29985);
  1015. mids.Add(29968);
  1016. mids.Add(30036);
  1017. mids.Add(30054);
  1018. mids.Add(30170);
  1019. mids.Add(30224);
  1020. mids.Add(30296);
  1021. mids.Add(30353);
  1022. mids.Add(30352);
  1023. mids.Add(29457);
  1024. mids.Add(30332);
  1025. mids.Add(30406);
  1026. mids.Add(30058);
  1027. mids.Add(30434);
  1028. mids.Add(30454);
  1029. mids.Add(30417);
  1030. mids.Add(30468);
  1031. mids.Add(30483);
  1032. mids.Add(30486);
  1033. mids.Add(30522);
  1034. mids.Add(30530);
  1035. mids.Add(30447);
  1036. mids.Add(30583);
  1037. mids.Add(30161);
  1038. mids.Add(30630);
  1039. mids.Add(30649);
  1040. mids.Add(30593);
  1041. mids.Add(30702);
  1042. mids.Add(30707);
  1043. mids.Add(30711);
  1044. mids.Add(30700);
  1045. mids.Add(30752);
  1046. mids.Add(30774);
  1047. mids.Add(30646);
  1048. mids.Add(30806);
  1049. mids.Add(30269);
  1050. mids.Add(30819);
  1051. mids.Add(30824);
  1052. mids.Add(30836);
  1053. mids.Add(30796);
  1054. mids.Add(30883);
  1055. mids.Add(30900);
  1056. mids.Add(30921);
  1057. mids.Add(30925);
  1058. mids.Add(29449);
  1059. mids.Add(30948);
  1060. mids.Add(30967);
  1061. mids.Add(30742);
  1062. mids.Add(30658);
  1063. mids.Add(31033);
  1064. mids.Add(31032);
  1065. mids.Add(31055);
  1066. mids.Add(30557);
  1067. mids.Add(31102);
  1068. mids.Add(31116);
  1069. mids.Add(30680);
  1070. mids.Add(31140);
  1071. mids.Add(31155);
  1072. mids.Add(30735);
  1073. mids.Add(31171);
  1074. mids.Add(31223);
  1075. mids.Add(31170);
  1076. mids.Add(31274);
  1077. mids.Add(31284);
  1078. mids.Add(31303);
  1079. mids.Add(31317);
  1080. mids.Add(31290);
  1081. mids.Add(31353);
  1082. mids.Add(31372);
  1083. mids.Add(31358);
  1084. mids.Add(31373);
  1085. mids.Add(31424);
  1086. mids.Add(31217);
  1087. mids.Add(31462);
  1088. mids.Add(31466);
  1089. mids.Add(31463);
  1090. mids.Add(31482);
  1091. mids.Add(30246);
  1092. mids.Add(29440);
  1093. mids.Add(30474);
  1094. mids.Add(30655);
  1095. mids.Add(31533);
  1096. mids.Add(31534);
  1097. mids.Add(31589);
  1098. mids.Add(30265);
  1099. mids.Add(31047);
  1100. mids.Add(31643);
  1101. mids.Add(31670);
  1102. mids.Add(31688);
  1103. List<string> dates = new List<string>();
  1104. dates.Add("2022-06-14 00:00:00,2022-06-15 00:00:00");
  1105. dates.Add("2022-06-15 00:00:00,2022-06-16 00:00:00");
  1106. dates.Add("2022-06-16 00:00:00,2022-06-17 00:00:00");
  1107. dates.Add("2022-06-17 00:00:00,2022-06-18 00:00:00");
  1108. dates.Add("2022-06-18 00:00:00,2022-06-19 00:00:00");
  1109. dates.Add("2022-06-19 00:00:00,2022-06-20 00:00:00");
  1110. dates.Add("2022-06-20 00:00:00,2022-06-21 00:00:00");
  1111. foreach(int UserId in uids)
  1112. {
  1113. foreach(string date in dates)
  1114. {
  1115. string[] datelist = date.Split(',');
  1116. RedisDbconn.Instance.AddList("ResetUserTradeQueue", UserId + "#cut#" + datelist[0] + "#cut#" + datelist[1] + "#cut#7");
  1117. }
  1118. }
  1119. foreach(int MerchantId in mids)
  1120. {
  1121. foreach(string date in dates)
  1122. {
  1123. string[] datelist = date.Split(',');
  1124. RedisDbconn.Instance.AddList("ResetMerchantTradeQueue", MerchantId + "#cut#" + datelist[0] + "#cut#" + datelist[1]);
  1125. }
  1126. }
  1127. return "ok";
  1128. }
  1129. }
  1130. }