Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
quantum-blocks
Commits
8f639126
Commit
8f639126
authored
Apr 25, 2022
by
Xuguangxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 处理量子积木缓存问题
parent
949533b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
editor.ts
app/controller/editor.ts
+4
-2
editor.api.ts
app/web/api/editor.api.ts
+1
-1
No files found.
app/controller/editor.ts
View file @
8f639126
...
@@ -17,7 +17,7 @@ export default class EditorController extends Controller {
...
@@ -17,7 +17,7 @@ export default class EditorController extends Controller {
try
{
try
{
const
result
=
await
ctx
.
model
.
PageInfo
.
create
({
...
pageInfo
,
uuid
:
uuidv1
().
replace
(
/-/g
,
''
),
tenantId
:
ctx
.
headers
[
'
qg-tenant-id
'
]});
const
result
=
await
ctx
.
model
.
PageInfo
.
create
({
...
pageInfo
,
uuid
:
uuidv1
().
replace
(
/-/g
,
''
),
tenantId
:
ctx
.
headers
[
'
qg-tenant-id
'
]});
ctx
.
body
=
ctx
.
helper
.
ok
(
result
);
ctx
.
body
=
ctx
.
helper
.
ok
(
result
);
await
ctx
.
service
.
redis
.
set
(
`pageInfo:
${
result
.
dataValues
.
uuid
}
`
,
result
.
dataValues
);
await
ctx
.
service
.
redis
.
del
(
`pageInfo:
${
result
.
dataValues
.
uuid
}
`
);
await
ctx
.
service
.
redis
.
del
(
`page:
${
result
.
dataValues
.
uuid
}
`
);
await
ctx
.
service
.
redis
.
del
(
`page:
${
result
.
dataValues
.
uuid
}
`
);
}
catch
(
error
)
{
}
catch
(
error
)
{
if
(
error
.
message
.
indexOf
(
'
Data too long
'
)
>
-
1
&&
error
.
message
.
indexOf
(
'
page_data
'
)
>
-
1
)
{
if
(
error
.
message
.
indexOf
(
'
Data too long
'
)
>
-
1
&&
error
.
message
.
indexOf
(
'
page_data
'
)
>
-
1
)
{
...
@@ -49,7 +49,8 @@ export default class EditorController extends Controller {
...
@@ -49,7 +49,8 @@ export default class EditorController extends Controller {
}
}
// todo 编辑器获取跳过redis,但需要注意
// todo 编辑器获取跳过redis,但需要注意
public
async
get
(
ctx
:
Context
)
{
public
async
get
(
ctx
:
Context
)
{
let
pageInfo
=
await
ctx
.
service
.
redis
.
get
(
`pageInfo:
${
ctx
.
params
.
uuid
}
`
);
const
{
isEditor
}
=
ctx
.
query
;
let
pageInfo
=
isEditor
?
null
:
await
ctx
.
service
.
redis
.
get
(
`pageInfo:
${
ctx
.
params
.
uuid
}
`
);
console
.
log
(
'
redis
'
,
pageInfo
);
console
.
log
(
'
redis
'
,
pageInfo
);
if
(
!
pageInfo
)
{
if
(
!
pageInfo
)
{
let
pageInfo
=
await
ctx
.
model
.
PageInfo
.
findOne
({
where
:
{
uuid
:
ctx
.
params
.
uuid
}});
let
pageInfo
=
await
ctx
.
model
.
PageInfo
.
findOne
({
where
:
{
uuid
:
ctx
.
params
.
uuid
}});
...
@@ -115,6 +116,7 @@ export default class EditorController extends Controller {
...
@@ -115,6 +116,7 @@ export default class EditorController extends Controller {
});
});
for
(
const
item
of
pageInfo
)
{
for
(
const
item
of
pageInfo
)
{
await
ctx
.
service
.
redis
.
del
(
`page:
${
item
.
uuid
}
`
);
await
ctx
.
service
.
redis
.
del
(
`page:
${
item
.
uuid
}
`
);
await
ctx
.
service
.
redis
.
del
(
`pageInfo:
${
item
.
uuid
}
`
);
ctx
.
logger
.
info
(
`del redis page key page:
${
item
.
uuid
}
`
);
ctx
.
logger
.
info
(
`del redis page key page:
${
item
.
uuid
}
`
);
}
}
ctx
.
body
=
ctx
.
helper
.
ok
();
ctx
.
body
=
ctx
.
helper
.
ok
();
...
...
app/web/api/editor.api.ts
View file @
8f639126
...
@@ -10,7 +10,7 @@ export default {
...
@@ -10,7 +10,7 @@ export default {
return
http
.
post
(
'
editor/clearcache
'
);
return
http
.
post
(
'
editor/clearcache
'
);
},
},
getPageById
(
params
)
{
getPageById
(
params
)
{
return
http
.
get
(
`editor/get/
${
params
.
pageId
}
`
);
return
http
.
get
(
`editor/get/
${
params
.
pageId
}
?isEditor=1
`
);
},
},
delPageById
(
pageId
)
{
delPageById
(
pageId
)
{
return
http
.
delete
(
`editor/
${
pageId
}
`
);
return
http
.
delete
(
`editor/
${
pageId
}
`
);
...
...
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