Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
0c072646
Commit
0c072646
authored
Jul 14, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
c08e34a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
76 deletions
+76
-76
UserInfo.cs
Mall.Common/API/UserInfo.cs
+14
-14
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+62
-62
No files found.
Mall.Common/API/UserInfo.cs
View file @
0c072646
...
@@ -127,20 +127,20 @@ namespace Mall.Common
...
@@ -127,20 +127,20 @@ namespace Mall.Common
/// </summary>
/// </summary>
public
int
EmpId
{
get
;
set
;
}
public
int
EmpId
{
get
;
set
;
}
public
string
erptoken
{
get
;
set
;
}
//
public string erptoken { get; set; }
/// <summary>
///
//
<summary>
/// erp用户id
///
//
erp用户id
/// </summary>
///
//
</summary>
public
int
ERPEmpId
{
get
;
set
;
}
//
public int ERPEmpId { get; set; }
/// <summary>
///
//
<summary>
/// erp公司id
///
//
erp公司id
/// </summary>
///
//
</summary>
public
int
ERPBranchId
{
get
;
set
;
}
//
public int ERPBranchId { get; set; }
/// <summary>
///
//
<summary>
/// erp集团id
///
//
erp集团id
/// </summary>
///
//
</summary>
public
int
ERPGroupId
{
get
;
set
;
}
//
public int ERPGroupId { get; set; }
}
}
}
}
Mall.WebApi/Controllers/User/TenantController.cs
View file @
0c072646
...
@@ -77,7 +77,7 @@ namespace Mall.WebApi.Controllers.User
...
@@ -77,7 +77,7 @@ namespace Mall.WebApi.Controllers.User
private
ProductModule
productModule
=
new
ProductModule
();
private
ProductModule
productModule
=
new
ProductModule
();
private
Module
.
Property
.
AuthorizeModule
authorizeModule
=
new
Module
.
Property
.
AuthorizeModule
();
//
private Module.Property.AuthorizeModule authorizeModule = new Module.Property.AuthorizeModule();
#
region
商户信息
#
region
商户信息
[
AllowAnonymous
]
[
AllowAnonymous
]
...
@@ -115,63 +115,63 @@ namespace Mall.WebApi.Controllers.User
...
@@ -115,63 +115,63 @@ namespace Mall.WebApi.Controllers.User
#
region
add
by
:
W
2020
-
07
-
06
erp
授权信息
#
region
add
by
:
W
2020
-
07
-
06
erp
授权信息
var
erpUserInfo
=
new
Mall
.
Model
.
Entity
.
Property
.
RB_Employee
();
//
var erpUserInfo = new Mall.Model.Entity.Property.RB_Employee();
string
erptoken
=
""
;
//
string erptoken = "";
if
(
model
.
EmpId
>
0
)
//
if (model.EmpId > 0)
{
//
{
//判断当前登录人是否有erp账号信息
//
//判断当前登录人是否有erp账号信息
var
authorizeModel
=
authorizeModule
.
GetAuthorizeList
(
new
Model
.
Extend
.
Property
.
RB_ERP_Authorize_Extend
{
TenantId
=
model
.
TenantId
,
MallBaseId
=
model
.
MallBaseId
,
MallUserId
=
model
.
EmpId
,
Type
=
1
}).
FirstOrDefault
();
//
var authorizeModel = authorizeModule.GetAuthorizeList(new Model.Extend.Property.RB_ERP_Authorize_Extend { TenantId = model.TenantId, MallBaseId = model.MallBaseId, MallUserId = model.EmpId, Type = 1 }).FirstOrDefault();
if
(
authorizeModel
!=
null
&&
authorizeModel
.
Status
==
2
)
//
if (authorizeModel != null && authorizeModel.Status == 2)
{
//
{
//先查询是否存在是否是登陆手机号登陆
//
//先查询是否存在是否是登陆手机号登陆
erpUserInfo
=
authorizeModule
.
GetByLoginMobileAndPwd
(
authorizeModel
.
Account
,
authorizeModel
.
Password
,
authorizeModel
.
ERPGroupId
);
//
erpUserInfo = authorizeModule.GetByLoginMobileAndPwd(authorizeModel.Account, authorizeModel.Password, authorizeModel.ERPGroupId);
if
(
erpUserInfo
==
null
)
//
if (erpUserInfo == null)
{
//
{
//再查询是否存在是否是账号登陆
//
//再查询是否存在是否是账号登陆
erpUserInfo
=
authorizeModule
.
GetNewByAccountAndPwd
(
authorizeModel
.
Account
,
authorizeModel
.
Password
,
authorizeModel
.
ERPGroupId
);
//
erpUserInfo = authorizeModule.GetNewByAccountAndPwd(authorizeModel.Account, authorizeModel.Password, authorizeModel.ERPGroupId);
}
//
}
if
(
erpUserInfo
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
erpUserInfo
.
EmLoginMobile
)
&&
erpUserInfo
.
IsLeave
==
0
)
//
if (erpUserInfo != null && !string.IsNullOrWhiteSpace(erpUserInfo.EmLoginMobile) && erpUserInfo.IsLeave == 0)
{
//
{
TokenUserInfo
erpUserInfoToken
=
new
TokenUserInfo
{
uid
=
erpUserInfo
.
EmployeeId
.
ToString
(),
requestFrom
=
Common
.
Enum
.
ApiRequestFromEnum
.
ERP
};
//
TokenUserInfo erpUserInfoToken = new TokenUserInfo { uid = erpUserInfo.EmployeeId.ToString(), requestFrom = Common.Enum.ApiRequestFromEnum.ERP };
#
region
JWT
//
#region JWT
IDateTimeProvider
erpprovider
=
new
UtcDateTimeProvider
();
//
IDateTimeProvider erpprovider = new UtcDateTimeProvider();
var
erpnow
=
erpprovider
.
GetNow
().
AddMinutes
(-
1
);
//
var erpnow = erpprovider.GetNow().AddMinutes(-1);
var
erpunixEpoch
=
new
DateTime
(
1970
,
1
,
1
,
0
,
0
,
0
,
DateTimeKind
.
Utc
);
// or use JwtValidator.UnixEpoch
//
var erpunixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var
erpsecondsSinceEpoch
=
Math
.
Round
((
erpnow
-
erpunixEpoch
).
TotalSeconds
);
//
var erpsecondsSinceEpoch = Math.Round((erpnow - erpunixEpoch).TotalSeconds);
var
erppayload
=
new
Dictionary
<
string
,
object
>
//
var erppayload = new Dictionary<string, object>
{
//
{
{
"iat"
,
erpsecondsSinceEpoch
},
//
{"iat",erpsecondsSinceEpoch },
{
"exp"
,
erpsecondsSinceEpoch
+
Config
.
JwtExpirTime
},
//
{"exp",erpsecondsSinceEpoch+Config.JwtExpirTime},
{
"userInfo"
,
erpUserInfoToken
}
//
{"userInfo",erpUserInfoToken }
};
//
};
IJwtAlgorithm
erpalgorithm
=
new
HMACSHA256Algorithm
();
//
IJwtAlgorithm erpalgorithm = new HMACSHA256Algorithm();
IJsonSerializer
erpserializer
=
new
JsonNetSerializer
();
//
IJsonSerializer erpserializer = new JsonNetSerializer();
IBase64UrlEncoder
erpurlEncoder
=
new
JwtBase64UrlEncoder
();
//
IBase64UrlEncoder erpurlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder
erpencoder
=
new
JwtEncoder
(
erpalgorithm
,
erpserializer
,
erpurlEncoder
);
//
IJwtEncoder erpencoder = new JwtEncoder(erpalgorithm, erpserializer, erpurlEncoder);
string
erpsecret
=
Config
.
JwtSecretKey
;
//
string erpsecret = Config.JwtSecretKey;
erptoken
=
erpencoder
.
Encode
(
erppayload
,
erpsecret
);
//
erptoken = erpencoder.Encode(erppayload, erpsecret);
#
endregion
//
#endregion
//ERPUserInfo erpObj = new ERPUserInfo
//
//ERPUserInfo erpObj = new ERPUserInfo
//{
//
//{
// Domain = authorizeModel.DomainName,
//
// Domain = authorizeModel.DomainName,
// emName = erpUserInfo.EmName,
//
// emName = erpUserInfo.EmName,
// EmployeeId = erpUserInfo.EmployeeId,
//
// EmployeeId = erpUserInfo.EmployeeId,
// RB_Group_id = erpUserInfo.RB_Group_id,
//
// RB_Group_id = erpUserInfo.RB_Group_id,
// RB_Branch_id = erpUserInfo.RB_Branch_id,
//
// RB_Branch_id = erpUserInfo.RB_Branch_id,
// RB_Post_Id = erpUserInfo.RB_Post_Id,
//
// RB_Post_Id = erpUserInfo.RB_Post_Id,
// RB_Department_Id = erpUserInfo.RB_Department_Id,
//
// RB_Department_Id = erpUserInfo.RB_Department_Id,
// token = erptoken,
//
// token = erptoken,
// SecretKey = erpUserInfo.SecretKey,
//
// SecretKey = erpUserInfo.SecretKey,
// //ImAccount = imAccount?.AccID ?? model.EmLoginMobile, //model.EmLoginMobile,
//
// //ImAccount = imAccount?.AccID ?? model.EmLoginMobile, //model.EmLoginMobile,
// //ImToken = IMService.DefaultPassword(),
//
// //ImToken = IMService.DefaultPassword(),
//};
//
//};
//UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.ERP_Login_Info_+ erpUserInfo.EmployeeId, erpObj, Config.JwtExpirTime);
//
//UserReidsCache.UserInfoSet(UserModuleCacheKeyConfig.ERP_Login_Info_+ erpUserInfo.EmployeeId, erpObj, Config.JwtExpirTime);
}
//
}
}
//
}
}
//
}
#
endregion
#
endregion
...
@@ -210,10 +210,10 @@ namespace Mall.WebApi.Controllers.User
...
@@ -210,10 +210,10 @@ namespace Mall.WebApi.Controllers.User
SecretKey
=
""
,
SecretKey
=
""
,
MallBaseId
=
0
,
MallBaseId
=
0
,
EmpId
=
model
.
EmpId
,
EmpId
=
model
.
EmpId
,
erptoken
=
erptoken
,
//
erptoken = erptoken,
ERPEmpId
=
erpUserInfo
.
EmployeeId
,
//
ERPEmpId = erpUserInfo.EmployeeId,
ERPBranchId
=
erpUserInfo
.
RB_Branch_id
,
//
ERPBranchId = erpUserInfo.RB_Branch_id,
ERPGroupId
=
erpUserInfo
.
RB_Group_id
//
ERPGroupId = erpUserInfo.RB_Group_id
};
};
UserReidsCache
.
UserInfoSet
(
UserModuleCacheKeyConfig
.
Mall_Login_Info
+
model
.
TenantId
,
obj
,
Config
.
JwtExpirTime
);
UserReidsCache
.
UserInfoSet
(
UserModuleCacheKeyConfig
.
Mall_Login_Info
+
model
.
TenantId
,
obj
,
Config
.
JwtExpirTime
);
return
ApiResult
.
Success
(
""
,
obj
);
return
ApiResult
.
Success
(
""
,
obj
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment