develop
parent
052f19a6fd
commit
6fe253bd11
|
|
@ -43,19 +43,28 @@ namespace New_College.Controllers
|
||||||
var response = new CasDoorToken();
|
var response = new CasDoorToken();
|
||||||
string jwtStr = string.Empty;
|
string jwtStr = string.Empty;
|
||||||
bool suc = false;
|
bool suc = false;
|
||||||
var userinfo = CasdoorHttpHelper.Http_Post<JWTSSOResult<MinProWxOutPut>>("/api/syswechat/user_info", null,
|
if (String.IsNullOrWhiteSpace(code))
|
||||||
new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(
|
{
|
||||||
new CasdoorRequest()
|
return new MessageModel<CasDoorToken>()
|
||||||
{
|
{
|
||||||
code = code,
|
success = false,
|
||||||
client_id = CasdoorConfig.ClientId,
|
msg = "参数错误",
|
||||||
client_secret = CasdoorConfig.ClientSecret
|
response = response
|
||||||
}),
|
};
|
||||||
Encoding.UTF8, "application/json"));//
|
}
|
||||||
|
var userinfo = CasdoorHttpHelper.Http_Post<JWTSSOResult<MinProWxOutPut>>("api/syswechat/user_info", null,
|
||||||
|
new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(
|
||||||
|
new CasdoorRequest()
|
||||||
|
{
|
||||||
|
code = code,
|
||||||
|
client_id = CasdoorConfig.ClientId,
|
||||||
|
client_secret = CasdoorConfig.ClientSecret
|
||||||
|
}),
|
||||||
|
Encoding.UTF8, "application/json"));//
|
||||||
if (userinfo != null && userinfo.code == 200 && userinfo.type == "success")
|
if (userinfo != null && userinfo.code == 200 && userinfo.type == "success")
|
||||||
{
|
{
|
||||||
var user = (await _CustomerInfoServices.Query(q => q.UUID == userinfo.result.UnionId)).FirstOrDefault();
|
var user = (await _CustomerInfoServices.Query(q => q.UUID == userinfo.result.UnionId)).FirstOrDefault();
|
||||||
if (user != null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
//没有用户则注册一个新用户
|
//没有用户则注册一个新用户
|
||||||
user = new Model.Models.V_CustomerInfo()
|
user = new Model.Models.V_CustomerInfo()
|
||||||
|
|
@ -80,6 +89,10 @@ namespace New_College.Controllers
|
||||||
{
|
{
|
||||||
user.GZOpenId = userinfo.result.OpenId;
|
user.GZOpenId = userinfo.result.OpenId;
|
||||||
user.ModifyTime = DateTime.UtcNow;
|
user.ModifyTime = DateTime.UtcNow;
|
||||||
|
if (!string.IsNullOrEmpty(userinfo.result.Mobile)&&string.IsNullOrEmpty(user.Phone))
|
||||||
|
{
|
||||||
|
user.Phone = userinfo.result.Mobile;
|
||||||
|
}
|
||||||
await _CustomerInfoServices.Update(user);
|
await _CustomerInfoServices.Update(user);
|
||||||
}
|
}
|
||||||
var tokenModel = new SSOTokenModelJwt { UserId = user.Id.ToString(), NickName = user.NickName, LoginMode = LoginModeEnum.APP.ToString() };
|
var tokenModel = new SSOTokenModelJwt { UserId = user.Id.ToString(), NickName = user.NickName, LoginMode = LoginModeEnum.APP.ToString() };
|
||||||
|
|
|
||||||
|
|
@ -97,14 +97,14 @@
|
||||||
"DBType": 0,
|
"DBType": 0,
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"HitRate": 20,
|
"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",
|
"ConnId": "MYSQL_CasDoor",
|
||||||
"DBType": 0,
|
"DBType": 0,
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"HitRate": 20,
|
"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",
|
"ConnId": "WMBLOG_ORACLE",
|
||||||
|
|
@ -215,13 +215,13 @@
|
||||||
"endpoint": "https://oss-cn-shanghai.aliyuncs.com"
|
"endpoint": "https://oss-cn-shanghai.aliyuncs.com"
|
||||||
},
|
},
|
||||||
"Casdoor": {
|
"Casdoor": {
|
||||||
"Endpoint": "http://192.168.104.107:8000",
|
"Endpoint": "https://api.sso.ycymedu.com",
|
||||||
"OrganizationName": "六纬生涯",
|
"OrganizationName": "六纬生涯",
|
||||||
"ApplicationName": "六纬生涯",
|
"ApplicationName": "六纬生涯",
|
||||||
"ApplicationType": "webapi",
|
"ApplicationType": "webapi",
|
||||||
"ClientId": "4c6d761417dbbdd665be",
|
"ClientId": "18592781518917",
|
||||||
"ClientSecret": "cc385a5d0efd5f7bf693d8c4574126158f7b0a8f",
|
"ClientSecret": "9c1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a",
|
||||||
"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",
|
"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
|
"RequireHttpsMetadata": false
|
||||||
},
|
},
|
||||||
"WeChatPay": {
|
"WeChatPay": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue