Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
psoho
fast-poster
比较版本
a6c4ca9da484bda65136a12e4e608c792f271862...d9ff6ad905dbeb2125e2e3f020214872efd93f5b
F
fast-poster
项目概览
psoho
/
fast-poster
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fast-poster
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
源分支
d9ff6ad905dbeb2125e2e3f020214872efd93f5b
选择Git版本
...
目标分支
a6c4ca9da484bda65136a12e4e608c792f271862
选择Git版本
比较
Commits (2)
https://gitcode.net/psoho/fast-poster/-/commit/58c9f086f254d7c845f03748db95085d93445282
v2.12.0
2023-02-19T22:51:01+08:00
thomas
thomastangweixin@163.com
- 二维码、头像支持固定高宽比 - 升级Pillow到9.4.0 - 增加v1/build/poster接口,直接返回生成的图片 - 增加小程序演示地址
https://gitcode.net/psoho/fast-poster/-/commit/d9ff6ad905dbeb2125e2e3f020214872efd93f5b
v2.12.0
2023-02-24T01:16:41+08:00
thomas
thomastangweixin@163.com
- 二维码、头像支持固定高宽比 - 升级Pillow到9.4.0 - 增加v1/build/poster接口,直接返回生成的图片 - 增加小程序演示地址
隐藏空白更改
内联
并排
Showing
5 changed file
with
59 addition
and
18 deletion
+59
-18
README.en.md
README.en.md
+6
-6
README.md
README.md
+6
-6
server/dao.py
server/dao.py
+20
-5
server/fast.py
server/fast.py
+26
-0
server/static/index.html
server/static/index.html
+1
-1
未找到文件。
README.en.md
浏览文件 @
d9ff6ad9
...
...
@@ -6,7 +6,7 @@
<img
alt=
"csharp"
src=
"https://img.shields.io/badge/language-python-yellow.svg"
>
<img
alt=
"csharp"
src=
"https://img.shields.io/badge/language-vue-brightgreen.svg"
>
<img
alt=
"license"
src=
"https://img.shields.io/badge/license-MIT-blue.svg"
>
<img
Alt =
"version"
SRC =
"https://img.shields.io/badge/version-2.1
1
.0-brightgreen"
>
<img
Alt =
"version"
SRC =
"https://img.shields.io/badge/version-2.1
2
.0-brightgreen"
>
</p>
## Introduction
...
...
@@ -20,9 +20,9 @@ Now it has served a large number of e-commerce projects, many of which have '52W
## Document
-
development documentation:
[
https://poster.prodapi.cn/doc/
](
https://poster.prodapi.cn/doc/
)
-
online experience:
[
https://poster.prodapi.cn/
](
https://poster.prodapi.cn/#from=2.1
1
.0
)
-
ProPython:
[
https://poster.prodapi.cn/pro/
](
https://poster.prodapi.cn/pro/#from=2.1
1
.0
)
-
ProJava:
[
https://poster.prodapi.cn/pro/java/
](
https://poster.prodapi.cn/pro/java/#from=2.1
1
.0
)
-
online experience:
[
https://poster.prodapi.cn/
](
https://poster.prodapi.cn/#from=2.1
2
.0
)
-
ProPython:
[
https://poster.prodapi.cn/pro/
](
https://poster.prodapi.cn/pro/#from=2.1
2
.0
)
-
ProJava:
[
https://poster.prodapi.cn/pro/java/
](
https://poster.prodapi.cn/pro/java/#from=2.1
2
.0
)
> The little star you lit is accelerating the project development iteration
...
...
@@ -48,12 +48,12 @@ docker run -it --name fast-poster -p 5000:5000 tangweixin/fast-poster
2.
Edit the poster
![
fastposter edit posters
](
https://poster.prodapi.cn/doc/assets/image-20220407142530149.png?v=2.1
1
.0
)
![
fastposter edit posters
](
https://poster.prodapi.cn/doc/assets/image-20220407142530149.png?v=2.1
2
.0
)
3.
Generate code
![
fastposter generated code
](
https://poster.prodapi.cn/doc/assets/image-20220407142705928.png?v=2.1
1
.0
)
![
fastposter generated code
](
https://poster.prodapi.cn/doc/assets/image-20220407142705928.png?v=2.1
2
.0
)
Sample request (you can pass the required parameters directly)
...
...
README.md
浏览文件 @
d9ff6ad9
...
...
@@ -6,7 +6,7 @@
<img
alt=
"csharp"
src=
"https://img.shields.io/badge/language-python-yellow.svg"
>
<img
alt=
"csharp"
src=
"https://img.shields.io/badge/language-vue-brightgreen.svg"
>
<img
alt=
"license"
src=
"https://img.shields.io/badge/license-MIT-blue.svg"
>
<img
alt=
"version"
src=
"https://img.shields.io/badge/version-2.1
1
.0-brightgreen"
>
<img
alt=
"version"
src=
"https://img.shields.io/badge/version-2.1
2
.0-brightgreen"
>
</p>
## 介绍
...
...
@@ -20,9 +20,9 @@
## 文档
-
开发文档:
[
https://poster.prodapi.cn/doc/
](
https://poster.prodapi.cn/doc/
)
-
在线体验:
[
https://poster.prodapi.cn/
](
https://poster.prodapi.cn/#from=2.1
1
.0
)
-
专业版-Python:
[
https://poster.prodapi.cn/pro/
](
https://poster.prodapi.cn/pro/#from=2.1
1
.0
)
-
专业版-Java:
[
https://poster.prodapi.cn/pro/java/
](
https://poster.prodapi.cn/pro/java/#from=2.1
1
.0
)
-
在线体验:
[
https://poster.prodapi.cn/
](
https://poster.prodapi.cn/#from=2.1
2
.0
)
-
专业版-Python:
[
https://poster.prodapi.cn/pro/
](
https://poster.prodapi.cn/pro/#from=2.1
2
.0
)
-
专业版-Java:
[
https://poster.prodapi.cn/pro/java/
](
https://poster.prodapi.cn/pro/java/#from=2.1
2
.0
)
> 你点亮的小星星,正在加速项目开发迭代
...
...
@@ -48,12 +48,12 @@ docker run -it --name fast-poster -p 5000:5000 tangweixin/fast-poster
### 二、编辑海报
![
fastposter编辑海报
](
https://poster.prodapi.cn/doc/assets/image-20220407142530149.png?v=2.1
1
.0
)
![
fastposter编辑海报
](
https://poster.prodapi.cn/doc/assets/image-20220407142530149.png?v=2.1
2
.0
)
### 三、生成代码
![
fastposter生成代码
](
https://poster.prodapi.cn/doc/assets/image-20220407142705928.png?v=2.1
1
.0
)
![
fastposter生成代码
](
https://poster.prodapi.cn/doc/assets/image-20220407142705928.png?v=2.1
2
.0
)
请求示例(可直接传递需要的参数)
...
...
server/dao.py
浏览文件 @
d9ff6ad9
...
...
@@ -49,8 +49,8 @@ def db_save_poster(code: str, name: str, preview: str, json: str):
def
db_update_poster
(
id
:
int
,
code
:
str
,
name
:
str
,
preview
:
str
,
json
:
str
):
with
conn
()
as
con
:
c
=
con
.
cursor
()
params
=
[
code
,
name
,
preview
,
json
,
now_str
(),
id
]
c
.
execute
(
"update posters set
code=?,
name=?,preview=?,json=?,update_time=? where id=?"
,
params
)
params
=
[
name
,
preview
,
json
,
now_str
(),
id
]
c
.
execute
(
"update posters set name=?,preview=?,json=?,update_time=? where id=?"
,
params
)
con
.
commit
()
...
...
@@ -90,10 +90,13 @@ def query_user_posters():
return
posters
def
query_user_poster
(
poster_id
:
int
):
def
query_user_poster
(
poster_id
=
0
,
uuid
=
None
):
with
conn
()
as
con
:
c
=
con
.
cursor
()
r
=
c
.
execute
(
'select * from posters where id = ? limit 1'
,
[
poster_id
])
if
uuid
:
r
=
c
.
execute
(
'select * from posters where code = ? limit 1'
,
[
uuid
])
else
:
r
=
c
.
execute
(
'select * from posters where id = ? limit 1'
,
[
poster_id
])
row
=
r
.
fetchone
()
if
row
is
not
None
:
return
{
...
...
@@ -160,7 +163,8 @@ def save_or_update_user_poster(data):
def
copy_user_poster
(
id
):
p
=
query_user_poster
(
id
)
if
p
:
return
db_save_poster
(
p
[
'code'
],
p
[
'name'
]
+
'-复制'
,
p
[
'preview'
],
p
[
'json'
])
code
=
C
.
code
()
return
db_save_poster
(
code
,
p
[
'name'
]
+
'-复制'
,
p
[
'preview'
],
p
[
'json'
])
return
None
...
...
@@ -191,6 +195,17 @@ def find_share_data(code):
posterId
=
int
(
param
[
'posterId'
])
p
=
query_user_poster
(
posterId
)
return
merge_params
(
p
,
param
)
def
find_build_data
(
uuid
,
param
):
p
=
query_user_poster
(
uuid
=
uuid
)
if
p
is
None
:
return
None
return
merge_params
(
p
,
param
)
def
merge_params
(
p
,
param
):
d
=
json
.
loads
(
p
[
'json'
])
for
item
in
d
[
'items'
]:
vd
=
item
[
'vd'
].
strip
()
...
...
server/fast.py
浏览文件 @
d9ff6ad9
...
...
@@ -129,6 +129,31 @@ class ApiLinkHandler(BaseAuthHandler):
self
.
json
(
R
.
error
(
f
'the poster [
{
param
[
"posterId"
]
}
] not exits.'
))
class
ApiBuildPosterHandler
(
BaseAuthHandler
):
def
post
(
self
):
args
=
json
.
loads
(
self
.
request
.
body
)
print
(
args
)
traceId
=
C
.
code
(
32
)
payload
=
args
[
'payload'
]
# type: str
if
not
payload
.
startswith
(
"{"
):
# 需要base64解码
payload
=
base64
.
b64decode
(
payload
)
data
=
dao
.
find_build_data
(
args
[
'uuid'
],
json
.
loads
(
payload
))
if
data
is
None
:
print
(
'no poster here!'
)
self
.
write
(
R
.
error
(
'no poster here!'
))
return
buf
,
mimetype
=
poster
.
drawio
(
data
)
self
.
set_header
(
'fastposter-traceid'
,
traceId
)
if
args
.
get
(
'b64'
,
False
):
b64
=
base64
.
b64encode
(
buf
.
read
()).
decode
()
self
.
write
(
b64
)
else
:
self
.
set_header
(
'Content-Type'
,
mimetype
)
self
.
write
(
buf
.
getvalue
())
class
ApiViewHandler
(
BaseHandler
):
def
get
(
self
,
code
:
str
):
...
...
@@ -168,6 +193,7 @@ def make_app(p):
(
f
"
{
p
}
api/preview"
,
ApiPreviewHandler
),
(
f
"
{
p
}
api/upload"
,
ApiUploadHandler
),
(
f
"
{
p
}
api/link"
,
ApiLinkHandler
),
(
f
"
{
p
}
v1/build/poster"
,
ApiBuildPosterHandler
),
(
f
"
{
p
}
v/(.+)"
,
ApiViewHandler
),
(
f
'
{
p
}
(store/.*)$'
,
StaticFileHandler
,
{
"path"
:
join
(
dirname
(
__file__
),
"data"
)}),
(
f
'
{
p
}
resource/(.*)$'
,
MyStaticFileHandler
,
{
"path"
:
join
(
dirname
(
__file__
),
"resource"
)}),
...
...
server/static/index.html
浏览文件 @
d9ff6ad9
<!DOCTYPE html>
<html
lang=
en
><head><meta
charset=
utf-8
><meta
http-equiv=
X-UA-Compatible
content=
"IE=edge"
><meta
name=
viewport
content=
"width=device-width,initial-scale=1"
><link
rel=
icon
href=
favicon.ico
><link
rel=
stylesheet
href=
static/font/iconfont.css
><title>
fastposter海报生成器
</title><meta
name=
keywords
content=
"fastposter海报生成器 电商海报编辑器 电商海报设计器器 二维码推广海报 低代码海报生成器 在线作图 Java生成二维码分享海报图片 海报生成器在线制作 在线海报生成器 免费海报一键生成器 海报在线生成 Poster在线制作"
><meta
name=
description
content=
"fastposter海报生成器 电商海报编辑器 电商海报设计器器 二维码推广海报 fastposter低代码海报生成器 Java Graphics2D绘制海报图片 通过JSON生成海报图片 程序员的海报设计器 一款程序员的海报生成器 python生成海报 java生成海报 免费海报一键生成器"
><script>
var
_hmt
=
_hmt
||
[];(
function
()
{
var
hm
=
document
.
createElement
(
"
script
"
);
hm
.
src
=
"
https://hm.baidu.com/hm.js?666f29845ed43fbcd0282a91cb281b83
"
;
var
s
=
document
.
getElementsByTagName
(
"
script
"
)[
0
];
s
.
parentNode
.
insertBefore
(
hm
,
s
);})();
</script><script>
var
baseURI
=
"
/
"
;
if
(
baseURI
===
'
/
'
)
{
baseURI
=
(
location
.
protocol
+
'
//
'
+
location
.
host
+
location
.
pathname
).
replace
(
/
(
.+
\/)
.*$/
,
'
$1
'
)};
window
.
API_URL
=
baseURI
;
window
.
PREVIEW_URL
=
baseURI
+
'
api/preview
'
;
window
.
UPLOAD_URL
=
baseURI
+
'
api/upload
'
;
console
.
info
(
'
fastposter(2.11.0): 震撼来袭...
'
)
</script><script
src=
https://poster.prodapi.cn/static/js/app.9e57fcda.js
></script><link
href=
js/about.eb687494.js
rel=
prefetch
><link
href=
css/app.d9914c2c.css
rel=
preload
as=
style
><link
href=
css/chunk-vendors.87d3b6c6.css
rel=
preload
as=
style
><link
href=
js/app.0f82a9db.js
rel=
preload
as=
script
><link
href=
js/chunk-vendors.d3f19a59.js
rel=
preload
as=
script
><link
href=
css/chunk-vendors.87d3b6c6.css
rel=
stylesheet
><link
href=
css/app.d9914c2c.css
rel=
stylesheet
></head><body><noscript><strong>
请开启JS支持
</strong></noscript><div
id=
app
></div><script
src=
js/chunk-vendors.d3f19a59.js
></script><script
src=
js/app.0f82a9db.js
></script></body><link
rel=
stylesheet
href=
https://poster.prodapi.cn/static/css/app.7373ae34.css
></html>
\ No newline at end of file
<!DOCTYPE html>
<html
lang=
en
><head><meta
charset=
utf-8
><meta
http-equiv=
X-UA-Compatible
content=
"IE=edge"
><meta
name=
viewport
content=
"width=device-width,initial-scale=1"
><link
rel=
icon
href=
favicon.ico
><link
rel=
stylesheet
href=
static/font/iconfont.css
><title>
fastposter海报生成器
</title><meta
name=
keywords
content=
"fastposter海报生成器 电商海报编辑器 电商海报设计器器 二维码推广海报 低代码海报生成器 在线作图 Java生成二维码分享海报图片 海报生成器在线制作 在线海报生成器 免费海报一键生成器 海报在线生成 Poster在线制作"
><meta
name=
description
content=
"fastposter海报生成器 电商海报编辑器 电商海报设计器器 二维码推广海报 fastposter低代码海报生成器 Java Graphics2D绘制海报图片 通过JSON生成海报图片 程序员的海报设计器 一款程序员的海报生成器 python生成海报 java生成海报 免费海报一键生成器"
><script>
var
_hmt
=
_hmt
||
[];(
function
()
{
var
hm
=
document
.
createElement
(
"
script
"
);
hm
.
src
=
"
https://hm.baidu.com/hm.js?666f29845ed43fbcd0282a91cb281b83
"
;
var
s
=
document
.
getElementsByTagName
(
"
script
"
)[
0
];
s
.
parentNode
.
insertBefore
(
hm
,
s
);})();
</script><script>
var
baseURI
=
"
/
"
;
if
(
baseURI
===
'
/
'
)
{
baseURI
=
(
location
.
protocol
+
'
//
'
+
location
.
host
+
location
.
pathname
).
replace
(
/
(
.+
\/)
.*$/
,
'
$1
'
)};
window
.
API_URL
=
baseURI
;
window
.
PREVIEW_URL
=
baseURI
+
'
api/preview
'
;
window
.
UPLOAD_URL
=
baseURI
+
'
api/upload
'
;
console
.
info
(
'
fastposter(2.12.0): 震撼来袭...
'
)
</script><script
src=
https://poster.prodapi.cn/static/js/app.9e57fcda.js
></script><link
href=
js/about.eb687494.js
rel=
prefetch
><link
href=
css/app.d9914c2c.css
rel=
preload
as=
style
><link
href=
css/chunk-vendors.87d3b6c6.css
rel=
preload
as=
style
><link
href=
js/app.0f82a9db.js
rel=
preload
as=
script
><link
href=
js/chunk-vendors.d3f19a59.js
rel=
preload
as=
script
><link
href=
css/chunk-vendors.87d3b6c6.css
rel=
stylesheet
><link
href=
css/app.d9914c2c.css
rel=
stylesheet
></head><body><noscript><strong>
请开启JS支持
</strong></noscript><div
id=
app
></div><script
src=
js/chunk-vendors.d3f19a59.js
></script><script
src=
js/app.0f82a9db.js
></script></body><link
rel=
stylesheet
href=
https://poster.prodapi.cn/static/css/app.7373ae34.css
></html>
\ No newline at end of file