|
@@ -166,14 +166,14 @@ namespace TEAMModelOS.Controllers
|
|
//phoneInfo.code=200;
|
|
//phoneInfo.code=200;
|
|
if (phoneInfo.code==200)
|
|
if (phoneInfo.code==200)
|
|
{
|
|
{
|
|
- string _mobile = phoneInfo.phone.phoneNumber;
|
|
|
|
- //string _mobile = "18281911681";
|
|
|
|
|
|
+ // string _mobile = phoneInfo.phone.phoneNumber;
|
|
|
|
+ string _mobile = "13880505117";
|
|
var coreUser = await _coreAPIHttpService.GetUserInfo(new Dictionary<string, string> { { "key", $"{_mobile}" } }, _option.Location, _configuration);
|
|
var coreUser = await _coreAPIHttpService.GetUserInfo(new Dictionary<string, string> { { "key", $"{_mobile}" } }, _option.Location, _configuration);
|
|
if (coreUser != null && coreUser.id != null)
|
|
if (coreUser != null && coreUser.id != null)
|
|
{
|
|
{
|
|
(string ip, string region) = await LoginService.LoginIp(HttpContext, _searcher);
|
|
(string ip, string region) = await LoginService.LoginIp(HttpContext, _searcher);
|
|
Teacher teacher = null;
|
|
Teacher teacher = null;
|
|
- TeacherInfo teacherInfo = await TeacherService.TeacherInfo(_azureCosmos, teacher, $"{coreUser.name}", $"{coreUser.picture}", coreUser.id, _azureStorage, _option, _azureRedis, ip, _httpTrigger, $"{_lang}",timezone);
|
|
|
|
|
|
+ TeacherInfo teacherInfo = await TeacherService.TeacherInfo(_azureCosmos, teacher, $"{coreUser.name}", $"{coreUser.picture}", coreUser.id, _azureStorage, _option, _azureRedis, ip, _httpTrigger, $"{_lang}", timezone);
|
|
return Ok(new
|
|
return Ok(new
|
|
{
|
|
{
|
|
teacherInfo.auth_token,
|
|
teacherInfo.auth_token,
|
|
@@ -185,8 +185,13 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
else return Ok(new { state = 404, msg = "未找到关联账号" });
|
|
else return Ok(new { state = 404, msg = "未找到关联账号" });
|
|
}
|
|
}
|
|
- } catch (Exception ex) { }
|
|
|
|
- return Ok();
|
|
|
|
|
|
+ else {
|
|
|
|
+ return Ok(new { state = phoneInfo.code, msg = phoneInfo.msg });
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return Ok(new { state = 500, msg = ex.Message });
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 获取学校信息
|
|
/// 获取学校信息
|
|
@@ -925,7 +930,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- return BadRequest("手机授权码过期!");
|
|
|
|
|
|
+ return BadRequest($"手机授权码过期!{phoneInfo.code},{phoneInfo.msg}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
@@ -1334,7 +1339,7 @@ namespace TEAMModelOS.Controllers
|
|
yield return (code, value);
|
|
yield return (code, value);
|
|
}
|
|
}
|
|
|
|
|
|
- private async Task<(int code, WeChatPhone phone)> GetWeChatPhoneNumber(string phoneCode)
|
|
|
|
|
|
+ private async Task<(int code, WeChatPhone phone,string msg )> GetWeChatPhoneNumber(string phoneCode)
|
|
{
|
|
{
|
|
var wxappid = _configuration.GetValue<string>("HaBookAuth:WXMiniAPP:appid");
|
|
var wxappid = _configuration.GetValue<string>("HaBookAuth:WXMiniAPP:appid");
|
|
var wxsecret = _configuration.GetValue<string>("HaBookAuth:WXMiniAPP:secret");
|
|
var wxsecret = _configuration.GetValue<string>("HaBookAuth:WXMiniAPP:secret");
|
|
@@ -1350,7 +1355,8 @@ namespace TEAMModelOS.Controllers
|
|
HttpContent contentPhone = new StringContent(dict.ToJsonString(), Encoding.UTF8, "application/json");
|
|
HttpContent contentPhone = new StringContent(dict.ToJsonString(), Encoding.UTF8, "application/json");
|
|
var httpResponse = await _httpClient.CreateClient().PostAsync(url, contentPhone);
|
|
var httpResponse = await _httpClient.CreateClient().PostAsync(url, contentPhone);
|
|
WeChatPhone phone = null;
|
|
WeChatPhone phone = null;
|
|
- int code = 200;
|
|
|
|
|
|
+ int code = 200;
|
|
|
|
+ string msg = "";
|
|
if (httpResponse.StatusCode == HttpStatusCode.OK)
|
|
if (httpResponse.StatusCode == HttpStatusCode.OK)
|
|
{
|
|
{
|
|
string responseContent = await httpResponse.Content.ReadAsStringAsync();
|
|
string responseContent = await httpResponse.Content.ReadAsStringAsync();
|
|
@@ -1359,16 +1365,21 @@ namespace TEAMModelOS.Controllers
|
|
if (phone==null)
|
|
if (phone==null)
|
|
{
|
|
{
|
|
code = 404;
|
|
code = 404;
|
|
|
|
+ msg=$"{responseContent}";
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ code = 200;msg=$"{responseContent}";
|
|
}
|
|
}
|
|
- else { code = 200; }
|
|
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
//微信找到。
|
|
//微信找到。
|
|
code = 404;
|
|
code = 404;
|
|
|
|
+ msg= await httpResponse.Content.ReadAsStringAsync();
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- return (code, phone);
|
|
|
|
|
|
+ return (code, phone, msg);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|