From 286ebcbbfbb2481ac5507341245dd1207774c4a0 Mon Sep 17 00:00:00 2001
From: LR-20210131IOQH\Administrator <jackcold@163.com>
Date: 星期五, 25 六月 2021 11:11:50 +0800
Subject: [PATCH] sql表更新
---
zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs | 85 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 82 insertions(+), 3 deletions(-)
diff --git a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs
index bedb534..94534d1 100644
--- a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs
@@ -11,6 +11,7 @@
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json.Linq;
using System.Transactions;
+using System.Runtime.InteropServices;
namespace zhengcaioa.Controllers.AdmManagement
{
@@ -85,12 +86,88 @@
/// <param name="signinType">10鏃╀笂涓婄彮 11鏃╀笂涓嬬彮 20涓嬪崍涓婄彮 21涓嬪崍涓嬬彮 30鍔犵彮涓婄彮 31鍔犵彮涓嬬彮</param>
/// <returns></returns>
[CheckLogin]
- public string Save(string id,int signinType)
- {
- ResultEntity resultEntity = _signinService.save(id, signinType);
+ public string Save(string id,int signinType,string mac)
+ {
+ ResultEntity resultEntity = new ResultEntity();
+ resultEntity.Result = false;
+ try
+ {
+ if (string.IsNullOrEmpty(mac))
+ {
+ resultEntity = _signinService.save(id, signinType);
+ }
+ else
+ {
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ if(curentuser.IpMac == mac)
+ {
+ //var mac = GetClientMAC(GetClientIP());
+
+ }
+ else
+ {
+ resultEntity.Message = "鎵撳崱鐢佃剳妫�鏌ヤ笉鍖归厤銆�";
+ }
+ }
+ }
+ catch(Exception er)
+ { }
return JsonConvert.SerializeObject(resultEntity);
}
+
+ [DllImport("Iphlpapi.dll")]
+ private static extern int SendARP(Int32 dest, Int32 host, ref Int64 mac, ref Int32 length);
+
+ [DllImport("Ws2_32.dll")]
+ private static extern Int32 inet_addr(string ip);
+
+ private string GetClientIP()
+ {
+ HttpContextAccessor context = new HttpContextAccessor();
+ var ip = context.HttpContext?.Connection.RemoteIpAddress.ToString();
+ var mac = GetClientMAC(ip);
+ var str = "IP:" + ip + " 锛孧AC:" + mac;
+ return str;
+ }
+
+ private string GetClientMAC(string ip)
+ {
+ string mac_dest = string.Empty;
+ try
+ {
+ Int32 ldest = inet_addr(ip); //鐩殑鍦扮殑ip
+ Int32 lhost = inet_addr(""); //鏈嶅姟鍣ㄧ殑ip
+ Int64 macinfo = new Int64();
+ Int32 len = 6;
+ int res = SendARP(ldest, 0, ref macinfo, ref len);
+ string mac_src = macinfo.ToString("X");
+ while (mac_src.Length < 12)
+ {
+ mac_src = mac_src.Insert(0, "0");
+ }
+ for (int i = 0; i < 11; i++)
+ {
+ if (0 == (i % 2))
+ {
+ if (i == 10)
+ {
+ mac_dest = mac_dest.Insert(0, mac_src.Substring(i, 2));
+ }
+ else
+ {
+ mac_dest = "-" + mac_dest.Insert(0, mac_src.Substring(i, 2));
+ }
+
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return mac_dest;
+ }
/// <summary>
/// 鍙栧緱浠婂ぉ绛惧埌淇℃伅
@@ -749,6 +826,8 @@
ViewData["curentuser"] = curentuser;
using (TransactionScope scope = new TransactionScope())
{
+ dto.FullAttendance = 0;
+ dto.AbsenteeismPayment2 = 0;
dto.RecStatus = "A";
if (String.IsNullOrEmpty(dto.Id))
{
--
Gitblit v1.9.1