Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
card
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
zhanglu
card
Commits
4614cc5c
Commit
4614cc5c
authored
Dec 12, 2020
by
zhanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
fix: 帖子封面
parent
b9ae2308
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
tag.py
card/views/schemas/tag.py
+1
-1
format.py
card/views/tractate/format.py
+7
-2
schemas.py
card/views/tractate/schemas.py
+1
-0
No files found.
card/views/schemas/tag.py
View file @
4614cc5c
...
@@ -6,5 +6,5 @@ class Tag(Schema):
...
@@ -6,5 +6,5 @@ class Tag(Schema):
id
:
int
=
Field
(
None
,
description
=
"标签ID"
)
id
:
int
=
Field
(
None
,
description
=
"标签ID"
)
name
:
str
=
Field
(
None
,
description
=
"标签名"
)
name
:
str
=
Field
(
None
,
description
=
"标签名"
)
type
:
str
=
Field
(
None
,
description
=
"标签类型"
)
type
:
int
=
Field
(
None
,
description
=
"标签类型"
)
gm_url
:
str
=
Field
(
None
,
description
=
"跳转协议"
)
gm_url
:
str
=
Field
(
None
,
description
=
"跳转协议"
)
card/views/tractate/format.py
View file @
4614cc5c
...
@@ -85,8 +85,8 @@ class TractateFormat(BaseFormat):
...
@@ -85,8 +85,8 @@ class TractateFormat(BaseFormat):
# 有视频且封面是短视频,逻辑不变
# 有视频且封面是短视频,逻辑不变
# 没有视频,封面是图片,替换图片第一张的image_url为封面图
# 没有视频,封面是图片,替换图片第一张的image_url为封面图
# 客户端卡片展示取值逻辑:ios有视频取video 没有视频取images; Android都取images
# 客户端卡片展示取值逻辑:ios有视频取video 没有视频取images; Android都取images
cover_url
=
info
.
pop
(
'cover_url'
,
''
)
cover_url
=
info
.
get
(
'cover_url'
,
''
)
cover_type
=
info
.
pop
(
'cover_type'
,
TRACTATE_COVER_TYPE
.
NO_COVER
)
cover_type
=
info
.
get
(
'cover_type'
,
TRACTATE_COVER_TYPE
.
NO_COVER
)
if
all
([
video
,
cover_type
==
TRACTATE_COVER_TYPE
.
IMAGE
]):
if
all
([
video
,
cover_type
==
TRACTATE_COVER_TYPE
.
IMAGE
]):
cover_url
=
Picture
.
get_aspectscale_path
(
cover_url
)
cover_url
=
Picture
.
get_aspectscale_path
(
cover_url
)
...
@@ -116,6 +116,11 @@ class TractateFormat(BaseFormat):
...
@@ -116,6 +116,11 @@ class TractateFormat(BaseFormat):
tractate
=
TractateInfo
(
**
tractate_data
)
tractate
=
TractateInfo
(
**
tractate_data
)
cover_url
=
info
.
get
(
'cover_url'
,
''
)
cover_type
=
info
.
get
(
'cover_type'
,
TRACTATE_COVER_TYPE
.
NO_COVER
)
if
cover_type
and
cover_url
:
tractate
.
set_cover
=
True
video
,
images
=
self
.
get_video_and_image
(
info
)
video
,
images
=
self
.
get_video_and_image
(
info
)
if
video
:
if
video
:
tractate
.
video
=
self
.
get_video
(
tractate
.
video
=
self
.
get_video
(
...
...
card/views/tractate/schemas.py
View file @
4614cc5c
...
@@ -36,6 +36,7 @@ class TractateInfo(Schema):
...
@@ -36,6 +36,7 @@ class TractateInfo(Schema):
user
:
User
=
Field
(
...
,
description
=
"用户信息"
)
user
:
User
=
Field
(
...
,
description
=
"用户信息"
)
images
:
Optional
[
Image
]
=
Field
({},
description
=
"图片"
)
images
:
Optional
[
Image
]
=
Field
({},
description
=
"图片"
)
video
:
Optional
[
Video
]
=
Field
({},
description
=
"视频"
)
video
:
Optional
[
Video
]
=
Field
({},
description
=
"视频"
)
set_cover
:
bool
=
Field
(
False
,
description
=
"是否设置封面"
)
class
TractateList
(
Schema
):
class
TractateList
(
Schema
):
...
...
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