|
@@ -148,34 +148,37 @@ namespace TEAMModelOS.Controllers
|
|
|
#endif
|
|
|
public async Task<IActionResult> GetTeacherInfo(JsonElement json)
|
|
|
{
|
|
|
- string head_lang = "";
|
|
|
-
|
|
|
- if (HttpContext.Request.Headers.TryGetValue("lang", out var _lang))
|
|
|
- {
|
|
|
- head_lang = $"{_lang}";
|
|
|
- }
|
|
|
- if (!json.TryGetProperty("code", out JsonElement _code)) return BadRequest("code is null");
|
|
|
- var phoneInfo = await GetWeChatPhoneNumber(_code.ToString());
|
|
|
- if (phoneInfo.code==200)
|
|
|
- {
|
|
|
- string _mobile = phoneInfo.phone.phoneNumber;
|
|
|
- var coreUser = await _coreAPIHttpService.GetUserInfo(new Dictionary<string, string> { { "key", $"{_mobile}" } }, _option.Location, _configuration);
|
|
|
- if (coreUser != null && coreUser.id != null)
|
|
|
+ try {
|
|
|
+ string head_lang = "";
|
|
|
+ if (HttpContext.Request.Headers.TryGetValue("lang", out var _lang))
|
|
|
{
|
|
|
- (string ip, string region) = await LoginService.LoginIp(HttpContext, _searcher);
|
|
|
- Teacher teacher = null;
|
|
|
- TeacherInfo teacherInfo = await TeacherService.TeacherInfo(_azureCosmos, teacher, $"{coreUser.name}", $"{coreUser.picture}", coreUser.id, _azureStorage, _option, _azureRedis, ip, _httpTrigger, $"{_lang}");
|
|
|
- return Ok(new
|
|
|
+ head_lang = $"{_lang}";
|
|
|
+ }
|
|
|
+ if (!json.TryGetProperty("code", out JsonElement _code)) return BadRequest("code is null");
|
|
|
+ var phoneInfo = await GetWeChatPhoneNumber(_code.ToString());
|
|
|
+ //phoneInfo.code=200;
|
|
|
+ if (phoneInfo.code==200)
|
|
|
+ {
|
|
|
+ string _mobile = phoneInfo.phone.phoneNumber;
|
|
|
+ //string _mobile = "18281911681";
|
|
|
+ var coreUser = await _coreAPIHttpService.GetUserInfo(new Dictionary<string, string> { { "key", $"{_mobile}" } }, _option.Location, _configuration);
|
|
|
+ if (coreUser != null && coreUser.id != null)
|
|
|
{
|
|
|
- teacherInfo.auth_token,
|
|
|
- teacherInfo.blob_uri,
|
|
|
- teacherInfo.blob_sas,
|
|
|
- teacherInfo.schools,
|
|
|
- teacherInfo.defaultschool,
|
|
|
- });
|
|
|
+ (string ip, string region) = await LoginService.LoginIp(HttpContext, _searcher);
|
|
|
+ Teacher teacher = null;
|
|
|
+ TeacherInfo teacherInfo = await TeacherService.TeacherInfo(_azureCosmos, teacher, $"{coreUser.name}", $"{coreUser.picture}", coreUser.id, _azureStorage, _option, _azureRedis, ip, _httpTrigger, $"{_lang}");
|
|
|
+ return Ok(new
|
|
|
+ {
|
|
|
+ teacherInfo.auth_token,
|
|
|
+ teacherInfo.blob_uri,
|
|
|
+ teacherInfo.blob_sas,
|
|
|
+ teacherInfo.schools,
|
|
|
+ teacherInfo.defaultschool,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else return Ok(new { state = 404, msg = "未找到关联账号" });
|
|
|
}
|
|
|
- else return Ok(new { state = 404, msg = "未找到关联账号" });
|
|
|
- }
|
|
|
+ } catch (Exception ex) { }
|
|
|
return Ok();
|
|
|
}
|
|
|
/// <summary>
|