123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- 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 Library;
- 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 makerSn()
- {
- WebCMSEntities db = new WebCMSEntities();
- for (int i = 1; i <= 200; i++)
- {
- string EndNo = i.ToString();
- for (int j = 0; j < 6 - i.ToString().Length; j++)
- {
- EndNo = "0" + EndNo;
- }
- string PosSn = "KXS01220300102" + EndNo;
- db.PosMachinesTwo.Add(new PosMachinesTwo()
- {
- CreateDate = DateTime.Now,
- StoreId = 1,
- SourceStoreId = 1,
- SourcePosSn = PosSn,
- PosSn = PosSn,
- });
- db.SaveChanges();
- }
- db.Dispose();
- return "ok";
- }
- public string test()
- {
- // DataTable dt = CustomerSqlConn.dtable("select UserId,sum(ProfitAmount) from ProfitRecord where UserId>0 group by UserId", MysqlConn.connstr);
- // int index = 0;
- // WebCMSEntities db = new WebCMSEntities();
- // foreach (DataRow dr in dt.Rows)
- // {
- // index += 1;
- // int UserId = int.Parse(dr["UserId"].ToString());
- // decimal ProfitMoney = decimal.Parse(dr[1].ToString());
- // try
- // {
- // string IdBrand = UserId + "_0";
- // UserMachineData MachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
- // if (MachineData == null)
- // {
- // MachineData = db.UserMachineData.Add(new UserMachineData()
- // {
- // IdBrand = IdBrand,
- // }).Entity;
- // db.SaveChanges();
- // }
- // MachineData.TradeProfit = ProfitMoney;
- // db.SaveChanges();
- // }
- // catch (Exception ex)
- // {
- // function.WriteLog(DateTime.Now.ToString() + "\n" + UserId + "," + ProfitMoney + "\n" + ex.ToString(), "同步到余额异常");
- // }
- // function.WriteLog(index.ToString(), "同步分润数据");
- // }
- // db.Dispose();
- return "ok";
- }
- public string profit(int t = 0)
- {
- string date = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
- string OpTypeString = "";
- if (t > 0)
- {
- OpTypeString += "-" + t;
- }
- string check = function.ReadInstance("/Balance/1/" + date + OpTypeString + ".txt");
- if (string.IsNullOrEmpty(check))
- {
- function.WritePage("/Balance/1/", date + OpTypeString + ".txt", DateTime.Now.ToString());
- RedisDbconn.Instance.AddList("SycnProfitQueue2", "1#cut#" + date + "#cut#" + t + "#cut#系统");
- return "success";
- }
- return date + "分润已同步,请勿重复操作";
- }
- }
- }
|