Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
a8d78fe7
Commit
a8d78fe7
authored
Jul 20, 2020
by
sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 返回公司code码
parent
354f88c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
center-manage/app/base/db/cache/userCache.js
+27
-27
No files found.
center-manage/app/base/db/cache/userCache.js
View file @
a8d78fe7
const
CacheBase
=
require
(
"../cache.base"
);
const
system
=
require
(
"../../system"
);
const
settings
=
require
(
"../../../config/settings"
);
class
UserCache
extends
CacheBase
{
constructor
(){
class
UserCache
extends
CacheBase
{
constructor
()
{
super
();
this
.
userDao
=
system
.
getObject
(
"db.auth.userDao"
);
this
.
userDao
=
system
.
getObject
(
"db.auth.userDao"
);
}
isdebug
(){
return
settings
.
env
==
"dev"
;
}
desc
(){
isdebug
()
{
return
settings
.
env
==
"dev"
;
}
desc
()
{
return
"缓存本地应用对象"
;
}
prefix
()
{
}
prefix
()
{
return
"g_userlocal_cm:"
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
const
configValue
=
await
this
.
userDao
.
model
.
findAll
({
where
:
{
userName
:
inputkey
,
app_id
:
settings
.
pmappid
,
isEnabled
:
true
},
attributes
:
[
'id'
,
'userName'
,
'nickName'
,
'headUrl'
,
'jwtkey'
,
'jwtsecret'
,
'created_at'
,
'isSuper'
,
'isAdmin'
,
'isAllocated'
,
'mail'
,
'mobile'
,
'opath'
,
'ptags'
],
include
:
[
{
model
:
this
.
db
.
models
.
company
,
attributes
:[
'id'
,
'name'
,
'companykey'
,
'appids'
],
raw
:
true
},
{
model
:
this
.
db
.
models
.
role
,
as
:
"Roles"
,
attributes
:[
"id"
,
"code"
],
}
],
});
if
(
configValue
&&
configValue
[
0
])
{
return
JSON
.
stringify
(
configValue
[
0
]);
}
return
null
;
}
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
const
configValue
=
await
this
.
userDao
.
model
.
findAll
({
where
:
{
userName
:
inputkey
,
app_id
:
settings
.
pmappid
,
isEnabled
:
true
},
attributes
:
[
'id'
,
'userName'
,
'nickName'
,
'headUrl'
,
'jwtkey'
,
'jwtsecret'
,
'created_at'
,
'isSuper'
,
'isAdmin'
,
'isAllocated'
,
'mail'
,
'mobile'
,
'opath'
,
'ptags'
],
include
:
[
{
model
:
this
.
db
.
models
.
company
,
attributes
:
[
'id'
,
'name'
,
'companykey'
,
'appids'
,
"code"
],
raw
:
true
},
{
model
:
this
.
db
.
models
.
role
,
as
:
"Roles"
,
attributes
:
[
"id"
,
"code"
],
}
],
});
if
(
configValue
&&
configValue
[
0
])
{
return
JSON
.
stringify
(
configValue
[
0
]);
}
return
null
;
}
}
module
.
exports
=
UserCache
;
\ No newline at end of file
module
.
exports
=
UserCache
;
\ No newline at end of file
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