Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
evm-store
Project overview
Project overview
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
wanli
evm-store
Commits
2d47574f
Commit
2d47574f
authored
Jul 22, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🌈
style(): 一些小更新
parent
0eb0a727
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
697 additions
and
115 deletions
+697
-115
database_migration.py
database_migration.py
+196
-0
frontend/src/utils/eventBus.js
frontend/src/utils/eventBus.js
+1
-1
frontend/src/views/system/monitor.vue
frontend/src/views/system/monitor.vue
+47
-22
frontend/src/views/system/style.css
frontend/src/views/system/style.css
+7
-0
tools/build_out/controllers/monitor.py
tools/build_out/controllers/monitor.py
+38
-20
tools/build_out/models/monitorSystem.py
tools/build_out/models/monitorSystem.py
+15
-1
tools/build_out/views/monitor.py
tools/build_out/views/monitor.py
+45
-29
tools/database_migration.py
tools/database_migration.py
+42
-7
tools/frontend/src/views/Application/Monitor.vue
tools/frontend/src/views/Application/Monitor.vue
+92
-30
tools/frontend/src/views/Application/components/SystemChart.vue
...frontend/src/views/Application/components/SystemChart.vue
+205
-0
tools/frontend/src/views/User/Login.vue
tools/frontend/src/views/User/Login.vue
+9
-5
No files found.
database_migration.py
0 → 100644
View file @
2d47574f
# -*- coding: utf-8 -*-
'''
Author: your name
Date: 2021-07-20 19:04:27
LastEditTime: 2021-07-21 20:01:56
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\
database_migration.py
'''
import
os
import
sqlite3
import
uuid
from
datetime
import
datetime
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
print
(
"####>>>"
,
BASE_DIR
)
start
=
datetime
.
now
()
print
(
"start at:"
,
start
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
))
source_conn
=
sqlite3
.
connect
(
os
.
path
.
join
(
BASE_DIR
,
"app-store.db"
))
source_cur
=
source_conn
.
cursor
()
target_db
=
os
.
path
.
join
(
BASE_DIR
,
"evue-store.db"
)
target_conn
=
sqlite3
.
connect
(
target_db
)
target_cur
=
source_conn
.
cursor
()
with
open
(
"database_migration.sql"
,
"w+"
)
as
fd
:
# 更新user表
opts
=
[
[
2
,
39
],
[
3
,
40
],
[
4
,
41
]
]
sqls
=
[
"update evm_store_apps set create_by = {a} where create_by = {b};"
,
"update evm_store_apps set update_by = {a} where update_by = {b};"
,
"update evm_store_annex set create_by = {a} where create_by = {b};"
,
"update evm_store_annex set update_by = {a} where update_by = {b};"
,
"update evm_store_app_logs set create_by = {a} where create_by = {b};"
,
"update evm_store_build_logs set create_by = {a} where create_by = {b};"
,
"update evm_store_build_logs set update_by = {a} where update_by = {b};"
,
"update evm_store_device set create_by = {a} where create_by = {b};"
,
"update evm_store_device set update_by = {a} where update_by = {b};"
,
"update evm_store_login_logs set create_by = {a} where create_by = {b};"
,
]
for
s
in
sqls
:
for
o
in
opts
:
sql_str
=
s
.
format
(
a
=
o
[
0
],
b
=
o
[
1
])
source_cur
.
execute
(
sql_str
)
source_conn
.
commit
()
# 更新app logs 表
sql_str
=
"select create_at from evm_store_app_logs"
source_cur
.
execute
(
sql_str
)
res
=
source_cur
.
fetchall
()
for
line
in
res
:
sql_str
=
"select id from evm_store_apps where strftime('
%
s', evm_store_apps.create_at) - strftime('
%
s', '{b}') < 2"
.
format
(
b
=
line
[
0
])
source_cur
.
execute
(
sql_str
)
tmp
=
source_cur
.
fetchone
()
if
tmp
:
sql_str
=
"UPDATE evm_store_app_logs SET remarks = {a};"
.
format
(
a
=
tmp
[
0
])
source_cur
.
execute
(
sql_str
)
source_conn
.
commit
()
# 先插入user表
source_cur
.
execute
(
'SELECT account, username, password, email, phone, create_at, create_by, update_at, update_by FROM evm_store_user'
)
sql
=
"insert into evm_user (id, uuid, account, username, password, email, phone, create_at, create_by, update_at, update_by, is_delete, role) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}', '{g}', '{h}', {i}, '{j}', {k}, 0, 0);"
res
=
source_cur
.
fetchall
()
i
=
0
for
line
in
res
:
i
+=
1
sql_str
=
sql
.
format
(
a
=
i
,
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
0
],
d
=
line
[
1
],
e
=
line
[
2
],
f
=
line
[
3
],
g
=
line
[
4
],
h
=
line
[
5
],
i
=
line
[
6
],
j
=
line
[
7
],
k
=
line
[
8
])
print
(
"sql:"
,
sql_str
)
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
# login logs
source_cur
.
execute
(
'SELECT id, username, ip, address, create_at, create_by, remarks FROM evm_store_login_logs'
)
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_login (uuid, user, login_at, user_agent, ip, geo_location, operator, create_at, create_by, update_at, update_by, is_delete) values ('{b}', {c}, '{d}', '{e}', '{f}', '{g}', '{h}', '{i}', {j}, '{k}', {l}, 0);"
for
line
in
res
:
sql_str
=
sql
.
format
(
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
5
],
d
=
line
[
6
],
e
=
""
,
f
=
line
[
2
],
g
=
line
[
3
],
h
=
""
,
i
=
line
[
4
],
j
=
line
[
5
],
k
=
line
[
4
],
l
=
line
[
5
])
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
# 更新app_url字段
sql
=
"select app, app_path from evm_store_build_logs"
source_cur
.
execute
(
sql
)
res
=
source_cur
.
fetchall
()
for
line
in
res
:
sql_str
=
string
=
"update evm_store_apps set app_url = '{u}' where id = {a}"
.
format
(
u
=
line
[
1
],
a
=
line
[
0
])
source_cur
.
execute
(
sql_str
)
# fd.write(sql_str + "\n")
target_conn
.
commit
()
# annex
source_cur
.
execute
(
'SELECT id, uuid, app, title, path, size, create_at, create_by, update_at, update_by, is_delete FROM evm_store_annex'
)
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_annex (id, uuid, app, title, path, size, create_at, create_by, update_at, update_by, is_delete) values ({a}, '{b}', {c}, '{d}', '{e}', {f}, '{g}', {h}, '{i}', {j}, 0);"
for
line
in
res
:
if
not
line
[
2
]:
continue
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
2
],
d
=
line
[
3
],
e
=
line
[
4
]
or
""
,
f
=
line
[
5
],
g
=
line
[
6
],
h
=
line
[
7
],
i
=
line
[
8
],
j
=
line
[
9
])
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
# app
source_cur
.
execute
(
'SELECT id, app_name, app_icon, app_version, category, app_url, app_desc, create_at, create_by ,update_at, update_by, is_delete FROM evm_store_apps'
)
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_app (id, uuid, app_name, app_icon, app_version, category, download_url, app_screen_size, app_arch, app_review, meta_data, remarks, create_at, create_by, update_at, update_by, is_delete, launcher, developer, app_file_size) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}', '{g}', '{h}', '{i}', '{j}', '{k}', '{l}', '{m}', {n}, '{o}', {p}, 0, `""`, `""`, 0);"
for
line
in
res
:
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
1
],
d
=
line
[
2
],
e
=
line
[
3
],
f
=
line
[
4
],
g
=
line
[
5
],
h
=
"240 * 240"
,
i
=
"ASR3601"
,
j
=
0
,
k
=
'{}'
,
l
=
line
[
6
],
m
=
line
[
7
],
n
=
line
[
8
],
o
=
line
[
9
],
p
=
line
[
10
])
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
# device
source_cur
.
execute
(
'SELECT id, name, imei, desc, type, create_at, create_by, update_at, update_by, is_delete FROM evm_store_device'
)
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_device (id, uuid, name, imei, desc, type, create_at, create_by, update_at, update_by, is_delete) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}', '{g}', {h}, '{i}', {j}, {k});"
for
line
in
res
:
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
1
],
d
=
line
[
2
],
e
=
line
[
3
],
f
=
line
[
4
],
g
=
line
[
5
],
h
=
line
[
6
],
i
=
line
[
7
],
j
=
line
[
8
],
k
=
line
[
9
])
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
# app log & build log
# 先插入app log
source_cur
.
execute
(
'SELECT id, uuid, app_name, app_path, app_version, app_info, create_at, create_by, remarks FROM evm_store_app_logs'
)
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_package (id, uuid, app, app_path, app_version, app_info, create_at, create_by, update_at, update_by, is_delete, source) values ({a}, '{b}', '{c}', '{d}', '{e}', `'{f}'`, '{g}', {h}, '{i}', {j}, {k}, {l});"
for
line
in
res
:
# 根据时间查找app
print
(
">>>>>>>>>>>>"
,
line
[
6
],
line
[
8
])
if
not
line
[
8
]
or
(
isinstance
(
line
[
8
],
str
)
and
len
(
line
[
8
])
==
0
):
print
(
"remarks is none"
)
continue
sql_str
=
"select id from evm_store_apps where id = {a}"
.
format
(
a
=
int
(
line
[
8
]))
source_cur
.
execute
(
sql_str
)
tmp
=
source_cur
.
fetchone
()
if
not
tmp
:
print
(
"app not found"
)
continue
s
=
1
if
line
[
5
]
and
isinstance
(
line
[
5
],
str
)
and
line
[
5
]
.
find
(
"evueapps"
)
>
-
1
else
0
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
tmp
[
0
],
d
=
line
[
3
],
e
=
line
[
4
],
f
=
line
[
5
],
g
=
line
[
6
],
h
=
line
[
7
],
i
=
line
[
6
],
j
=
line
[
7
],
k
=
0
,
l
=
s
)
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
# 然后查询出所有build log记录,遍历这些记录
# 在循环里,查询这一条记录是否已经存在(根据app_path),不存在则插入
source_cur
.
execute
(
'SELECT id, uuid, app, app_path, app_info, source, create_at, create_by, update_at, update_by, is_delete FROM evm_store_build_logs'
)
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_package (id, uuid, app_name, app_path, app_version, app_info, source, create_at, create_by, update_at, update_by, is_delete) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}', {g}, '{h}', {i}, '{j}', {k}, {l});"
for
line
in
res
:
sql_str
=
"select id, uuid, app_path from evm_store_app_logs where app_path = '{}'"
.
format
(
line
[
3
])
source_cur
.
execute
(
sql_str
)
tmp
=
source_cur
.
fetchone
()
print
(
"=======>"
,
line
[
0
])
if
tmp
:
print
(
"app_path not equal"
)
continue
print
(
"===========>"
,
line
)
sql_str
=
"select app_name, app_version from evm_store_apps where id == {id}"
.
format
(
id
=
line
[
2
])
source_cur
.
execute
(
sql_str
)
app
=
source_cur
.
fetchone
()
print
(
"app:"
,
app
)
if
app
:
s
=
1
if
line
[
5
]
and
isinstance
(
line
[
5
],
str
)
and
line
[
5
]
.
find
(
"evueapps"
)
>
-
1
else
0
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
app
[
0
],
d
=
line
[
3
],
e
=
app
[
1
],
f
=
line
[
4
],
g
=
s
,
h
=
line
[
6
],
i
=
line
[
7
],
j
=
line
[
8
],
k
=
line
[
9
],
l
=
line
[
10
])
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
print
(
"next >>>>>>>>>>>"
)
print
(
"finished!!!"
)
target_conn
.
commit
()
target_conn
.
close
()
source_conn
.
commit
()
source_conn
.
close
()
print
(
"spend time:"
,
datetime
.
now
()
-
start
)
\ No newline at end of file
frontend/src/utils/eventBus.js
View file @
2d47574f
/*
/*
* @Author: your name
* @Author: your name
* @Date: 2021-07-01 15:02:16
* @Date: 2021-07-01 15:02:16
* @LastEditTime: 2021-07-2
0 23:30:33
* @LastEditTime: 2021-07-2
1 16:16:36
* @LastEditors: Please set LastEditors
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @Description: In User Settings Edit
* @FilePath: \evm-store\frontend\src\utils\eventBus.js
* @FilePath: \evm-store\frontend\src\utils\eventBus.js
...
...
frontend/src/views/system/monitor.vue
View file @
2d47574f
...
@@ -252,9 +252,8 @@
...
@@ -252,9 +252,8 @@
:data=
"imageList"
:data=
"imageList"
size=
"mini"
size=
"mini"
border
border
stripe
fit
fit
highlight-current-row
:row-class-name=
"tableRowClassName"
>
>
<el-table-column
<el-table-column
prop=
"uri"
prop=
"uri"
...
@@ -405,6 +404,9 @@ export default {
...
@@ -405,6 +404,9 @@ export default {
SystemChart
,
SystemChart
,
},
},
methods
:
{
methods
:
{
tableRowClassName
({
row
})
{
return
row
.
highlight
?
"
success-row
"
:
""
;
},
moveEvent
(
i
,
newX
,
newY
)
{
moveEvent
(
i
,
newX
,
newY
)
{
const
msg
=
"
MOVE i=
"
+
i
+
"
, X=
"
+
newX
+
"
, Y=
"
+
newY
;
const
msg
=
"
MOVE i=
"
+
i
+
"
, X=
"
+
newX
+
"
, Y=
"
+
newY
;
console
.
log
(
msg
);
console
.
log
(
msg
);
...
@@ -536,7 +538,8 @@ export default {
...
@@ -536,7 +538,8 @@ export default {
this
.
deviceList
.
push
(
msg
.
imei
);
this
.
deviceList
.
push
(
msg
.
imei
);
}
}
if
(
!
this
.
device
)
{
if
(
!
this
.
device
)
{
if
(
this
.
deviceList
&&
this
.
deviceList
.
length
)
this
.
device
=
this
.
deviceList
[
0
];
if
(
this
.
deviceList
&&
this
.
deviceList
.
length
)
this
.
device
=
this
.
deviceList
[
0
];
else
this
.
device
=
msg
.
imei
;
else
this
.
device
=
msg
.
imei
;
}
}
...
@@ -575,37 +578,57 @@ export default {
...
@@ -575,37 +578,57 @@ export default {
this
.
evmList
=
[{
...
this
.
globalData
.
evm
}];
this
.
evmList
=
[{
...
this
.
globalData
.
evm
}];
this
.
lvglList
=
[{
...
this
.
globalData
.
lvgl
}];
this
.
lvglList
=
[{
...
this
.
globalData
.
lvgl
}];
this
.
systemList
=
[{
imei
:
this
.
globalData
.
imei
,
...
this
.
globalData
.
system
,
...
this
.
globalData
.
request
}];
this
.
systemList
=
[
{
imei
:
this
.
globalData
.
imei
,
...
this
.
globalData
.
system
,
...
this
.
globalData
.
request
,
},
];
// 这里需要特殊处理下,先判断uri是否存在,不存在则添加,存在则更新
// 这里需要特殊处理下,先判断uri是否存在,不存在则添加,存在则更新
let
uris
=
[];
let
uris
=
[];
this
.
imageList
.
forEach
((
img
)
=>
{
this
.
imageList
.
forEach
((
item
)
=>
{
uris
.
push
(
img
.
uri
);
item
.
highlight
=
false
;
uris
.
push
(
item
.
uri
);
});
});
this
.
globalData
.
image
&&
this
.
globalData
.
image
&&
this
.
globalData
.
image
.
forEach
((
item
)
=>
{
this
.
globalData
.
image
.
forEach
((
item
)
=>
{
const
target
=
this
.
imageList
.
find
(
img
=>
img
.
uri
===
item
.
uri
)
if
(
item
.
png_uncompressed_size
>
0
)
{
item
.
highlight
=
true
;
}
else
{
item
.
highlight
=
false
;
}
const
target
=
this
.
imageList
.
find
((
img
)
=>
img
.
uri
===
item
.
uri
);
if
(
target
)
{
if
(
target
)
{
if
(
item
.
png_uncompressed_size
&&
item
.
png_uncompressed_size
!==
target
.
png_uncompressed_size
)
target
.
length
=
item
.
length
;
target
.
png_uncompressed_size
=
item
.
png_uncompressed_size
target
.
png_total_count
=
item
.
png_total_count
;
if
(
item
.
png_file_size
&&
item
.
png_file_size
!==
target
.
png_file_size
)
target
.
highlight
=
false
;
target
.
png_file_size
=
item
.
png_file_size
if
(
target
.
length
=
item
.
length
item
.
png_uncompressed_size
&&
target
.
png_total_count
=
item
.
png_total_count
item
.
png_uncompressed_size
!==
target
.
png_uncompressed_size
)
{
target
.
highlight
=
true
;
target
.
png_uncompressed_size
=
item
.
png_uncompressed_size
;
}
if
(
item
.
png_file_size
&&
item
.
png_file_size
!==
target
.
png_file_size
)
target
.
png_file_size
=
item
.
png_file_size
;
}
else
{
}
else
{
this
.
imageList
.
push
(
item
)
this
.
imageList
.
push
(
item
)
;
}
}
});
});
if
(
this
.
globalData
)
{
if
(
this
.
globalData
)
{
if
(
this
.
globalData
.
evm
)
if
(
this
.
globalData
.
evm
)
this
.
evm
=
this
.
globalData
.
evm
;
this
.
evm
=
this
.
globalData
.
evm
;
if
(
this
.
globalData
.
lvgl
)
this
.
lvgl
=
this
.
globalData
.
lvgl
;
if
(
this
.
globalData
.
lvgl
)
if
(
this
.
globalData
.
image
)
this
.
image
=
this
.
globalData
.
image
;
this
.
lvgl
=
this
.
globalData
.
lvgl
;
if
(
this
.
globalData
.
system
)
this
.
system
=
this
.
globalData
.
system
;
if
(
this
.
globalData
.
image
)
this
.
image
=
this
.
globalData
.
image
;
if
(
this
.
globalData
.
system
)
this
.
system
=
this
.
globalData
.
system
;
}
}
},
},
},
},
...
@@ -633,6 +656,8 @@ export default {
...
@@ -633,6 +656,8 @@ export default {
};
};
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@import
"./style.css"
;
.app-container
{
.app-container
{
&
>
div
.page-wrapper
{
&
>
div
.page-wrapper
{
margin
:
10px
0px
;
margin
:
10px
0px
;
...
...
frontend/src/views/system/style.css
0 → 100644
View file @
2d47574f
.el-table
.warning-row
{
background
:
red
;
}
.el-table
.success-row
{
background
:
greenyellow
;
}
tools/build_out/controllers/monitor.py
View file @
2d47574f
'''
'''
Author: your name
Author: your name
Date: 2021-06-29 19:24:32
Date: 2021-06-29 19:24:32
LastEditTime: 2021-07-2
0 01:18:45
LastEditTime: 2021-07-2
1 18:37:59
LastEditors: Please set LastEditors
LastEditors: Please set LastEditors
Description: In User Settings Edit
Description: In User Settings Edit
FilePath:
\
evm-store
\b
ackend
\
controller
\
monitor.py
FilePath:
\
evm-store
\b
ackend
\
controller
\
monitor.py
...
@@ -20,7 +20,11 @@ class SystemResource(object):
...
@@ -20,7 +20,11 @@ class SystemResource(object):
return
MonitorSystemModel
.
query
.
all
()
return
MonitorSystemModel
.
query
.
all
()
def
post
(
self
,
params
):
def
post
(
self
,
params
):
result
=
MonitorSystemModel
(
**
params
)
data
=
dict
()
for
k
in
params
:
if
hasattr
(
MonitorSystemModel
,
k
):
data
[
k
]
=
params
[
k
]
result
=
MonitorSystemModel
(
**
data
)
db
.
session
.
add
(
result
)
db
.
session
.
add
(
result
)
db
.
session
.
commit
()
db
.
session
.
commit
()
return
True
return
True
...
@@ -30,7 +34,11 @@ class LvglResource(object):
...
@@ -30,7 +34,11 @@ class LvglResource(object):
return
MonitorLvglModel
.
query
.
all
()
return
MonitorLvglModel
.
query
.
all
()
def
post
(
self
,
params
):
def
post
(
self
,
params
):
result
=
MonitorLvglModel
(
**
params
)
data
=
dict
()
for
k
in
params
:
if
hasattr
(
MonitorLvglModel
,
k
):
data
[
k
]
=
params
[
k
]
result
=
MonitorLvglModel
(
**
data
)
db
.
session
.
add
(
result
)
db
.
session
.
add
(
result
)
db
.
session
.
commit
()
db
.
session
.
commit
()
return
True
return
True
...
@@ -50,7 +58,11 @@ class ImageResource(object):
...
@@ -50,7 +58,11 @@ class ImageResource(object):
return
MonitorImageModel
.
query
.
all
()
return
MonitorImageModel
.
query
.
all
()
def
post
(
self
,
params
):
def
post
(
self
,
params
):
result
=
MonitorImageModel
(
**
params
)
data
=
dict
()
for
k
in
params
:
if
hasattr
(
MonitorImageModel
,
k
):
data
[
k
]
=
params
[
k
]
result
=
MonitorImageModel
(
**
data
)
db
.
session
.
add
(
result
)
db
.
session
.
add
(
result
)
db
.
session
.
commit
()
db
.
session
.
commit
()
return
True
return
True
...
@@ -58,8 +70,13 @@ class ImageResource(object):
...
@@ -58,8 +70,13 @@ class ImageResource(object):
def
post_array
(
self
,
array
,
watch
):
def
post_array
(
self
,
array
,
watch
):
t
=
[]
t
=
[]
for
a
in
array
:
for
a
in
array
:
a
.
update
({
"watch"
:
watch
})
data
=
dict
()
t
.
append
(
a
)
for
k
in
a
:
if
hasattr
(
MonitorImageModel
,
k
):
data
[
k
]
=
a
[
k
]
data
.
update
({
"watch"
:
watch
})
t
.
append
(
data
)
db
.
session
.
execute
(
MonitorImageModel
.
__table__
.
insert
(),
t
)
db
.
session
.
execute
(
MonitorImageModel
.
__table__
.
insert
(),
t
)
db
.
session
.
commit
()
db
.
session
.
commit
()
...
@@ -72,32 +89,33 @@ imageResource = ImageResource()
...
@@ -72,32 +89,33 @@ imageResource = ImageResource()
def
insert_data
(
msg
):
def
insert_data
(
msg
):
# 先判断手表imei是否存在,不存在则先注册手表IMEI
# 先判断手表imei是否存在,不存在则先注册手表IMEI
watch_id
=
-
1
device_id
=
-
1
if
msg
.
get
(
"imei"
):
if
not
msg
.
get
(
"imei"
):
result
=
DeviceModel
.
query
.
filter_by
(
imei
=
msg
.
get
(
"imei"
))
.
one_or_none
()
return
None
if
result
:
watch_id
=
result
.
id
result
=
DeviceModel
.
query
.
filter
(
DeviceModel
.
imei
==
msg
.
get
(
"imei"
))
.
one_or_none
()
else
:
if
not
result
:
result
=
DeviceModel
(
imei
=
msg
.
get
(
"imei"
))
return
None
db
.
session
.
add
(
result
)
db
.
session
.
commit
()
device_id
=
result
.
id
watch_id
=
result
.
id
if
msg
.
get
(
"system"
)
or
msg
.
get
(
"request"
):
if
msg
.
get
(
"system"
)
or
msg
.
get
(
"request"
):
msg
.
get
(
"system"
,
{})
.
update
({
"watch"
:
watch
_id
})
msg
.
get
(
"system"
,
{})
.
update
({
"watch"
:
device
_id
})
msg
.
get
(
"system"
)
.
update
(
msg
.
get
(
"request"
,
{}))
msg
.
get
(
"system"
)
.
update
(
msg
.
get
(
"request"
,
{}))
systemResource
.
post
(
msg
.
get
(
"system"
))
systemResource
.
post
(
msg
.
get
(
"system"
))
if
msg
.
get
(
"lvgl"
):
if
msg
.
get
(
"lvgl"
):
msg
.
get
(
"lvgl"
)
.
update
({
"watch"
:
watch
_id
})
msg
.
get
(
"lvgl"
)
.
update
({
"watch"
:
device
_id
})
lvglResource
.
post
(
msg
.
get
(
"lvgl"
))
lvglResource
.
post
(
msg
.
get
(
"lvgl"
))
if
msg
.
get
(
"evm"
):
if
msg
.
get
(
"evm"
):
msg
.
get
(
"evm"
)
.
update
({
"watch"
:
watch
_id
})
msg
.
get
(
"evm"
)
.
update
({
"watch"
:
device
_id
})
evmResource
.
post
(
msg
.
get
(
"evm"
))
evmResource
.
post
(
msg
.
get
(
"evm"
))
if
msg
.
get
(
"image"
):
if
msg
.
get
(
"image"
):
imageResource
.
post_array
(
msg
.
get
(
"image"
),
watch_id
)
imageResource
.
post_array
(
msg
.
get
(
"image"
),
device_id
)
return
True
def
get_watch_list
():
def
get_watch_list
():
result
=
DeviceModel
.
query
.
all
()
result
=
DeviceModel
.
query
.
all
()
...
...
tools/build_out/models/monitorSystem.py
View file @
2d47574f
'''
Author: your name
Date: 2021-07-15 09:33:39
LastEditTime: 2021-07-21 18:39:45
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
models
\
monitorSystem.py
'''
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf_8 -*-
# -*- coding: utf_8 -*-
...
@@ -10,6 +18,8 @@ class MonitorSystemModel(PrimaryModel):
...
@@ -10,6 +18,8 @@ class MonitorSystemModel(PrimaryModel):
watch
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
watch
=
db
.
Column
(
db
.
Integer
,
nullable
=
False
)
free_size
=
db
.
Column
(
db
.
Integer
,
nullable
=
True
,
default
=
0
)
free_size
=
db
.
Column
(
db
.
Integer
,
nullable
=
True
,
default
=
0
)
free_space_size
=
db
.
Column
(
db
.
Integer
,
nullable
=
True
,
default
=
0
)
used_space_size
=
db
.
Column
(
db
.
Integer
,
nullable
=
True
,
default
=
0
)
host
=
db
.
Column
(
db
.
String
(
20
),
index
=
True
,
nullable
=
False
,
default
=
''
)
host
=
db
.
Column
(
db
.
String
(
20
),
index
=
True
,
nullable
=
False
,
default
=
''
)
path
=
db
.
Column
(
db
.
String
(
20
),
index
=
True
,
nullable
=
False
,
default
=
''
)
path
=
db
.
Column
(
db
.
String
(
20
),
index
=
True
,
nullable
=
False
,
default
=
''
)
protocol
=
db
.
Column
(
db
.
String
(
20
),
index
=
True
,
nullable
=
False
,
default
=
''
)
protocol
=
db
.
Column
(
db
.
String
(
20
),
index
=
True
,
nullable
=
False
,
default
=
''
)
...
@@ -18,9 +28,11 @@ class MonitorSystemModel(PrimaryModel):
...
@@ -18,9 +28,11 @@ class MonitorSystemModel(PrimaryModel):
# db.Index('idx_xxx', 'xxx', mysql_using='btree'),
# db.Index('idx_xxx', 'xxx', mysql_using='btree'),
# )
# )
def
__init__
(
self
,
watch
,
free_size
=
0
,
host
=
''
,
path
=
''
,
protocol
=
''
):
def
__init__
(
self
,
watch
,
free_size
=
0
,
free_space_size
=
0
,
used_space_size
=
0
,
host
=
''
,
path
=
''
,
protocol
=
''
):
self
.
watch
=
watch
self
.
watch
=
watch
self
.
free_size
=
free_size
self
.
free_size
=
free_size
self
.
free_space_size
=
free_space_size
self
.
used_space_size
=
used_space_size
self
.
host
=
host
self
.
host
=
host
self
.
path
=
path
self
.
path
=
path
self
.
protocol
=
protocol
self
.
protocol
=
protocol
...
@@ -32,6 +44,8 @@ class MonitorSystemModel(PrimaryModel):
...
@@ -32,6 +44,8 @@ class MonitorSystemModel(PrimaryModel):
return
{
return
{
'watch'
:
self
.
watch
,
'watch'
:
self
.
watch
,
'free_size'
:
self
.
free_size
,
'free_size'
:
self
.
free_size
,
'free_space_size'
:
self
.
free_space_size
,
'used_space_size'
:
self
.
used_space_size
,
'host'
:
self
.
host
,
'host'
:
self
.
host
,
'path'
:
self
.
path
,
'path'
:
self
.
path
,
'protocol'
:
self
.
protocol
,
'protocol'
:
self
.
protocol
,
...
...
tools/build_out/views/monitor.py
View file @
2d47574f
'''
'''
Author: your name
Author: your name
Date: 2021-06-29 19:33:41
Date: 2021-06-29 19:33:41
LastEditTime: 2021-07-2
0 01:20:4
5
LastEditTime: 2021-07-2
1 19:30:5
5
LastEditors: Please set LastEditors
LastEditors: Please set LastEditors
Description: In User Settings Edit
Description: In User Settings Edit
FilePath:
\
evm-store
\b
ackend
\v
iew
\
monitor.py
FilePath:
\
evm-store
\b
ackend
\v
iew
\
monitor.py
...
@@ -121,7 +121,7 @@ class BaseWebsocket(WebSocketHandler):
...
@@ -121,7 +121,7 @@ class BaseWebsocket(WebSocketHandler):
@
classmethod
@
classmethod
def
broadcastMessage
(
cls
,
message
):
def
broadcastMessage
(
cls
,
message
):
#
pprint.pprint(message)
pprint
.
pprint
(
message
)
print
(
"=======>"
,
cls
.
_clients
)
print
(
"=======>"
,
cls
.
_clients
)
if
not
message
.
get
(
"imei"
):
if
not
message
.
get
(
"imei"
):
...
@@ -155,10 +155,9 @@ class NotifyHandler(BaseWebsocket):
...
@@ -155,10 +155,9 @@ class NotifyHandler(BaseWebsocket):
className
=
self
.
__class__
.
__name__
className
=
self
.
__class__
.
__name__
message
=
json
.
loads
(
message
)
message
=
json
.
loads
(
message
)
# 判断消息类型
# 判断消息类型
if
message
.
get
(
"type"
):
if
message
.
get
(
"type"
)
and
message
.
get
(
"token"
)
:
# 获取token值,检验正确与否,获取uuid
# 获取token值,检验正确与否,获取uuid
payload
=
jwt
.
decode
(
message
.
get
(
"token"
),
config
.
JWT_SECRET_KEY
,
verify
=
True
,
algorithms
=
[
'HS256'
])
payload
=
jwt
.
decode
(
message
.
get
(
"token"
),
config
.
JWT_SECRET_KEY
,
verify
=
True
,
algorithms
=
[
'HS256'
])
logger
.
info
(
payload
)
logger
.
info
(
payload
)
# 认证包,认证不通过,则剔除该连接
# 认证包,认证不通过,则剔除该连接
...
@@ -176,7 +175,6 @@ class NotifyHandler(BaseWebsocket):
...
@@ -176,7 +175,6 @@ class NotifyHandler(BaseWebsocket):
# 查询该用户可查看设备
# 查询该用户可查看设备
devices
=
DeviceModel
.
query
.
filter
(
DeviceModel
.
create_by
==
user
.
id
)
.
all
()
devices
=
DeviceModel
.
query
.
filter
(
DeviceModel
.
create_by
==
user
.
id
)
.
all
()
if
len
(
devices
):
if
len
(
devices
):
logger
.
info
(
"==========================================================>"
)
self
.
_clients
.
append
({
self
.
_clients
.
append
({
'uuid'
:
payload
.
get
(
"sub"
)
.
get
(
"uuid"
),
'uuid'
:
payload
.
get
(
"sub"
)
.
get
(
"uuid"
),
'context'
:
self
,
'context'
:
self
,
...
@@ -196,6 +194,9 @@ class NotifyHandler(BaseWebsocket):
...
@@ -196,6 +194,9 @@ class NotifyHandler(BaseWebsocket):
else
:
else
:
self
.
write_message
(
json
.
dumps
({
'code'
:
200
,
'data'
:
None
,
'msg'
:
'unkonw message packet, disconnect by server'
}))
self
.
write_message
(
json
.
dumps
({
'code'
:
200
,
'data'
:
None
,
'msg'
:
'unkonw message packet, disconnect by server'
}))
self
.
handlers
[
className
]
.
remove
(
self
)
self
.
handlers
[
className
]
.
remove
(
self
)
except
jwt
.
exceptions
.
ExpiredSignatureError
as
e
:
logger
.
error
(
e
)
self
.
write_message
(
json
.
dumps
({
'code'
:
401
,
'data'
:
None
,
'msg'
:
'auth fail'
}))
except
Exception
as
e
:
except
Exception
as
e
:
# 认证失败会导致触发异常,这里不能remove(self),否则会导致on_close方法报错
# 认证失败会导致触发异常,这里不能remove(self),否则会导致on_close方法报错
self
.
write_message
(
json
.
dumps
({
'code'
:
400
,
'data'
:
e
.
args
,
'msg'
:
"server error"
}))
self
.
write_message
(
json
.
dumps
({
'code'
:
400
,
'data'
:
e
.
args
,
'msg'
:
"server error"
}))
...
@@ -230,13 +231,22 @@ class MainHandler(BaseHandler):
...
@@ -230,13 +231,22 @@ class MainHandler(BaseHandler):
self
.
write
(
json
.
dumps
({
"msg"
:
"Hello, world"
}))
self
.
write
(
json
.
dumps
({
"msg"
:
"Hello, world"
}))
def
post
(
self
):
def
post
(
self
):
data
=
tornado
.
escape
.
json_decode
(
self
.
request
.
body
)
if
not
self
.
request
.
body
:
self
.
write
(
json
.
dumps
({
'code'
:
100
,
'data'
:
data
,
'msg'
:
'success'
}))
return
None
message
=
{
'imei'
:
'12345678900005'
,
'type'
:
'report'
,
'system'
:
{
'free_size'
:
0
},
'lvgl'
:
{
'total_size'
:
5242880
,
'free_cnt'
:
31
,
'free_size'
:
1279664
,
'free_biggest_size'
:
1205448
,
'used_cnt'
:
832
,
'used_pct'
:
76
,
'frag_pct'
:
6
},
'evm'
:
{
'total_size'
:
2097152
,
'free_size'
:
0
,
'gc_usage'
:
50
},
'image'
:
[{
'uri'
:
'evue_launcher'
,
'length'
:
1043
,
'png_total_count'
:
0
,
'png_uncompressed_size'
:
0
,
'png_file_size'
:
0
},
{
'uri'
:
'kdgs_1_storyList'
,
'length'
:
9608
,
'png_total_count'
:
193
,
'png_uncompressed_size'
:
370884
,
'png_file_size'
:
209807
}]}
try
:
insert_data
(
message
)
data
=
tornado
.
escape
.
json_decode
(
self
.
request
.
body
)
# 这里不能使用广播,得点对点发送,有此设备的账号才能看到调试信息
logger
.
info
(
data
)
NotifyHandler
.
broadcastMessage
(
message
)
self
.
write
(
json
.
dumps
({
'code'
:
100
,
'data'
:
data
,
'msg'
:
'success'
}))
message
=
{
'imei'
:
'12345678900005'
,
'type'
:
'report'
,
'system'
:
{
'free_size'
:
0
},
'lvgl'
:
{
'total_size'
:
5242880
,
'free_cnt'
:
31
,
'free_size'
:
1279664
,
'free_biggest_size'
:
1205448
,
'used_cnt'
:
832
,
'used_pct'
:
76
,
'frag_pct'
:
6
},
'evm'
:
{
'total_size'
:
2097152
,
'free_size'
:
0
,
'gc_usage'
:
50
},
'image'
:
[{
'uri'
:
'evue_launcher'
,
'length'
:
1043
,
'png_total_count'
:
0
,
'png_uncompressed_size'
:
0
,
'png_file_size'
:
0
},
{
'uri'
:
'kdgs_1_storyList'
,
'length'
:
9608
,
'png_total_count'
:
193
,
'png_uncompressed_size'
:
370884
,
'png_file_size'
:
209807
}]}
insert_data
(
message
)
# 这里不能使用广播,得点对点发送,有此设备的账号才能看到调试信息
NotifyHandler
.
broadcastMessage
(
message
)
except
Exception
as
e
:
logger
.
info
(
self
.
request
.
body
)
logger
.
error
(
e
)
traceback
.
print_exc
()
class
WatchHandler
(
BaseHandler
):
class
WatchHandler
(
BaseHandler
):
def
get
(
self
,
*
args
,
**
kwargs
):
def
get
(
self
,
*
args
,
**
kwargs
):
...
@@ -296,25 +306,31 @@ class DeviceMessageHandler(BaseHandler):
...
@@ -296,25 +306,31 @@ class DeviceMessageHandler(BaseHandler):
def
post
(
self
):
def
post
(
self
):
if
not
self
.
request
.
body
:
if
not
self
.
request
.
body
:
self
.
write
(
json
.
dumps
({
'code'
:
304
,
'data'
:
None
,
'msg'
:
'parmeters error'
})
)
logger
.
info
(
self
.
request
.
body
)
return
return
None
data
=
tornado
.
escape
.
json_decode
(
self
.
request
.
body
)
try
:
# data = tornado.escape.json_decode(self.request.body)
data
.
update
({
'request'
:
{
data
=
str
(
self
.
request
.
body
,
encoding
=
"ISO-8859-1"
)
'host'
:
self
.
request
.
remote_ip
,
data
=
json
.
loads
(
data
)
'path'
:
self
.
request
.
path
,
logger
.
info
(
data
)
'protocol'
:
self
.
request
.
protocol
}
})
data
[
'system'
]
.
update
({
'host'
:
self
.
request
.
remote_ip
,
logger
.
info
(
data
)
'path'
:
self
.
request
.
path
,
'protocol'
:
self
.
request
.
protocol
insert_data
(
data
)
})
data
[
'type'
]
=
'report'
result
=
insert_data
(
data
)
data
[
'request'
]
.
update
({
'timestamp'
:
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
})
NotifyHandler
.
broadcastMessage
(
data
)
data
[
'type'
]
=
'report'
self
.
write
(
json
.
dumps
({
'code'
:
100
,
'message'
:
'success'
}))
data
[
'system'
]
.
update
({
'timestamp'
:
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
})
NotifyHandler
.
broadcastMessage
(
data
)
self
.
write
(
json
.
dumps
({
'code'
:
100
if
result
else
400
,
'message'
:
'success'
if
result
else
"fail"
}))
except
Exception
as
e
:
logger
.
info
(
self
.
request
.
body
)
logger
.
error
(
e
)
traceback
.
print_exc
()
def
make_app
():
def
make_app
():
return
tornado
.
web
.
Application
([
return
tornado
.
web
.
Application
([
...
...
tools/database_migration.py
View file @
2d47574f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
'''
'''
Author: your name
Author: your name
Date: 2021-07-20 19:04:27
Date: 2021-07-20 19:04:27
LastEditTime: 2021-07-21
13:34:32
LastEditTime: 2021-07-21
20:01:56
LastEditors: Please set LastEditors
LastEditors: Please set LastEditors
Description: In User Settings Edit
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\
database_migration.py
FilePath:
\
evm-store
\t
ools
\
database_migration.py
...
@@ -12,15 +12,19 @@ FilePath: \evm-store\tools\database_migration.py
...
@@ -12,15 +12,19 @@ FilePath: \evm-store\tools\database_migration.py
import
os
import
os
import
sqlite3
import
sqlite3
import
uuid
import
uuid
from
datetime
import
datetime
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
print
(
"####>>>"
,
BASE_DIR
)
print
(
"####>>>"
,
BASE_DIR
)
start
=
datetime
.
now
()
print
(
"start at:"
,
start
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
))
source_conn
=
sqlite3
.
connect
(
os
.
path
.
join
(
BASE_DIR
,
"app-store.db"
))
source_conn
=
sqlite3
.
connect
(
os
.
path
.
join
(
BASE_DIR
,
"app-store.db"
))
source_cur
=
source_conn
.
cursor
()
source_cur
=
source_conn
.
cursor
()
target_db
=
os
.
path
.
join
(
BASE_DIR
,
"evue
_
store.db"
)
target_db
=
os
.
path
.
join
(
BASE_DIR
,
"evue
-
store.db"
)
target_conn
=
sqlite3
.
connect
(
target_db
)
target_conn
=
sqlite3
.
connect
(
target_db
)
target_cur
=
source_conn
.
cursor
()
target_cur
=
source_conn
.
cursor
()
...
@@ -51,6 +55,19 @@ with open("database_migration.sql", "w+") as fd:
...
@@ -51,6 +55,19 @@ with open("database_migration.sql", "w+") as fd:
source_cur
.
execute
(
sql_str
)
source_cur
.
execute
(
sql_str
)
source_conn
.
commit
()
source_conn
.
commit
()
# 更新app logs 表
sql_str
=
"select create_at from evm_store_app_logs"
source_cur
.
execute
(
sql_str
)
res
=
source_cur
.
fetchall
()
for
line
in
res
:
sql_str
=
"select id from evm_store_apps where strftime('
%
s', evm_store_apps.create_at) - strftime('
%
s', '{b}') < 2"
.
format
(
b
=
line
[
0
])
source_cur
.
execute
(
sql_str
)
tmp
=
source_cur
.
fetchone
()
if
tmp
:
sql_str
=
"UPDATE evm_store_app_logs SET remarks = {a};"
.
format
(
a
=
tmp
[
0
])
source_cur
.
execute
(
sql_str
)
source_conn
.
commit
()
# 先插入user表
# 先插入user表
source_cur
.
execute
(
'SELECT account, username, password, email, phone, create_at, create_by, update_at, update_by FROM evm_store_user'
)
source_cur
.
execute
(
'SELECT account, username, password, email, phone, create_at, create_by, update_at, update_by FROM evm_store_user'
)
sql
=
"insert into evm_user (id, uuid, account, username, password, email, phone, create_at, create_by, update_at, update_by, is_delete, role) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}', '{g}', '{h}', {i}, '{j}', {k}, 0, 0);"
sql
=
"insert into evm_user (id, uuid, account, username, password, email, phone, create_at, create_by, update_at, update_by, is_delete, role) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}', '{g}', '{h}', {i}, '{j}', {k}, 0, 0);"
...
@@ -89,7 +106,10 @@ with open("database_migration.sql", "w+") as fd:
...
@@ -89,7 +106,10 @@ with open("database_migration.sql", "w+") as fd:
res
=
source_cur
.
fetchall
()
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_annex (id, uuid, app, title, path, size, create_at, create_by, update_at, update_by, is_delete) values ({a}, '{b}', {c}, '{d}', '{e}', {f}, '{g}', {h}, '{i}', {j}, 0);"
sql
=
"insert into evm_annex (id, uuid, app, title, path, size, create_at, create_by, update_at, update_by, is_delete) values ({a}, '{b}', {c}, '{d}', '{e}', {f}, '{g}', {h}, '{i}', {j}, 0);"
for
line
in
res
:
for
line
in
res
:
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
2
],
d
=
line
[
3
],
e
=
line
[
4
],
f
=
line
[
5
],
g
=
line
[
6
],
h
=
line
[
7
],
i
=
line
[
8
],
j
=
line
[
9
])
if
not
line
[
2
]:
continue
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
2
],
d
=
line
[
3
],
e
=
line
[
4
]
or
""
,
f
=
line
[
5
],
g
=
line
[
6
],
h
=
line
[
7
],
i
=
line
[
8
],
j
=
line
[
9
])
# target_cur.execute(sql_str)
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
target_conn
.
commit
()
...
@@ -97,7 +117,7 @@ with open("database_migration.sql", "w+") as fd:
...
@@ -97,7 +117,7 @@ with open("database_migration.sql", "w+") as fd:
# app
# app
source_cur
.
execute
(
'SELECT id, app_name, app_icon, app_version, category, app_url, app_desc, create_at, create_by ,update_at, update_by, is_delete FROM evm_store_apps'
)
source_cur
.
execute
(
'SELECT id, app_name, app_icon, app_version, category, app_url, app_desc, create_at, create_by ,update_at, update_by, is_delete FROM evm_store_apps'
)
res
=
source_cur
.
fetchall
()
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_app (id, uuid, app_name, app_icon, app_version, category, download_url, app_screen_size, app_arch, app_review, meta_data, remarks, create_at, create_by, update_at, update_by, is_delete
) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}', '{g}', '{h}', '{i}', '{j}', '{k}', '{l}', '{m}', {n}, '{o}', {p}
0);"
sql
=
"insert into evm_app (id, uuid, app_name, app_icon, app_version, category, download_url, app_screen_size, app_arch, app_review, meta_data, remarks, create_at, create_by, update_at, update_by, is_delete
, launcher, developer, app_file_size) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}', '{g}', '{h}', '{i}', '{j}', '{k}', '{l}', '{m}', {n}, '{o}', {p}, 0, `""`, `""`,
0);"
for
line
in
res
:
for
line
in
res
:
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
1
],
d
=
line
[
2
],
e
=
line
[
3
],
f
=
line
[
4
],
g
=
line
[
5
],
h
=
"240 * 240"
,
i
=
"ASR3601"
,
j
=
0
,
k
=
'{}'
,
l
=
line
[
6
],
m
=
line
[
7
],
n
=
line
[
8
],
o
=
line
[
9
],
p
=
line
[
10
])
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
1
],
d
=
line
[
2
],
e
=
line
[
3
],
f
=
line
[
4
],
g
=
line
[
5
],
h
=
"240 * 240"
,
i
=
"ASR3601"
,
j
=
0
,
k
=
'{}'
,
l
=
line
[
6
],
m
=
line
[
7
],
n
=
line
[
8
],
o
=
line
[
9
],
p
=
line
[
10
])
# target_cur.execute(sql_str)
# target_cur.execute(sql_str)
...
@@ -116,12 +136,23 @@ with open("database_migration.sql", "w+") as fd:
...
@@ -116,12 +136,23 @@ with open("database_migration.sql", "w+") as fd:
# app log & build log
# app log & build log
# 先插入app log
# 先插入app log
source_cur
.
execute
(
'SELECT id, uuid, app_name, app_path, app_version, app_info, create_at, create_by FROM evm_store_app_logs'
)
source_cur
.
execute
(
'SELECT id, uuid, app_name, app_path, app_version, app_info, create_at, create_by
, remarks
FROM evm_store_app_logs'
)
res
=
source_cur
.
fetchall
()
res
=
source_cur
.
fetchall
()
sql
=
"insert into evm_package (id, uuid, app
_name, app_path, app_version, app_info, create_at, create_by, update_at, update_by, is_delete, source) values ({a}, '{b}', '{c}', '{d}', '{e}', '{f}'
, '{g}', {h}, '{i}', {j}, {k}, {l});"
sql
=
"insert into evm_package (id, uuid, app
, app_path, app_version, app_info, create_at, create_by, update_at, update_by, is_delete, source) values ({a}, '{b}', '{c}', '{d}', '{e}', `'{f}'`
, '{g}', {h}, '{i}', {j}, {k}, {l});"
for
line
in
res
:
for
line
in
res
:
# 根据时间查找app
print
(
">>>>>>>>>>>>"
,
line
[
6
],
line
[
8
])
if
not
line
[
8
]
or
(
isinstance
(
line
[
8
],
str
)
and
len
(
line
[
8
])
==
0
):
print
(
"remarks is none"
)
continue
sql_str
=
"select id from evm_store_apps where id = {a}"
.
format
(
a
=
int
(
line
[
8
]))
source_cur
.
execute
(
sql_str
)
tmp
=
source_cur
.
fetchone
()
if
not
tmp
:
print
(
"app not found"
)
continue
s
=
1
if
line
[
5
]
and
isinstance
(
line
[
5
],
str
)
and
line
[
5
]
.
find
(
"evueapps"
)
>
-
1
else
0
s
=
1
if
line
[
5
]
and
isinstance
(
line
[
5
],
str
)
and
line
[
5
]
.
find
(
"evueapps"
)
>
-
1
else
0
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
line
[
2
],
d
=
line
[
3
],
e
=
line
[
4
],
f
=
line
[
5
],
g
=
line
[
6
],
h
=
line
[
7
],
i
=
line
[
6
],
j
=
line
[
7
],
k
=
0
,
l
=
s
)
sql_str
=
sql
.
format
(
a
=
line
[
0
],
b
=
uuid
.
uuid1
()
.
hex
,
c
=
tmp
[
0
],
d
=
line
[
3
],
e
=
line
[
4
],
f
=
line
[
5
],
g
=
line
[
6
],
h
=
line
[
7
],
i
=
line
[
6
],
j
=
line
[
7
],
k
=
0
,
l
=
s
)
# target_cur.execute(sql_str)
# target_cur.execute(sql_str)
fd
.
write
(
sql_str
+
"
\n
"
)
fd
.
write
(
sql_str
+
"
\n
"
)
target_conn
.
commit
()
target_conn
.
commit
()
...
@@ -137,6 +168,7 @@ with open("database_migration.sql", "w+") as fd:
...
@@ -137,6 +168,7 @@ with open("database_migration.sql", "w+") as fd:
tmp
=
source_cur
.
fetchone
()
tmp
=
source_cur
.
fetchone
()
print
(
"=======>"
,
line
[
0
])
print
(
"=======>"
,
line
[
0
])
if
tmp
:
if
tmp
:
print
(
"app_path not equal"
)
continue
continue
print
(
"===========>"
,
line
)
print
(
"===========>"
,
line
)
...
@@ -159,3 +191,6 @@ with open("database_migration.sql", "w+") as fd:
...
@@ -159,3 +191,6 @@ with open("database_migration.sql", "w+") as fd:
source_conn
.
commit
()
source_conn
.
commit
()
source_conn
.
close
()
source_conn
.
close
()
print
(
"spend time:"
,
datetime
.
now
()
-
start
)
\ No newline at end of file
tools/frontend/src/views/Application/Monitor.vue
View file @
2d47574f
...
@@ -208,7 +208,7 @@
...
@@ -208,7 +208,7 @@
@
container-resized=
"containerResizedEvent"
@
container-resized=
"containerResizedEvent"
@
moved=
"movedEvent"
@
moved=
"movedEvent"
>
>
<
EvmChart
:chartData=
"evm"
></Ev
mChart>
<
SystemChart
:chartData=
"system"
></Syste
mChart>
</grid-item>
</grid-item>
<grid-item
<grid-item
:x=
"0"
:x=
"0"
...
@@ -221,6 +221,20 @@
...
@@ -221,6 +221,20 @@
@
resized=
"resizedEvent"
@
resized=
"resizedEvent"
@
container-resized=
"containerResizedEvent"
@
container-resized=
"containerResizedEvent"
@
moved=
"movedEvent"
@
moved=
"movedEvent"
>
<EvmChart
:chartData=
"evm"
></EvmChart>
</grid-item>
<grid-item
:x=
"0"
:y=
"34"
:w=
"12"
:h=
"7"
i=
"8"
@
resize=
"resizeEvent"
@
move=
"moveEvent"
@
resized=
"resizedEvent"
@
container-resized=
"containerResizedEvent"
@
moved=
"movedEvent"
>
>
<LvglChart
:chartData=
"lvgl"
></LvglChart>
<LvglChart
:chartData=
"lvgl"
></LvglChart>
</grid-item>
</grid-item>
...
@@ -245,6 +259,7 @@ import {
...
@@ -245,6 +259,7 @@ import {
Input
,
Input
,
Select
,
Select
,
DatePicker
,
DatePicker
,
message
,
}
from
"
ant-design-vue
"
;
}
from
"
ant-design-vue
"
;
import
PageHeaderWrapper
from
"
@/components/PageHeaderWrapper
"
;
import
PageHeaderWrapper
from
"
@/components/PageHeaderWrapper
"
;
import
DescriptionItem
from
"
@/components/DescriptionItem
"
;
import
DescriptionItem
from
"
@/components/DescriptionItem
"
;
...
@@ -252,6 +267,7 @@ import DescriptionItem from "@/components/DescriptionItem";
...
@@ -252,6 +267,7 @@ import DescriptionItem from "@/components/DescriptionItem";
import
{
getWatchList
,
getMonitorData
}
from
"
@/api/openapi
"
;
import
{
getWatchList
,
getMonitorData
}
from
"
@/api/openapi
"
;
import
EvmChart
from
"
./components/EvmChart
"
;
import
EvmChart
from
"
./components/EvmChart
"
;
import
LvglChart
from
"
./components/LvglChart
"
;
import
LvglChart
from
"
./components/LvglChart
"
;
import
SystemChart
from
"
./components/SystemChart
"
;
import
{
GridLayout
,
GridItem
}
from
"
vue-grid-layout
"
;
import
{
GridLayout
,
GridItem
}
from
"
vue-grid-layout
"
;
import
{
wsNotify
}
from
"
@/utils/notify.js
"
;
import
{
wsNotify
}
from
"
@/utils/notify.js
"
;
export
default
{
export
default
{
...
@@ -259,9 +275,11 @@ export default {
...
@@ -259,9 +275,11 @@ export default {
data
()
{
data
()
{
return
{
return
{
watchs
:
[],
watchs
:
[],
globalData
:
null
,
device
:
null
,
device
:
null
,
devices
:
{},
devices
:
{},
deviceList
:
[],
deviceList
:
[],
systemList
:
[],
system
:
{
system
:
{
host
:
null
,
host
:
null
,
imei
:
null
,
imei
:
null
,
...
@@ -289,7 +307,7 @@ export default {
...
@@ -289,7 +307,7 @@ export default {
imageList
:
[],
imageList
:
[],
socket
:
null
,
socket
:
null
,
form
:
{
form
:
{
system
:
[
"
free_size
"
],
system
:
[
"
free_size
"
,
"
free_space_size
"
,
"
used_space_size
"
],
lvgl
:
[
"
total_size
"
,
"
free_size
"
,
"
free_biggest_size
"
],
lvgl
:
[
"
total_size
"
,
"
free_size
"
,
"
free_biggest_size
"
],
evm
:
[
evm
:
[
"
total_size
"
,
"
total_size
"
,
...
@@ -303,13 +321,14 @@ export default {
...
@@ -303,13 +321,14 @@ export default {
image
:
[
"
png_uncompressed_size
"
,
"
png_file_size
"
,
"
length
"
],
image
:
[
"
png_uncompressed_size
"
,
"
png_file_size
"
,
"
length
"
],
},
},
layout
:
[
layout
:
[
{
x
:
0
,
y
:
0
,
w
:
6
,
h
:
5
,
i
:
"
0
"
,
static
:
false
},
{
x
:
0
,
y
:
0
,
w
:
6
,
h
:
5
,
i
:
"
1
"
,
static
:
false
},
{
x
:
6
,
y
:
0
,
w
:
6
,
h
:
5
,
i
:
"
1
"
,
static
:
true
},
{
x
:
6
,
y
:
0
,
w
:
6
,
h
:
5
,
i
:
"
2
"
,
static
:
true
},
{
x
:
0
,
y
:
5
,
w
:
6
,
h
:
5
,
i
:
"
2
"
,
static
:
false
},
{
x
:
0
,
y
:
5
,
w
:
6
,
h
:
5
,
i
:
"
3
"
,
static
:
false
},
{
x
:
6
,
y
:
5
,
w
:
6
,
h
:
5
,
i
:
"
3
"
,
static
:
false
},
{
x
:
6
,
y
:
5
,
w
:
6
,
h
:
5
,
i
:
"
4
"
,
static
:
false
},
{
x
:
0
,
y
:
10
,
w
:
12
,
h
:
10
,
i
:
"
4
"
,
static
:
false
},
{
x
:
0
,
y
:
10
,
w
:
12
,
h
:
10
,
i
:
"
5
"
,
static
:
false
},
{
x
:
0
,
y
:
20
,
w
:
12
,
h
:
7
,
i
:
"
5
"
,
static
:
false
},
{
x
:
0
,
y
:
20
,
w
:
12
,
h
:
7
,
i
:
"
6
"
,
static
:
false
},
{
x
:
0
,
y
:
27
,
w
:
12
,
h
:
7
,
i
:
"
6
"
,
static
:
false
},
{
x
:
0
,
y
:
27
,
w
:
12
,
h
:
7
,
i
:
"
7
"
,
static
:
false
},
{
x
:
0
,
y
:
34
,
w
:
12
,
h
:
7
,
i
:
"
8
"
,
static
:
false
},
],
],
draggable
:
true
,
draggable
:
true
,
resizable
:
true
,
resizable
:
true
,
...
@@ -320,6 +339,7 @@ export default {
...
@@ -320,6 +339,7 @@ export default {
GridItem
,
GridItem
,
EvmChart
,
EvmChart
,
LvglChart
,
LvglChart
,
SystemChart
,
APageHeaderWrapper
:
PageHeaderWrapper
,
APageHeaderWrapper
:
PageHeaderWrapper
,
AAvatar
:
Avatar
,
AAvatar
:
Avatar
,
ARow
:
Row
,
ARow
:
Row
,
...
@@ -461,7 +481,17 @@ export default {
...
@@ -461,7 +481,17 @@ export default {
this
.
socket
.
send
(
message
);
this
.
socket
.
send
(
message
);
},
},
handleMessage
(
msg
)
{
handleMessage
(
msg
)
{
if
(
msg
.
type
!==
"
report
"
||
!
msg
.
imei
)
return
false
;
if
(
msg
.
code
==
401
)
{
window
.
sessionStorage
.
removeItem
(
"
Authorization
"
)
this
.
$router
.
push
({
path
:
"
/user/login
"
})
message
.
error
(
msg
.
msg
)
return
null
;
}
if
(
msg
.
type
!==
"
report
"
||
!
msg
.
imei
)
return
null
;
// 如果接收到的数据不是当前选中的设备,那么则直接丢弃
// 这里可以优化,将所有数据,保存到indexed datebase中
if
(
this
.
device
&&
msg
.
imei
!=
this
.
device
)
return
null
;
if
(
!
this
.
deviceList
)
{
if
(
!
this
.
deviceList
)
{
this
.
deviceList
=
[];
this
.
deviceList
=
[];
...
@@ -470,12 +500,15 @@ export default {
...
@@ -470,12 +500,15 @@ export default {
this
.
deviceList
.
push
(
msg
.
imei
);
this
.
deviceList
.
push
(
msg
.
imei
);
}
}
if
(
!
this
.
device
)
{
if
(
!
this
.
device
)
{
if
(
this
.
deviceList
&&
this
.
deviceList
.
length
)
this
.
device
=
this
.
deviceList
[
0
];
if
(
this
.
deviceList
&&
this
.
deviceList
.
length
)
this
.
device
=
this
.
deviceList
[
0
];
else
this
.
device
=
msg
.
imei
;
else
this
.
device
=
msg
.
imei
;
}
}
this
.
devices
[
msg
.
imei
]
=
msg
;
// 处理单位
this
.
processData
(
msg
);
this
.
processData
(
msg
);
// this.devices[msg.imei] = msg;
this
.
globalData
=
msg
;
this
.
resetData
();
this
.
resetData
();
},
},
processData
(
msg
)
{
processData
(
msg
)
{
...
@@ -498,37 +531,65 @@ export default {
...
@@ -498,37 +531,65 @@ export default {
},
},
onSelectChange
(
res
)
{
onSelectChange
(
res
)
{
this
.
device
=
res
;
this
.
device
=
res
;
this
.
processData
(
this
.
devices
[
this
.
device
]);
//
this.processData(this.devices[this.device]);
this
.
resetData
();
//
this.resetData();
console
.
log
(
res
);
console
.
log
(
res
);
},
},
resetData
()
{
resetData
()
{
wsNotify
.
eventBus
.
$emit
(
"
resize
"
);
wsNotify
.
eventBus
.
$emit
(
"
resize
"
);
this
.
evmList
=
[{
...
this
.
devices
[
this
.
device
].
evm
}];
this
.
evmList
=
[{
...
this
.
globalData
.
evm
}];
this
.
lvglList
=
[{
...
this
.
devices
[
this
.
device
].
lvgl
}];
this
.
lvglList
=
[{
...
this
.
globalData
.
lvgl
}];
this
.
system
=
{
imei
:
this
.
devices
[
this
.
device
].
imei
,
...
this
.
devices
[
this
.
device
].
system
,
...
this
.
devices
[
this
.
device
].
request
};
this
.
systemList
=
[
{
imei
:
this
.
globalData
.
imei
,
...
this
.
globalData
.
system
,
},
];
// 这里需要特殊处理下,先判断uri是否存在,不存在则添加,存在则更新
// 这里需要特殊处理下,先判断uri是否存在,不存在则添加,存在则更新
let
uris
=
[];
let
uris
=
[];
this
.
imageList
.
forEach
((
img
)
=>
{
this
.
imageList
.
forEach
((
item
)
=>
{
uris
.
push
(
img
.
uri
);
item
.
highlight
=
false
;
uris
.
push
(
item
.
uri
);
});
});
this
.
devices
[
this
.
device
].
image
&&
this
.
globalData
.
image
&&
this
.
devices
[
this
.
device
].
image
.
forEach
((
item
)
=>
{
this
.
globalData
.
image
.
forEach
((
item
)
=>
{
if
(
!
uris
.
includes
(
item
.
uri
))
{
if
(
item
.
png_uncompressed_size
>
0
)
{
item
.
highlight
=
true
;
}
else
{
item
.
highlight
=
false
;
}
const
target
=
this
.
imageList
.
find
((
img
)
=>
img
.
uri
===
item
.
uri
);
if
(
target
)
{
target
.
length
=
item
.
length
;
target
.
png_total_count
=
item
.
png_total_count
;
target
.
highlight
=
false
;
if
(
item
.
png_uncompressed_size
&&
item
.
png_uncompressed_size
!==
target
.
png_uncompressed_size
)
{
target
.
highlight
=
true
;
target
.
png_uncompressed_size
=
item
.
png_uncompressed_size
;
}
if
(
item
.
png_file_size
&&
item
.
png_file_size
!==
target
.
png_file_size
)
target
.
png_file_size
=
item
.
png_file_size
;
}
else
{
this
.
imageList
.
push
(
item
);
this
.
imageList
.
push
(
item
);
}
}
});
});
// this.imageList = msg.image;
if
(
this
.
devices
[
this
.
device
])
{
if
(
this
.
globalData
)
{
if
(
this
.
devices
[
this
.
device
].
evm
)
if
(
this
.
globalData
.
evm
)
this
.
evm
=
this
.
globalData
.
evm
;
this
.
evm
=
this
.
devices
[
this
.
device
].
evm
;
if
(
this
.
globalData
.
lvgl
)
this
.
lvgl
=
this
.
globalData
.
lvgl
;
if
(
this
.
devices
[
this
.
device
].
lvgl
)
if
(
this
.
globalData
.
image
)
this
.
image
=
this
.
globalData
.
image
;
this
.
lvgl
=
this
.
devices
[
this
.
device
].
lvgl
;
if
(
this
.
globalData
.
system
)
this
.
system
=
this
.
globalData
.
system
;
if
(
this
.
devices
[
this
.
device
].
image
)
this
.
image
=
this
.
devices
[
this
.
device
].
image
;
}
}
},
},
},
},
...
@@ -548,6 +609,7 @@ export default {
...
@@ -548,6 +609,7 @@ export default {
});
});
});
});
wsNotify
.
eventBus
.
$on
(
"
message
"
,
(
message
)
=>
{
wsNotify
.
eventBus
.
$on
(
"
message
"
,
(
message
)
=>
{
console
.
log
(
message
)
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
handleMessage
(
message
);
this
.
handleMessage
(
message
);
});
});
...
...
tools/frontend/src/views/Application/components/SystemChart.vue
0 → 100644
View file @
2d47574f
<
template
>
<div
:class=
"className"
:style=
"
{ height: height, width: width }" />
</
template
>
<
script
>
import
*
as
echarts
from
"
echarts
"
;
require
(
"
echarts/theme/macarons
"
);
// echarts theme
import
resize
from
"
./mixins/resize
"
;
import
{
getDateTimeString
}
from
"
@/utils/utils
"
;
import
{
wsNotify
}
from
"
@/utils/notify.js
"
;
const
seriesData
=
{
free_size
:
[],
free_space_size
:
[],
used_space_size
:
[],
};
export
default
{
mixins
:
[
resize
],
props
:
{
className
:
{
type
:
String
,
default
:
"
chart
"
,
},
width
:
{
type
:
String
,
default
:
"
100%
"
,
},
height
:
{
type
:
String
,
default
:
"
270px
"
,
},
autoResize
:
{
type
:
Boolean
,
default
:
true
,
},
chartData
:
{
type
:
Object
,
required
:
true
,
},
dataList
:
{
type
:
Array
,
required
:
false
,
default
:
()
=>
[],
},
},
data
()
{
return
{
chart
:
null
,
series
:
[
{
name
:
"
free_size
"
,
type
:
"
line
"
,
showSymbol
:
false
,
emphasis
:
{
scale
:
false
,
focus
:
"
series
"
,
blurScope
:
"
coordinateSystem
"
,
},
data
:
seriesData
.
free_size
,
},
{
name
:
"
free_space_size
"
,
type
:
"
line
"
,
showSymbol
:
false
,
emphasis
:
{
focus
:
"
series
"
,
blurScope
:
"
coordinateSystem
"
,
},
data
:
seriesData
.
free_space_size
,
},
{
name
:
"
used_space_size
"
,
type
:
"
line
"
,
showSymbol
:
false
,
emphasis
:
{
focus
:
"
series
"
,
blurScope
:
"
coordinateSystem
"
,
},
data
:
seriesData
.
used_space_size
,
},
],
legendData
:
[
"
free_size
"
,
"
free_space_size
"
,
"
used_space_size
"
],
};
},
watch
:
{
chartData
:
{
deep
:
true
,
handler
(
val
)
{
this
.
handleMessage
(
val
);
},
},
dataList
:
{
deep
:
true
,
handler
(
val
)
{
if
(
val
.
length
>
0
)
this
.
handleData
(
val
);
},
},
},
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
initChart
();
});
wsNotify
.
eventBus
.
$on
(
"
resize
"
,
()
=>
{
if
(
this
.
chart
)
this
.
chart
.
resize
()
});
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
;
}
this
.
chart
.
dispose
();
this
.
chart
=
null
;
},
methods
:
{
handleData
(
data
)
{
Object
.
keys
(
seriesData
).
forEach
(
key
=>
{
seriesData
[
key
]
=
[]
});
this
.
series
.
forEach
(
item
=>
{
item
.
data
=
[]
});
this
.
chart
.
setOption
({
series
:
this
.
series
});
data
.
forEach
((
item
)
=>
{
this
.
handleMessage
(
item
);
});
},
handleMessage
(
data
)
{
Object
.
keys
(
data
).
forEach
((
k
)
=>
{
var
t
=
getDateTimeString
(
new
Date
());
if
(
k
==
"
timestamp
"
)
t
=
data
[
k
];
if
(
this
.
legendData
.
includes
(
k
))
seriesData
[
k
].
push
({
name
:
k
,
value
:
[
t
,
data
[
k
]],
});
});
this
.
$nextTick
(()
=>
{
this
.
chart
&&
this
.
chart
.
setOption
({
series
:
this
.
series
,
});
});
},
initChart
()
{
this
.
chart
=
echarts
.
init
(
this
.
$el
,
"
macarons
"
);
this
.
setOptions
();
},
setOptions
()
{
this
.
chart
.
setOption
({
title
:
{
text
:
"
SYSTEM
"
,
},
grid
:
{
left
:
10
,
right
:
10
,
bottom
:
10
,
top
:
50
,
containLabel
:
true
,
},
xAxis
:
{
type
:
"
time
"
,
splitLine
:
{
},
axisLabel
:
{
formatter
:
"
{HH}:{mm}:{ss}
"
,
},
},
yAxis
:
{
type
:
"
value
"
,
// boundaryGap: [0, "100%"],
splitLine
:
{
},
},
tooltip
:
{
trigger
:
"
axis
"
,
axisPointer
:
{
type
:
"
cross
"
,
animation
:
false
,
},
padding
:
[
5
,
10
],
},
legend
:
{
data
:
this
.
legendData
,
selected
:
{
free_size
:
true
,
free_space_size
:
true
,
used_space_size
:
false
},
},
series
:
this
.
series
,
});
},
},
};
</
script
>
tools/frontend/src/views/User/Login.vue
View file @
2d47574f
...
@@ -163,11 +163,15 @@ export default {
...
@@ -163,11 +163,15 @@ export default {
doLogin
()
{
doLogin
()
{
postLogin
(
this
.
post
)
postLogin
(
this
.
post
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
this
.
$store
.
commit
(
"
frontend/login/setToken
"
,
res
.
data
.
token
);
if
(
res
.
code
==
200
)
{
this
.
$store
.
commit
(
"
frontend/login/setUserInfo
"
,
{
uuid
:
res
.
data
.
uuid
,
name
:
res
.
data
.
name
});
this
.
$store
.
commit
(
"
frontend/login/setToken
"
,
res
.
data
.
token
);
message
.
success
(
res
.
msg
);
this
.
$store
.
commit
(
"
frontend/login/setUserInfo
"
,
{
uuid
:
res
.
data
.
uuid
,
name
:
res
.
data
.
name
});
window
.
sessionStorage
.
setItem
(
"
Authorization
"
,
res
.
data
.
token
)
message
.
success
(
res
.
msg
);
this
.
$router
.
push
({
path
:
"
/
"
});
window
.
sessionStorage
.
setItem
(
"
Authorization
"
,
res
.
data
.
token
)
this
.
$router
.
push
({
path
:
"
/
"
});
}
else
{
message
.
error
(
res
.
msg
)
}
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
message
.
error
(
err
.
msg
)
message
.
error
(
err
.
msg
)
...
...
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