app和小程序登录接口
This commit is contained in:
@@ -17,6 +17,11 @@ namespace WMS.Web.Core.Dto.Login
|
||||
/// </summary>
|
||||
public UserInfoDto UserInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public UserInfoV3Dto UserInfoV3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// token信息
|
||||
/// </summary>
|
||||
|
||||
42
src/WMS.Web.Core/Dto/Login/LoginRequest.cs
Normal file
42
src/WMS.Web.Core/Dto/Login/LoginRequest.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Login
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录请求对象
|
||||
/// </summary>
|
||||
public class LoginRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
public class LoginAuthorizeRequest : LoginRequest
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ClientId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string GrantType { get; set; }
|
||||
|
||||
public string Scope { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/WMS.Web.Core/Dto/Login/TagInfoDto.cs
Normal file
13
src/WMS.Web.Core/Dto/Login/TagInfoDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Login
|
||||
{
|
||||
public class TagInfoDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -40,4 +40,31 @@ namespace WMS.Web.Core.Dto.Login.Temp
|
||||
/// </summary>
|
||||
public string encryptedData { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录后获取的:token 信息-和单点系统的字段一一对应
|
||||
/// </summary>
|
||||
public class LoginTempV2Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 后续与单点通信验证token
|
||||
/// </summary>
|
||||
public string access_token { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///access token过期时间
|
||||
/// </summary>
|
||||
public int access_expired_at { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用于access_token过期后刷新用
|
||||
/// </summary>
|
||||
public string refresh_token { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 加密后的用户数据
|
||||
/// </summary>
|
||||
public string encrypted_data { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Login.Temp
|
||||
{
|
||||
public class LoginJsonCompanyTempDto
|
||||
{
|
||||
public int company_id { get; set; }
|
||||
public string company_name { get; set; }
|
||||
public string company_code { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/WMS.Web.Core/Dto/Login/Temp/v3/LoginJsonDeptV3TempDto.cs
Normal file
13
src/WMS.Web.Core/Dto/Login/Temp/v3/LoginJsonDeptV3TempDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Login.Temp.v3
|
||||
{
|
||||
public class LoginJsonDeptV3TempDto
|
||||
{
|
||||
public int dept_id { get; set; }
|
||||
public string dept_name { get; set; }
|
||||
public string dept_code { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/WMS.Web.Core/Dto/Login/Temp/v3/LoginJsonOrgTempDto.cs
Normal file
13
src/WMS.Web.Core/Dto/Login/Temp/v3/LoginJsonOrgTempDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Login.Temp
|
||||
{
|
||||
public class LoginJsonOrgTempDto
|
||||
{
|
||||
public int org_id { get; set; }
|
||||
public string org_name { get; set; }
|
||||
public string org_code { get; set; }
|
||||
}
|
||||
}
|
||||
13
src/WMS.Web.Core/Dto/Login/Temp/v3/LoginJsonRoleTempDto.cs
Normal file
13
src/WMS.Web.Core/Dto/Login/Temp/v3/LoginJsonRoleTempDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Login.Temp.v3
|
||||
{
|
||||
public class LoginJsonRoleTempDto
|
||||
{
|
||||
public int role_id { get; set; }
|
||||
public string role_name { get; set; }
|
||||
public string role_code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Login.Temp.v3
|
||||
{
|
||||
public class LoginJsonTokenV3TempDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户在单点中维一ID
|
||||
/// </summary>
|
||||
public int id { get; set; }
|
||||
|
||||
public string dingtalk_uid { get; set; }
|
||||
|
||||
public string dingtalk_unionid { get; set; }
|
||||
|
||||
public string nickname { get; set; }
|
||||
public string realname { get; set; }
|
||||
|
||||
public string mobile { get; set; }
|
||||
|
||||
public int identity { get; set; }
|
||||
|
||||
public LoginJsonCompanyTempDto company { get; set; }
|
||||
public List<LoginJsonOrgTempDto> orgs { get; set; }
|
||||
public List<LoginJsonDeptV3TempDto> depts { get; set; }
|
||||
public List<LoginJsonRoleTempDto> roles { get; set; }
|
||||
}
|
||||
}
|
||||
30
src/WMS.Web.Core/Dto/Login/UserInfoV3Dto.cs
Normal file
30
src/WMS.Web.Core/Dto/Login/UserInfoV3Dto.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Login
|
||||
{
|
||||
public class UserInfoV3Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户在单点中维一ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
public string DingtalkUid { get; set; }
|
||||
|
||||
public string DingtalkUnionid { get; set; }
|
||||
|
||||
public string Nickname { get; set; }
|
||||
public string Realname { get; set; }
|
||||
|
||||
public string Mobile { get; set; }
|
||||
|
||||
public int Identity { get; set; }
|
||||
|
||||
public TagInfoDto Company { get; set; }
|
||||
public List<TagInfoDto> Orgs { get; set; } = new List<TagInfoDto>();
|
||||
public List<TagInfoDto> Depts { get; set; }= new List<TagInfoDto>();
|
||||
public List<TagInfoDto> Roles { get; set; }= new List<TagInfoDto>();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using System.Net.Http.Headers;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
|
||||
namespace WMS.Web.Core.Help
|
||||
{
|
||||
@@ -81,6 +82,36 @@ namespace WMS.Web.Core.Help
|
||||
return respData;
|
||||
}
|
||||
|
||||
public string PostHttp(string url, LoginAuthorizeRequest reqData)
|
||||
{
|
||||
var str = string.Format("client_id={0}&client_secret={1}&grant_type={2}&username={3}&password={4}&scope={5}",
|
||||
reqData.ClientId, reqData.ClientSecret, reqData.GrantType, reqData.UserName, reqData.Password,reqData.Scope);
|
||||
ASCIIEncoding encoding = new ASCIIEncoding();
|
||||
byte[] byte1 = encoding.GetBytes(str);
|
||||
HttpContent httpContent = new StringContent(str);
|
||||
httpContent.Headers.Expires = DateTime.Now;
|
||||
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
|
||||
httpContent.Headers.ContentLength = byte1.Length;
|
||||
httpContent.Headers.ContentType.CharSet = "utf-8";
|
||||
HttpClient httpClient = new HttpClient();
|
||||
httpClient.BaseAddress = new Uri(url);
|
||||
httpClient.Timeout = new TimeSpan(0, 0, 10);
|
||||
|
||||
HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var resData = response.Content.ReadAsStringAsync().Result;
|
||||
return resData;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var resData = response.Content.ReadAsStringAsync().Result;
|
||||
return resData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string PostHttpNoData(string url, string cookieValue = "")
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
|
||||
Reference in New Issue
Block a user