|
@@ -48,6 +48,7 @@ using TEAMModelOS.Services;
|
|
|
using static TEAMModelOS.Controllers.Client.HiTAControlller;
|
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
|
using System.Net.Http.Json;
|
|
|
+using System.ServiceModel.Channels;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
|
{
|
|
@@ -422,20 +423,20 @@ namespace TEAMModelOS.Controllers
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpPost("qrcode/login")]
|
|
|
//[Authorize(Roles = "HiTA")]
|
|
|
- public async Task<IActionResult> SchoolJoin(QRCodeLoginCheck join)
|
|
|
+ public async Task<IActionResult> QRCodeLogin(QRCodeLoginCheck join)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- Dictionary<string, object> dict = new Dictionary<string, object>();
|
|
|
- Dictionary<string, object> qure = new Dictionary<string, object>();
|
|
|
- foreach (var a in HttpContext.Request.Query)
|
|
|
- {
|
|
|
- qure.Add(a.Key, a.Value);
|
|
|
- }
|
|
|
- foreach (var a in HttpContext.Request.Headers)
|
|
|
- {
|
|
|
- dict.Add(a.Key, a.Value);
|
|
|
- }
|
|
|
+ //Dictionary<string, object> dict = new Dictionary<string, object>();
|
|
|
+ //Dictionary<string, object> qure = new Dictionary<string, object>();
|
|
|
+ //foreach (var a in HttpContext.Request.Query)
|
|
|
+ //{
|
|
|
+ // qure.Add(a.Key, a.Value);
|
|
|
+ //}
|
|
|
+ //foreach (var a in HttpContext.Request.Headers)
|
|
|
+ //{
|
|
|
+ // dict.Add(a.Key, a.Value);
|
|
|
+ //}
|
|
|
//await _dingDing.SendBotMsg(join.ToJsonString()+ dict.ToJsonString(), GroupNames.成都开发測試群組);
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(join.id_token) && !string.IsNullOrWhiteSpace(join.randomcode) && join.randomcode.StartsWith("Login:"))
|
|
@@ -443,10 +444,20 @@ namespace TEAMModelOS.Controllers
|
|
|
var jwt = new JwtSecurityToken(join.id_token);
|
|
|
//await _dingDing.SendBotMsg(join.ToJsonString(), GroupNames.成都开发測試群組);
|
|
|
var id = jwt.Payload.Sub;
|
|
|
- await _azureRedis.GetRedisClient(8).StringSetAsync($"HiTA:{join.randomcode}", id, expiry: new TimeSpan(0, 0, 30));
|
|
|
+ jwt.Payload.TryGetValue("name", out object name);
|
|
|
+ jwt.Payload.TryGetValue("picture", out object picture);
|
|
|
+ jwt.Payload.TryGetValue("lang", out object _jwtlang);
|
|
|
+ await _azureRedis.GetRedisClient(8).StringSetAsync($"HiTA:{join.randomcode}", id, expiry: new TimeSpan(0, 5, 0));
|
|
|
try {
|
|
|
- await _httpClientFactory.CreateClient().PostAsJsonAsync($"https://www.winteach.cn/third/ies/qrcode-login-notify", new { randomcode = join.randomcode,tmdid=id});
|
|
|
- } catch (Exception ex) { }
|
|
|
+ var data= new { randomcode = join.randomcode, tmdid = id,tmdname= $"{name}", picture= $"{picture}",lang= $"{_jwtlang}", dingding = "1" };
|
|
|
+ if (join.randomcode.Contains("ExamServer"))
|
|
|
+ {
|
|
|
+ await _httpClientFactory.CreateClient().PostAsJsonAsync($"https://www.winteach.cn/third/ies/qrcode-login-notify", data);
|
|
|
+ }
|
|
|
+ // await _dingDing.SendBotMsg($"扫码登录转发通知{join.ToJsonString()},{data.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ await _dingDing.SendBotMsg($"处理钉钉异常信息{ex.StackTrace},{ex.Message}", GroupNames.成都开发測試群組);
|
|
|
+ }
|
|
|
return Ok(new { msg = "关闭弹窗以获取登录信息" ,code=200});
|
|
|
}
|
|
|
else { return Ok(new { code = 400, msg = $"参数错误{join.ToJsonString()}" }); }
|