develop
old易 2024-10-08 11:54:25 +08:00
parent 052f19a6fd
commit 6fe253bd11
2 changed files with 29 additions and 16 deletions

View File

@ -43,7 +43,16 @@ namespace New_College.Controllers
var response = new CasDoorToken();
string jwtStr = string.Empty;
bool suc = false;
var userinfo = CasdoorHttpHelper.Http_Post<JWTSSOResult<MinProWxOutPut>>("/api/syswechat/user_info", null,
if (String.IsNullOrWhiteSpace(code))
{
return new MessageModel<CasDoorToken>()
{
success = false,
msg = "参数错误",
response = response
};
}
var userinfo = CasdoorHttpHelper.Http_Post<JWTSSOResult<MinProWxOutPut>>("api/syswechat/user_info", null,
new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(
new CasdoorRequest()
{
@ -55,7 +64,7 @@ namespace New_College.Controllers
if (userinfo != null && userinfo.code == 200 && userinfo.type == "success")
{
var user = (await _CustomerInfoServices.Query(q => q.UUID == userinfo.result.UnionId)).FirstOrDefault();
if (user != null)
if (user == null)
{
//没有用户则注册一个新用户
user = new Model.Models.V_CustomerInfo()
@ -80,6 +89,10 @@ namespace New_College.Controllers
{
user.GZOpenId = userinfo.result.OpenId;
user.ModifyTime = DateTime.UtcNow;
if (!string.IsNullOrEmpty(userinfo.result.Mobile)&&string.IsNullOrEmpty(user.Phone))
{
user.Phone = userinfo.result.Mobile;
}
await _CustomerInfoServices.Update(user);
}
var tokenModel = new SSOTokenModelJwt { UserId = user.Id.ToString(), NickName = user.NickName, LoginMode = LoginModeEnum.APP.ToString() };

View File

@ -97,14 +97,14 @@
"DBType": 0,
"Enabled": true,
"HitRate": 20,
"Connection": "Server=192.168.104.108; Port=3306;SslMode=None;Database=volunteerapp; Uid=root; Pwd=Vs..127134;CharSet=utf8mb4;AllowLoadLocalInfile=true"
"Connection": "Server=192.168.104.103; Port=3306;SslMode=None;Database=volunteerapp; Uid=volunteerapp; Pwd=Vs..127134;CharSet=utf8mb4;AllowLoadLocalInfile=true;SslMode=none"
},
{
"ConnId": "MYSQL_CasDoor",
"DBType": 0,
"Enabled": true,
"HitRate": 20,
"Connection": "Server=192.168.104.108; Port=3306;SslMode=None;Database=casdoor; Uid=root; Pwd=Vs..127134;CharSet=utf8mb4;AllowLoadLocalInfile=true"
"Connection": "Server=192.168.104.103; Port=3306;SslMode=None;Database=casdoor; Uid=casdoor; Pwd=Vs..127134;CharSet=utf8mb4;AllowLoadLocalInfile=true"
},
{
"ConnId": "WMBLOG_ORACLE",
@ -215,13 +215,13 @@
"endpoint": "https://oss-cn-shanghai.aliyuncs.com"
},
"Casdoor": {
"Endpoint": "http://192.168.104.107:8000",
"Endpoint": "https://api.sso.ycymedu.com",
"OrganizationName": "六纬生涯",
"ApplicationName": "六纬生涯",
"ApplicationType": "webapi",
"ClientId": "4c6d761417dbbdd665be",
"ClientSecret": "cc385a5d0efd5f7bf693d8c4574126158f7b0a8f",
"CallbackPath": "http://192.168.104.107:8000/login/oauth/authorize?client_id=ae6bdccc3a7821232b31&response_type=code&redirect_uri=http://192.168.103.100:8083/callback&scope=read&state=casdoor",
"ClientId": "18592781518917",
"ClientSecret": "9c1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a",
"CallbackPath": "http://test.sso.ycymedu.com/login/oauth/authorize?client_id=776d639918192c449537&response_type=code&redirect_uri=http://192.168.100.106:8080/Home/FirstPage&scope=read&state=casdoor",
"RequireHttpsMetadata": false
},
"WeChatPay": {