from colorama import Fore,Style
from service.user_service import User_service
from service.news_service import News_service
from service.role_service import Role_service
import os
import sys
import time
from getpass import getpass
__user_service = User_service()
__news_service = News_service()
__role_service = Role_service()
while True:
os.system('cls')
print(Fore.LIGHTBLUE_EX,'\n\t================================')
print(Fore.LIGHTCYAN_EX,'\n\t欢迎来到新闻信息管理系统')
print(Fore.LIGHTBLUE_EX,'\n\t================================')
print(Fore.LIGHTBLUE_EX,'\n\t1.登录系统')
print(Fore.LIGHTBLUE_EX, '\n\t2.退出系统')
print(Style.RESET_ALL)
opt = input('\n\t请输入操作编号:')
if opt == '1':
username = input('\n\t用户名:')
password = getpass('\n\t密码:')
result = __user_service.user_login(username,password)
#登录成功
if result == True:
role = __user_service.user_role(username)
while True:
os.system('cls')
if role == '新闻编辑':
# 审批新闻
print(Fore.LIGHTGREEN_EX, "\n\t1.审批新闻")
print(Fore.LIGHTGREEN_EX, "\n\t2.删除新闻")
print(Fore.LIGHTRED_EX, "\n\tback.返回上一层")
print(Style.RESET_ALL)
opt = input('\n\t请输入操作编号:')
if opt == '1':
page = 1
while True:
os.system('cls')
count_page = __news_service.count_unreview_page()
result = __news_service.search_news_list(page)
for index in range(len(result)):
one = result[index]
print(Fore.LIGHTWHITE_EX,
'\n\t%d\t%s\t%s\t%s' % (index + 1, one[1], one[2], one[3]))
print(Fore.LIGHTBLUE_EX, '\n\t-------------------------')
print(Fore.LIGHTRED_EX, '\n\t%s/%s' % (page, count_page))
print(Fore.LIGHTBLUE_EX, '\n\t-------------------------')
print(Fore.LIGHTRED_EX, "\n\tback.返回上一层")
print(Fore.LIGHTRED_EX, "\n\tprev.上一页")
print(Fore.LIGHTRED_EX, "\n\tnext.下一页")
print(Style.RESET_ALL)
opt = input('请输入操作编号:')
if opt == 'back':
break
elif opt == 'prev' and page > 1:
page -= 1
elif opt == 'next' and page < count_page:
page += 1
elif int(opt) >= 1 and int(opt) <= 10:
new_id = result[int(opt) - 1][0]
__news_service.review_news(new_id)
elif opt == '2':
page = 1
while True:
os.system('cls')
count_page = __news_service.count_news_page()
result = __news_service.search_news_list(page)
for index in range(len(result)):
one = result[index]
print(Fore.LIGHTWHITE_EX,
'\n\t%d\t%s\t%s\t%s' % (index + 1, one[1], one[2], one[3]))
print(Fore.LIGHTBLUE_EX, '\n\t-------------------------')
print(Fore.LIGHTRED_EX, '\n\t%s/%s' % (page, count_page))
print(Fore.LIGHTBLUE_EX, '\n\t-------------------------')
print(Fore.LIGHTRED_EX, "\n\tback.返回上一层")
print(Fore.LIGHTRED_EX, "\n\tprev.上一页")
print(Fore.LIGHTRED_EX, "\n\tnext.下一页")
print(Style.RESET_ALL)
opt = input('请输入操作编号:')
if opt == 'back':
break
elif opt == 'prev' and page > 1:
page -= 1
elif opt == 'next' and page < count_page:
page += 1
elif int(opt) >= 1 and int(opt) <= 10:
new_id = result[int(opt) - 1][0]
__news_service.delete_news(new_id)
elif opt == 'back':
break
elif role == '管理员':
print(Fore.LIGHTGREEN_EX, "\n\t1.新闻管理")
print(Fore.LIGHTGREEN_EX, "\n\t2.用户管理")
print(Fore.LIGHTRED_EX, "\n\tback.退出登陆")
print(Fore.LIGHTRED_EX, "\n\texit.退出系统")
print(Style.RESET_ALL)
opt = input('请输入操作编号:')
if opt == '1':
while True:
os.system('cls')
print(Fore.LIGHTGREEN_EX, "\n\t1.审批新闻")
print(Fore.LIGHTGREEN_EX, "\n\t2.删除新闻")
print(Fore.LIGHTRED_EX, "\n\tback.返回上一层")
print(Style.RESET_ALL)
opt = input('\n\t请输入操作编号:')
if opt == '1':
# page=1
# while True:
# os.system('cls')
# count_page = __news_service.count_unreview_page()
# result = __news_service.search_unreview_list(page)
# for index in range(len(result)):
# one = result[index]
# print(Fore.LIGHTWHITE_EX,'\n\t%d\t%s\t%s\t%s'%(index+1,one[1],one[2],one[3]))
#
# print(Fore.LIGHTBLUE_EX,'\n\t-------------------------')
# print(Fore.LIGHTRED_EX,'\n\t%s/%s'%(page,count_page))
#
# print(Fore.LIGHTBLUE_EX,'\n\t-------------------------')
# print(Fore.LIGHTRED_EX, "\n\tback.返回上一层")
# print(Fore.LIGHTRED_EX, "\n\tprev.上一页")
# print(Fore.LIGHTRED_EX, "\n\tnext.下一页")
# print(Style.RESET_ALL)
#
# opt = input("\n\t输入操作编号:")
#
# if opt == 'back':
# break
# elif opt == 'prev' and page>1:
# page-=1
# elif opt == 'next' and page<count_page:
# page+=1
# elif int(opt) >= 1 and int(opt) <= 10:
# new_id = result[int(opt)-1][0]
# __news_service.review_news(new_id)
page = 1
while True:
os.system('cls')
# 待审批新闻总页数
猰貐的新时代
- 粉丝: 1w+
- 资源: 2886
最新资源
- zigbee CC2530无线自组网协议栈系统代码实现协调器与终端基于GenericApp的无线收发例程.zip
- zigbee CC2530无线自组网协议栈系统代码实现协调器与终端无线收发控制LED灯.zip
- zigbee CC2530无线自组网协议栈系统代码实现协调器与终端之间的数据相互收发.zip
- zigbee CC2530无线自组网协议栈系统代码实现协议捕捉与数据分析.zip
- zigbee CC2530无线自组网协议栈系统代码实现终端采集光敏传感器并发给协调器串口输出.zip
- zigbee CC2530无线自组网协议栈系统代码实现终端采集气体传感器值发给协调器并串口打印.zip
- zigbee CC2530无线自组网协议栈系统代码实现终端采集人体红外热释电传感器发送给协调器并串口输出.zip
- 功能完善的小说CMS系统项目全套技术资料.zip
- zigbee CC2530无线自组网协议栈系统代码实现终端采集温度传感器DS18B20发送给协调器并串口打印输出.zip
- 食物营养分析-java-基于 SpringBoot 的食物营养分析与推荐网站的设计与实现(毕业论文)
- zigbee CC2530无线自组网协议栈系统代码实现终端采集温湿度传感器DHT11并发给协调器并串口打印输出.zip
- zigbee CC2530无线自组网协议栈系统的RemoTI源码.zip
- zigbee CC2530无线自组网协议栈系统之新建自己的Zstack工程模板(协调器、终端、路由器).zip
- 宠物救助及领养-java-基于springBoot的宠物救助及领养平台的设计与实现(毕业论文)
- 从基础到高级:Rust语言教程与编程实战
- 城市公交查询-java-基于springBoot的城市公交查询系统设计与实现(毕业论文)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈