Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
7b6edba2
Commit
7b6edba2
authored
Jan 22, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sqlite middleware
parent
c37bc844
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
src/api/cards.ts
src/api/cards.ts
+1
-1
src/middleware/sqlite.ts
src/middleware/sqlite.ts
+21
-2
No files found.
src/api/cards.ts
View file @
7b6edba2
...
@@ -5,7 +5,7 @@ export interface CardMeta {
...
@@ -5,7 +5,7 @@ export interface CardMeta {
data
:
{
data
:
{
ot
?:
number
;
ot
?:
number
;
setcode
?:
number
;
setcode
?:
number
;
type
_
?:
number
;
type
?:
number
;
atk
?:
number
;
atk
?:
number
;
def
?:
number
;
def
?:
number
;
level
?:
number
;
level
?:
number
;
...
...
src/middleware/sqlite.ts
View file @
7b6edba2
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
* */
* */
import
initSqlJs
,
{
Database
}
from
"
sql.js
"
;
import
initSqlJs
,
{
Database
}
from
"
sql.js
"
;
import
{
CardMeta
}
from
"
../api/cards
"
;
export
enum
sqliteCmd
{
export
enum
sqliteCmd
{
// 初始化
// 初始化
...
@@ -44,8 +45,14 @@ export default async function (action: sqliteAction) {
...
@@ -44,8 +45,14 @@ export default async function (action: sqliteAction) {
break
;
break
;
}
}
case
sqliteCmd
.
SELECT
:
{
case
sqliteCmd
.
SELECT
:
{
if
(
YGODB
)
{
if
(
YGODB
&&
action
.
payload
)
{
// TDOO
const
code
=
action
.
payload
;
const
dataStmt
=
YGODB
.
prepare
(
"
SELECT * from datas WHERE ID = $id
"
);
const
dataResult
=
dataStmt
.
getAsObject
({
$id
:
code
});
const
textStmt
=
YGODB
.
prepare
(
"
SELECT * from texts WHERE ID = $id
"
);
const
textResult
=
textStmt
.
getAsObject
({
$id
:
code
});
return
constructCardMeta
(
code
,
dataResult
,
textResult
);
}
else
{
}
else
{
console
.
warn
(
"
ygo db not init!
"
);
console
.
warn
(
"
ygo db not init!
"
);
}
}
...
@@ -59,3 +66,15 @@ export default async function (action: sqliteAction) {
...
@@ -59,3 +66,15 @@ export default async function (action: sqliteAction) {
}
}
}
}
}
}
function
constructCardMeta
(
id
:
number
,
data
:
initSqlJs
.
ParamsObject
,
text
:
initSqlJs
.
ParamsObject
):
CardMeta
{
return
{
id
,
data
,
text
,
};
}
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