Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
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
chaonan
unify_api2
Commits
3b60c56d
Commit
3b60c56d
authored
Mar 08, 2024
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add news detail 2024-03-8
parent
243843b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
11 deletions
+36
-11
news_info_cps.py
unify_api/modules/qkadmin/components/news_info_cps.py
+18
-9
news_mgr_srv.py
unify_api/modules/qkadmin/service/news_mgr_srv.py
+6
-0
new_mgr.py
unify_api/modules/qkadmin/views/new_mgr.py
+12
-2
No files found.
unify_api/modules/qkadmin/components/news_info_cps.py
View file @
3b60c56d
...
@@ -15,9 +15,15 @@ class NewsInfoReq(Model):
...
@@ -15,9 +15,15 @@ class NewsInfoReq(Model):
@
dataclass
@
dataclass
class
NewsInfoRsp
(
Model
):
class
NewsInfoRsp
(
Model
):
title
:
str
=
Str
(
"文章标题"
)
.
eg
(
"喜报丨热烈庆祝清科优能被评定为深圳市“专精特新”企业!"
)
title
:
str
=
Opt
(
Str
(
"文章标题"
)
.
eg
(
"喜报丨热烈庆祝清科优能被评定为深圳市“专精特新”企业!"
))
contents
:
str
=
Str
(
"文章内容"
)
.
eg
(
"喜报丨热烈庆祝清科优能被评定为深圳市“专精特新”企业!"
)
author
:
str
=
Opt
(
Str
(
"文章作者"
)
.
eg
(
"清科优能"
))
pub_time
:
str
=
Str
(
"发布时间"
)
.
eg
(
"2023-12-29 18:06"
)
news_type
:
int
=
Opt
(
Int
(
"文章类型(1:公司新闻, 2:行业新闻)"
)
.
eg
(
1
))
top
:
int
=
Opt
(
Int
(
"是否置顶"
)
.
eg
(
0
))
keywords
:
str
=
Opt
(
Str
(
"文章关键词"
)
.
eg
(
"专精特新"
))
contents
:
str
=
Opt
(
Str
(
"文章描述"
)
.
eg
(
"清科优能被评定为深圳市“专精特新”企业!"
))
news_url
:
str
=
Opt
(
Str
(
"文章URL"
)
.
eg
(
"xxx90c2-bb7ef44fea51.html"
))
cover_url
:
str
=
Opt
(
Str
(
"封面URL"
)
.
eg
(
"xxxx68117e4c27e4.png"
))
pub_time
:
str
=
Opt
(
Str
(
"发布时间"
)
.
eg
(
"2023-12-29 18:06"
))
@
dataclass
@
dataclass
...
@@ -40,6 +46,7 @@ class ReviseNewsReq(Model):
...
@@ -40,6 +46,7 @@ class ReviseNewsReq(Model):
pub_time
:
str
=
Opt
(
Str
(
"发布时间"
)
.
eg
(
"2023-12-29 18:06"
))
pub_time
:
str
=
Opt
(
Str
(
"发布时间"
)
.
eg
(
"2023-12-29 18:06"
))
top
:
int
=
Opt
(
Int
(
"置顶/取消置顶"
)
.
eg
(
0
))
top
:
int
=
Opt
(
Int
(
"置顶/取消置顶"
)
.
eg
(
0
))
@
dataclass
@
dataclass
class
ReviseNewsSeoReq
(
Model
):
class
ReviseNewsSeoReq
(
Model
):
news_id
:
str
=
Str
(
"文章id"
)
.
eg
(
"12"
)
news_id
:
str
=
Str
(
"文章id"
)
.
eg
(
"12"
)
...
@@ -60,13 +67,15 @@ class NewsPagesReq(Model):
...
@@ -60,13 +67,15 @@ class NewsPagesReq(Model):
@
dataclass
@
dataclass
class
NewsInfo
(
Model
):
class
NewsInfo
(
Model
):
id
:
int
=
Opt
(
Int
(
"文章ID"
)
.
eg
(
1
))
id
:
int
=
Opt
(
Int
(
"文章ID"
)
.
eg
(
1
))
title
:
str
=
Str
(
"文章标题"
)
.
eg
(
"喜报丨热烈庆祝清科优能被评定为深圳市“专精特新”企业!"
)
title
:
str
=
Opt
(
Str
(
"文章标题"
)
.
eg
(
"喜报丨热烈庆祝清科优能被评定为深圳市“专精特新”企业!"
))
author
:
str
=
Str
(
"文章作者"
)
.
eg
(
"清科优能"
)
author
:
str
=
Opt
(
Str
(
"文章作者"
)
.
eg
(
"清科优能"
))
pub_time
:
str
=
Str
(
"发布时间"
)
.
eg
(
"2023-12-29 18:06"
)
news_type
:
int
=
Opt
(
Int
(
"文章类型(1:公司新闻, 2:行业新闻)"
)
.
eg
(
1
))
news_type
:
int
=
Int
(
"文章类型(1:公司新闻, 2:行业新闻)"
)
.
eg
(
1
)
top
:
int
=
Opt
(
Int
(
"是否置顶"
)
.
eg
(
0
))
top
:
int
=
Opt
(
Int
(
"是否置顶"
)
.
eg
(
0
))
contents
:
str
=
Opt
(
Str
(
"文章内容"
)
.
eg
(
"喜报丨热烈庆祝清科优能被评定为深圳市“专精特新”企业!"
))
keywords
:
str
=
Opt
(
Str
(
"文章关键词"
)
.
eg
(
"专精特新"
))
cover_url
:
str
=
Opt
(
Str
(
"文章封面URL"
)
.
eg
(
"xxxxxxxxxx"
))
contents
:
str
=
Opt
(
Str
(
"文章描述"
)
.
eg
(
"清科优能被评定为深圳市“专精特新”企业!"
))
news_url
:
str
=
Opt
(
Str
(
"文章URL"
)
.
eg
(
"xxx90c2-bb7ef44fea51.html"
))
cover_url
:
str
=
Opt
(
Str
(
"封面URL"
)
.
eg
(
"xxxx68117e4c27e4.png"
))
pub_time
:
str
=
Opt
(
Str
(
"发布时间"
)
.
eg
(
"2023-12-29 18:06"
))
@
dataclass
@
dataclass
...
...
unify_api/modules/qkadmin/service/news_mgr_srv.py
View file @
3b60c56d
...
@@ -148,3 +148,9 @@ async def load_news_pages(params):
...
@@ -148,3 +148,9 @@ async def load_news_pages(params):
articles
=
await
conn
.
fetchall
(
sql
,
(
tuple
(
param_lst
)))
articles
=
await
conn
.
fetchall
(
sql
,
(
tuple
(
param_lst
)))
return
total
,
articles
return
total
,
articles
async
def
load_news_info
(
news_id
):
sql
=
"SELECT * FROM official_web.news_info WHERE id=
%
s;"
async
with
MysqlUtil
(
db
=
"official_web"
)
as
conn
:
return
await
conn
.
fetchone
(
sql
,
(
news_id
,))
unify_api/modules/qkadmin/views/new_mgr.py
View file @
3b60c56d
...
@@ -7,11 +7,12 @@ from pot_libs.sanic_api import summary
...
@@ -7,11 +7,12 @@ from pot_libs.sanic_api import summary
from
pot_libs.logger
import
log
from
pot_libs.logger
import
log
from
unify_api.modules.common.components.common_cps
import
SuccessRsp
from
unify_api.modules.common.components.common_cps
import
SuccessRsp
from
unify_api.modules.qkadmin.components.news_info_cps
import
(
from
unify_api.modules.qkadmin.components.news_info_cps
import
(
NewsPagesReq
,
NewsPagesRsp
,
NewsInfo
,
ReviseNewsReq
,
ReviseNewsSeoReq
NewsPagesReq
,
NewsPagesRsp
,
NewsInfo
,
ReviseNewsReq
,
ReviseNewsSeoReq
,
NewsInfoReq
,
NewsInfoRsp
)
)
from
unify_api.modules.qkadmin.service.news_mgr_srv
import
(
from
unify_api.modules.qkadmin.service.news_mgr_srv
import
(
upload_news_qs
,
save_news_info
,
load_news_pages
,
update_news_info
,
upload_news_qs
,
save_news_info
,
load_news_pages
,
update_news_info
,
update_news_seo
,
delete_news
,
top_news
update_news_seo
,
delete_news
,
top_news
,
load_news_info
)
)
...
@@ -64,6 +65,15 @@ async def post_delete_news(request, body: ReviseNewsReq) -> SuccessRsp:
...
@@ -64,6 +65,15 @@ async def post_delete_news(request, body: ReviseNewsReq) -> SuccessRsp:
return
SuccessRsp
(
success
=
0
,
message
=
"删除文章失败"
)
return
SuccessRsp
(
success
=
0
,
message
=
"删除文章失败"
)
@
summary
(
"文章详情"
)
async
def
post_news_detail
(
request
,
body
:
NewsInfoReq
)
->
NewsInfoRsp
:
r
=
await
load_news_info
(
body
.
news_id
)
return
NewsInfoRsp
(
title
=
r
[
"title"
],
news_type
=
r
[
"news_type"
],
keywords
=
r
[
"keywords"
],
contents
=
r
[
"contents"
],
news_url
=
r
[
"news_url"
],
cover_url
=
r
[
"cover_url"
],
pub_time
=
r
[
"pub_time"
])
@
summary
(
"置顶/取消置顶文章"
)
@
summary
(
"置顶/取消置顶文章"
)
async
def
post_top_news
(
request
,
body
:
ReviseNewsReq
)
->
SuccessRsp
:
async
def
post_top_news
(
request
,
body
:
ReviseNewsReq
)
->
SuccessRsp
:
news_id
,
top
=
body
.
news_id
,
body
.
top
news_id
,
top
=
body
.
news_id
,
body
.
top
...
...
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