123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Data;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Logging;
- using MySystem.Models;
- using System.Threading;
- using Library;
- using LitJson;
- namespace MySystem.Controllers
- {
- public class HomeController : Controller
- {
- private readonly ILogger<HomeController> _logger;
- public HomeController(ILogger<HomeController> logger)
- {
- _logger = logger;
- }
- public IActionResult Index()
- {
- return View();
- }
- public IActionResult Error()
- {
- string isapi = Request.Headers["Api"].ToString();
- if (isapi != "1")
- {
- if (Response.StatusCode == 500)
- {
- return Redirect("/public/errpage/pc/500.html");
- }
- else if (Response.StatusCode == 502)
- {
- return Redirect("/public/errpage/pc/502.html");
- }
- else if (Response.StatusCode == 404)
- {
- return Redirect("/public/errpage/pc/404.html");
- }
- }
- return View();
- }
- public string test(int id = 0)
- {
- string txt = "ok";
-
-
- WebCMSEntities db = new WebCMSEntities();
- List<int> oids = new List<int>();
- if(id > 0)
- {
- oids.Add(id);
- }
- else
- {
- oids.Add(15);
- oids.Add(16);
- oids.Add(17);
- oids.Add(18);
- oids.Add(19);
- oids.Add(20);
- }
- foreach(int oid in oids)
- {
- ConsumerOrders order = db.ConsumerOrders.FirstOrDefault(m => m.Id == oid);
- if(order != null)
- {
- RedisDbconn.Instance.AddList("ConsumerOrders:Divi:2:List", order.Id.ToString());
-
- }
- }
- db.Dispose();
- return txt;
- }
- public string testAlipay()
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
- List<string> ordernos = new List<string>();
- ordernos.Add("2023100319505443423678128");
- WebCMSEntities db = new WebCMSEntities();
- List<ConsumerOrders> orders = db.ConsumerOrders.Where(m => ordernos.Contains(m.OrderNo)).OrderBy(m => m.Id).ToList();
- foreach(ConsumerOrders order in orders)
- {
- MerchantInfo merchant = db.MerchantInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantInfo();
- MerchantParamSet set = db.MerchantParamSet.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantParamSet();
- if(order.IsAct == 1 && order.PayMoney >= set.MinPayMoney)
- {
- MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == order.MerchantId) ?? new MerchantAddInfo();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(merchant.Version == 0)
- {
- WeChatFunction.Instance.AddReceive(merchantAdd.SubMchid, "MERCHANT_ID", WeChatFunction.Instance.MchId, WeChatFunction.Instance.MchName, "PARTNER");
- merchant.Version = 1;
- db.SaveChanges();
- }
-
- decimal fee = order.PayMoney;
- if(fee >= 1)
- {
- string TradeNo = order.SeoTitle;
- string OrderNo = order.OrderNo;
- List<ReceiverList> Receivers = new List<ReceiverList>();
- Receivers.Add(new ReceiverList()
- {
- type = "MERCHANT_ID",
- account = WeChatFunction.Instance.MchId,
- amount = int.Parse(fee.ToString("f0")),
- description = "服务费",
- });
- WeChatFunction.Instance.ProfitShare(merchantAdd.SubMchid, TradeNo, OrderNo, Receivers);
-
- Dictionary<string, object> req = new Dictionary<string, object>();
- req.Add("SubMchid", merchantAdd.SubMchid);
- req.Add("TradeNo", TradeNo);
- req.Add("OrderNo", OrderNo);
- RedisDbconn.Instance.AddList("ProfitShareQueue", Newtonsoft.Json.JsonConvert.SerializeObject(req));
- }
- }
- }
- db.Dispose();
- return "ok";
- }
- public string test1()
- {
-
- List<string> list = new List<string>();
- list.Add("LKB01230900199998516");
- WebCMSEntities db = new WebCMSEntities();
- foreach(string sub in list)
- {
- bool op = db.PosMachinesTwo.Any(m => m.PosSn == sub);
- if(!op)
- {
-
- db.PosMachinesTwo.Add(new PosMachinesTwo()
- {
- CreateDate = DateTime.Now,
- SourceStoreId = 2,
- StoreId = 2,
- PosSn = sub,
- SourcePosSn = sub,
- });
- db.SaveChanges();
- }
- }
- db.Dispose();
- return "ok";
- }
-
- }
- }
|