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
ea8f1d97
Commit
ea8f1d97
authored
Jul 09, 2021
by
wanli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
75743db5
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
122 additions
and
19 deletions
+122
-19
tools/a.txt
tools/a.txt
+4
-0
tools/b.txt
tools/b.txt
+4
-0
tools/build_out/application/signal_manager.py
tools/build_out/application/signal_manager.py
+7
-0
tools/build_out/controllers/__init__.py
tools/build_out/controllers/__init__.py
+12
-1
tools/build_out/controllers/app.py
tools/build_out/controllers/app.py
+1
-1
tools/build_out/controllers/area.py
tools/build_out/controllers/area.py
+1
-1
tools/build_out/controllers/login.py
tools/build_out/controllers/login.py
+1
-1
tools/build_out/controllers/package.py
tools/build_out/controllers/package.py
+1
-1
tools/build_out/controllers/user.py
tools/build_out/controllers/user.py
+1
-1
tools/build_out/webcreator/log.py
tools/build_out/webcreator/log.py
+10
-2
tools/config.json
tools/config.json
+7
-4
tools/gen_code.py
tools/gen_code.py
+46
-0
tools/logs/running.log
tools/logs/running.log
+0
-0
tools/modules/evue_photo.png
tools/modules/evue_photo.png
+0
-0
tools/modules/file-manager.py
tools/modules/file-manager.py
+4
-3
tools/modules/file-manager/result.json
tools/modules/file-manager/result.json
+0
-1
tools/modules/result.json
tools/modules/result.json
+12
-0
tools/resources/webcreator/log.py
tools/resources/webcreator/log.py
+10
-2
tools/templates/controller.tpl
tools/templates/controller.tpl
+1
-1
No files found.
tools/a.txt
0 → 100644
View file @
ea8f1d97
123
456
789
123
\ No newline at end of file
tools/b.txt
0 → 100644
View file @
ea8f1d97
123
456
789
123
\ No newline at end of file
tools/build_out/application/signal_manager.py
View file @
ea8f1d97
...
@@ -24,6 +24,13 @@ class SignalManager(object):
...
@@ -24,6 +24,13 @@ class SignalManager(object):
actionPostLogin
=
PySignal
()
actionPostLogin
=
PySignal
()
actionGetListLogin
=
PySignal
()
actionGetListLogin
=
PySignal
()
actionGetLogin
=
PySignal
()
actionGetLogin
=
PySignal
()
# file manager api
actionGetFileInit
=
PySignal
()
actionGetFileContent
=
PySignal
()
actionGetFileTree
=
PySignal
()
actionGetFileDisk
=
PySignal
()
actionGetFileDown
=
PySignal
()
actionGetFilePreview
=
PySignal
()
def
__init__
(
self
):
def
__init__
(
self
):
super
()
.
__init__
()
super
()
.
__init__
()
...
...
tools/build_out/controllers/__init__.py
View file @
ea8f1d97
'''
Author: your name
Date: 2021-06-30 17:43:46
LastEditTime: 2021-07-09 13:10:51
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\b
uild_out
\
controllers
\
__init__.py
'''
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf_8 -*-
# -*- coding: utf_8 -*-
...
@@ -7,6 +15,7 @@ from .app import appManager
...
@@ -7,6 +15,7 @@ from .app import appManager
from
.package
import
packageManager
from
.package
import
packageManager
from
.user
import
userManager
from
.user
import
userManager
from
.login
import
loginManager
from
.login
import
loginManager
from
.file_manager
import
fileManager
def
initConnect
():
def
initConnect
():
signalManager
.
actionPostArea
.
connect
(
areaManager
.
post
)
signalManager
.
actionPostArea
.
connect
(
areaManager
.
post
)
...
@@ -28,4 +37,6 @@ def initConnect():
...
@@ -28,4 +37,6 @@ def initConnect():
signalManager
.
actionPutUser
.
connect
(
userManager
.
put
)
signalManager
.
actionPutUser
.
connect
(
userManager
.
put
)
signalManager
.
actionPostLogin
.
connect
(
loginManager
.
post
)
signalManager
.
actionPostLogin
.
connect
(
loginManager
.
post
)
signalManager
.
actionGetListLogin
.
connect
(
loginManager
.
getList
)
signalManager
.
actionGetListLogin
.
connect
(
loginManager
.
getList
)
signalManager
.
actionGetLogin
.
connect
(
loginManager
.
get
)
signalManager
.
actionGetLogin
.
connect
(
loginManager
.
get
)
\ No newline at end of file
signalManager
.
actionGetFileContent
.
connect
(
fileManager
.
content
)
# signalManager.actionGEt
\ No newline at end of file
tools/build_out/controllers/app.py
View file @
ea8f1d97
...
@@ -2,7 +2,7 @@ from datetime import datetime
...
@@ -2,7 +2,7 @@ from datetime import datetime
from
application.app
import
db
from
application.app
import
db
from
models.app
import
AppModel
from
models.app
import
AppModel
from
webcreator.log
import
logger
from
webcreator.log
import
logger
from
webcreator.response
import
ResponseCode
,
response_result
#
from webcreator.response import ResponseCode, response_result
class
AppResource
(
object
):
class
AppResource
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
...
...
tools/build_out/controllers/area.py
View file @
ea8f1d97
...
@@ -2,7 +2,7 @@ from datetime import datetime
...
@@ -2,7 +2,7 @@ from datetime import datetime
from
application.app
import
db
from
application.app
import
db
from
models.area
import
AreaModel
from
models.area
import
AreaModel
from
webcreator.log
import
logger
from
webcreator.log
import
logger
from
webcreator.response
import
ResponseCode
,
response_result
#
from webcreator.response import ResponseCode, response_result
class
AreaResource
(
object
):
class
AreaResource
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
...
...
tools/build_out/controllers/login.py
View file @
ea8f1d97
...
@@ -2,7 +2,7 @@ from datetime import datetime
...
@@ -2,7 +2,7 @@ from datetime import datetime
from
application.app
import
db
from
application.app
import
db
from
models.login
import
LoginModel
from
models.login
import
LoginModel
from
webcreator.log
import
logger
from
webcreator.log
import
logger
from
webcreator.response
import
ResponseCode
,
response_result
#
from webcreator.response import ResponseCode, response_result
class
LoginResource
(
object
):
class
LoginResource
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
...
...
tools/build_out/controllers/package.py
View file @
ea8f1d97
...
@@ -2,7 +2,7 @@ from datetime import datetime
...
@@ -2,7 +2,7 @@ from datetime import datetime
from
application.app
import
db
from
application.app
import
db
from
models.package
import
PackageModel
from
models.package
import
PackageModel
from
webcreator.log
import
logger
from
webcreator.log
import
logger
from
webcreator.response
import
ResponseCode
,
response_result
#
from webcreator.response import ResponseCode, response_result
class
PackageResource
(
object
):
class
PackageResource
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
...
...
tools/build_out/controllers/user.py
View file @
ea8f1d97
...
@@ -2,7 +2,7 @@ from datetime import datetime
...
@@ -2,7 +2,7 @@ from datetime import datetime
from
application.app
import
db
from
application.app
import
db
from
models.user
import
UserModel
from
models.user
import
UserModel
from
webcreator.log
import
logger
from
webcreator.log
import
logger
from
webcreator.response
import
ResponseCode
,
response_result
#
from webcreator.response import ResponseCode, response_result
class
UserResource
(
object
):
class
UserResource
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
...
...
tools/build_out/webcreator/log.py
View file @
ea8f1d97
'''
Author: your name
Date: 2021-04-22 18:04:15
LastEditTime: 2021-07-09 00:52:08
LastEditors: your name
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\r
esources
\
webcreator
\
log.py
'''
# -*- coding: utf_8 -*-
# -*- coding: utf_8 -*-
############################
############################
...
@@ -17,13 +25,13 @@ fh = RotatingFileHandler("logs/running.log", maxBytes=10 * 1024 * 1024, backupCo
...
@@ -17,13 +25,13 @@ fh = RotatingFileHandler("logs/running.log", maxBytes=10 * 1024 * 1024, backupCo
fh
.
setLevel
(
logging
.
DEBUG
)
fh
.
setLevel
(
logging
.
DEBUG
)
ch
=
logging
.
StreamHandler
()
ch
=
logging
.
StreamHandler
()
ch
.
setLevel
(
logging
.
WARNIN
G
)
ch
.
setLevel
(
logging
.
DEBU
G
)
formatter
=
logging
.
Formatter
(
'[
%(asctime)
s][
%(levelname)7
s][in
%(pathname)
s ->
%(funcName)
s line:
%(lineno)
s]
%(message)
s'
)
formatter
=
logging
.
Formatter
(
'[
%(asctime)
s][
%(levelname)7
s][in
%(pathname)
s ->
%(funcName)
s line:
%(lineno)
s]
%(message)
s'
)
fh
.
setFormatter
(
formatter
)
fh
.
setFormatter
(
formatter
)
ch
.
setFormatter
(
formatter
)
ch
.
setFormatter
(
formatter
)
logger
=
logging
.
root
logger
=
logging
.
root
logger
.
setLevel
(
logging
.
INFO
)
logger
.
setLevel
(
logging
.
DEBUG
)
logger
.
addHandler
(
fh
)
logger
.
addHandler
(
fh
)
logger
.
addHandler
(
ch
)
logger
.
addHandler
(
ch
)
\ No newline at end of file
tools/config.json
View file @
ea8f1d97
...
@@ -24,15 +24,18 @@
...
@@ -24,15 +24,18 @@
},
},
"modules"
:
[
"modules"
:
[
{
{
"file"
:
"modules/user.json"
,
"config"
:
"modules/file-manager.py"
,
"enable"
:
false
"dependencies"
:
[
"modules/evue_photo.png"
],
"enable"
:
true
},
},
{
{
"
file
"
:
"modules/permission.json"
,
"
config
"
:
"modules/permission.json"
,
"enable"
:
false
"enable"
:
false
},
},
{
{
"
file
"
:
"modules/menu.json"
,
"
config
"
:
"modules/menu.json"
,
"enable"
:
false
"enable"
:
false
}
}
],
],
...
...
tools/gen_code.py
View file @
ea8f1d97
from
fs.copy
import
copy_fs
from
fs.copy
import
copy_fs
from
jinja2
import
Environment
,
FileSystemLoader
from
jinja2
import
Environment
,
FileSystemLoader
from
pprint
import
pprint
from
pathlib
import
Path
from
difflib
import
Differ
,
HtmlDiff
import
fs
import
fs
import
json
import
json
import
os
import
os
...
@@ -7,6 +10,7 @@ import re
...
@@ -7,6 +10,7 @@ import re
import
hashlib
import
hashlib
import
time
import
time
import
shutil
import
shutil
from
resources.webcreator
import
log
'''
'''
流程:
流程:
...
@@ -37,6 +41,16 @@ def cmp_file(file1, file2):
...
@@ -37,6 +41,16 @@ def cmp_file(file1, file2):
return
True
return
True
def
compare_file
(
file1
,
file2
):
with
open
(
file1
)
as
f1
,
open
(
file2
)
as
f2
:
content1
=
f1
.
read
()
.
splitlines
(
keepends
=
True
)
content2
=
f2
.
read
()
.
splitlines
(
keepends
=
True
)
d
=
Differ
()
result
=
d
.
compare
(
content1
,
content2
)
return
list
(
result
)
def
cmp_md5
(
contnet1
,
content2
):
def
cmp_md5
(
contnet1
,
content2
):
m1
=
hashlib
.
md5
()
m1
=
hashlib
.
md5
()
m1
.
update
(
bytearray
(
contnet1
,
'utf-8'
))
m1
.
update
(
bytearray
(
contnet1
,
'utf-8'
))
...
@@ -58,9 +72,36 @@ jinja_env.filters['letterUpper'] = convertFirstLetterUpper
...
@@ -58,9 +72,36 @@ jinja_env.filters['letterUpper'] = convertFirstLetterUpper
input_dir
=
None
input_dir
=
None
output_dir
=
None
output_dir
=
None
events
=
[]
def
copyFiles
(
src_dir
,
dst_dir
):
def
copyFiles
(
src_dir
,
dst_dir
):
copy_fs
(
src_dir
,
dst_dir
)
copy_fs
(
src_dir
,
dst_dir
)
def
handleModuleConfig
(
config
):
# 处理每一项配置文件
# 入口文件名
# 实例对象,根据这个实例连接对应请求
# 实例方法,需要根据实例方法生成事件函数
'''
'''
pass
def
handleModules
(
config
):
global
output_dir
# 遍历modules结构,判断文件是否存在,并且enable已经打开
# 如果文件不存在,则直接报错
# 本质上这是一个文件拷贝的操作
for
mod
in
config
:
p
=
Path
(
mod
.
get
(
"config"
))
if
not
p
.
exists
()
or
not
mod
.
get
(
"enable"
):
continue
shutil
.
copyfile
(
mod
.
get
(
"config"
),
os
.
sep
.
join
([
output_dir
,
"controllers"
,
p
.
name
]))
for
d
in
mod
.
get
(
"dependencies"
):
if
Path
(
d
)
.
exists
():
shutil
.
copyfile
(
d
,
os
.
sep
.
join
([
output_dir
,
"controllers"
,
Path
(
d
)
.
name
]))
else
:
log
.
logger
.
error
(
"文件:
%
s 不存在"
)
def
handleResources
(
config
):
def
handleResources
(
config
):
# 处理路由页面
# 处理路由页面
# 遍历config文件,收集所有的action和name,action和name的首字母必须大写
# 遍历config文件,收集所有的action和name,action和name的首字母必须大写
...
@@ -77,6 +118,10 @@ def handleSignal(config):
...
@@ -77,6 +118,10 @@ def handleSignal(config):
handleRender
(
config
,
'signal_manager_init.tpl'
,
target_file
)
handleRender
(
config
,
'signal_manager_init.tpl'
,
target_file
)
def
handleModel
(
config
,
application
):
def
handleModel
(
config
,
application
):
# 判断是否有model字段,没有直接退出
if
not
config
.
get
(
"model"
):
return
None
# 将所有有默认值的字段分为一组,没有默认值的字段分为另一组
# 将所有有默认值的字段分为一组,没有默认值的字段分为另一组
# 生成模板代码时,无默认值的字段在前,有默认值的字段字在后
# 生成模板代码时,无默认值的字段在前,有默认值的字段字在后
# 收集表字段信息
# 收集表字段信息
...
@@ -143,6 +188,7 @@ def parseConfig(config):
...
@@ -143,6 +188,7 @@ def parseConfig(config):
handleController
(
cfg
)
handleController
(
cfg
)
handleResources
(
config
.
get
(
"apis"
))
handleResources
(
config
.
get
(
"apis"
))
handleSignal
(
config
.
get
(
"apis"
))
handleSignal
(
config
.
get
(
"apis"
))
handleModules
(
config
.
get
(
"modules"
))
def
readConfig
():
def
readConfig
():
result
=
{}
result
=
{}
...
...
tools/logs/running.log
0 → 100644
View file @
ea8f1d97
tools/modules/
file-manager/
evue_photo.png
→
tools/modules/evue_photo.png
View file @
ea8f1d97
File moved
tools/modules/file-manager
/main
.py
→
tools/modules/file-manager.py
View file @
ea8f1d97
...
@@ -172,7 +172,7 @@ class FileManager(object):
...
@@ -172,7 +172,7 @@ class FileManager(object):
return
result
return
result
def
select
_d
isk
(
self
,
disk
):
def
select
D
isk
(
self
,
disk
):
print
(
disk
)
print
(
disk
)
return
True
return
True
...
@@ -183,8 +183,9 @@ class FileManager(object):
...
@@ -183,8 +183,9 @@ class FileManager(object):
def
preview
(
self
,
disk
,
target_file
):
def
preview
(
self
,
disk
,
target_file
):
# 预览图片
# 预览图片
img_stream
=
None
img_stream
=
None
img_local_path
=
'./evue_photo.png'
if
not
target_file
:
with
open
(
img_local_path
,
'rb'
)
as
img_f
:
target_file
=
'./evue_photo.png'
with
open
(
target_file
,
'rb'
)
as
img_f
:
img_stream
=
img_f
.
read
()
img_stream
=
img_f
.
read
()
img_stream
=
base64
.
b64encode
(
img_stream
)
.
decode
()
img_stream
=
base64
.
b64encode
(
img_stream
)
.
decode
()
print
(
disk
,
target_file
)
print
(
disk
,
target_file
)
...
...
tools/modules/file-manager/result.json
deleted
100644 → 0
View file @
75743db5
{
"directories"
:
[{
"basename"
:
"evue_launcher-1.0-20210420145404"
,
"dirname"
:
"evueapps/evm"
,
"path"
:
"evueapps/evm/evue_launcher-1.0-20210420145404"
,
"timestamp"
:
1618901645
,
"type"
:
"dir"
}],
"files"
:
[]}
\ No newline at end of file
tools/modules/result.json
0 → 100644
View file @
ea8f1d97
{
"directories"
:
[
{
"basename"
:
"evue_launcher-1.0-20210420145404"
,
"dirname"
:
"evueapps/evm"
,
"path"
:
"evueapps/evm/evue_launcher-1.0-20210420145404"
,
"timestamp"
:
1618901645
,
"type"
:
"dir"
}
],
"files"
:
[]
}
\ No newline at end of file
tools/resources/webcreator/log.py
View file @
ea8f1d97
'''
Author: your name
Date: 2021-04-22 18:04:15
LastEditTime: 2021-07-09 00:52:08
LastEditors: your name
Description: In User Settings Edit
FilePath:
\
evm-store
\t
ools
\r
esources
\
webcreator
\
log.py
'''
# -*- coding: utf_8 -*-
# -*- coding: utf_8 -*-
############################
############################
...
@@ -17,13 +25,13 @@ fh = RotatingFileHandler("logs/running.log", maxBytes=10 * 1024 * 1024, backupCo
...
@@ -17,13 +25,13 @@ fh = RotatingFileHandler("logs/running.log", maxBytes=10 * 1024 * 1024, backupCo
fh
.
setLevel
(
logging
.
DEBUG
)
fh
.
setLevel
(
logging
.
DEBUG
)
ch
=
logging
.
StreamHandler
()
ch
=
logging
.
StreamHandler
()
ch
.
setLevel
(
logging
.
WARNIN
G
)
ch
.
setLevel
(
logging
.
DEBU
G
)
formatter
=
logging
.
Formatter
(
'[
%(asctime)
s][
%(levelname)7
s][in
%(pathname)
s ->
%(funcName)
s line:
%(lineno)
s]
%(message)
s'
)
formatter
=
logging
.
Formatter
(
'[
%(asctime)
s][
%(levelname)7
s][in
%(pathname)
s ->
%(funcName)
s line:
%(lineno)
s]
%(message)
s'
)
fh
.
setFormatter
(
formatter
)
fh
.
setFormatter
(
formatter
)
ch
.
setFormatter
(
formatter
)
ch
.
setFormatter
(
formatter
)
logger
=
logging
.
root
logger
=
logging
.
root
logger
.
setLevel
(
logging
.
INFO
)
logger
.
setLevel
(
logging
.
DEBUG
)
logger
.
addHandler
(
fh
)
logger
.
addHandler
(
fh
)
logger
.
addHandler
(
ch
)
logger
.
addHandler
(
ch
)
\ No newline at end of file
tools/templates/controller.tpl
View file @
ea8f1d97
...
@@ -2,7 +2,7 @@ from datetime import datetime
...
@@ -2,7 +2,7 @@ from datetime import datetime
from application.app import db
from application.app import db
from models.{{ config['name'] }} import {{ config['name'] | letterUpper }}Model
from models.{{ config['name'] }} import {{ config['name'] | letterUpper }}Model
from webcreator.log import logger
from webcreator.log import logger
from webcreator.response import ResponseCode, response_result
#
from webcreator.response import ResponseCode, response_result
class {{ config['name'] | letterUpper }}Resource(object):
class {{ config['name'] | letterUpper }}Resource(object):
def __init__(self):
def __init__(self):
...
...
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