Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
run.py 3.98 KB
Copy Edit Web IDE Raw Blame History
fzc authored 2019-08-14 10:33 . 设置预置点代码提交
from api import app, restfulapi
#from login import LoginApi
from usermgr import LoginApi, ChangePwdApi, AddUserApi, DelUserApi, UpdateUserApi, QueryUserApi
from robot import RobotStatusQuery, RobotConfigUpdate, RobotList, RobotControl, PTZControl, RobotManualCtrDebug, RobotCurrentStatus
# from RobotRecord import RecordApi, RecordDetailApi
from Alarm import HandlerAlarmApi,getAlarmByTimeAndPage,DoHaveAlarm,getTodayAlarmNum
from ins_belt import GetBeltInfo
from robot_log import getRobotlogApi
from robot import upDateInsPlan,getInsPlan
from ins_ipc import getInsIpc
from record import getRecordByTime,BeltMonitorApi,getRecordByB2E
import sys,logging,os
import logging.handlers
import time
from statistic import RealtimeStat, BatteryHistoryStat, MotorHistoryStat
from RobotPreset import RobotPresetList,AddPreset,DeletePreset
#user manager
restfulapi.add_resource(LoginApi, '/api/v1/login')
restfulapi.add_resource(ChangePwdApi, '/api/v1/changepwd')
restfulapi.add_resource(AddUserApi, '/api/v1/adduser')
restfulapi.add_resource(DelUserApi, '/api/v1/deluser')
restfulapi.add_resource(UpdateUserApi, '/api/v1/updateuser')
restfulapi.add_resource(QueryUserApi, '/api/v1/queryuser')
# #robot status
# restfulapi.add_resource(RecordApi,
# '/api/v1/record/<id>/<beginTs>/<endTs>/<page>')
# restfulapi.add_resource(RecordDetailApi, '/api/v1/recorddetail/<insid>')
#robot manager
#restfulapi.add_resource(RecordDetailApi, '/api/v1/recorddetail/<insid>')
restfulapi.add_resource(RobotList, '/api/v1/recordrobotlist')
restfulapi.add_resource(RealtimeStat, '/api/v1/realtimestat/<robotId>')
restfulapi.add_resource(BatteryHistoryStat,
'/api/v1/batteryhistorystat/<robotId>/<page>')
restfulapi.add_resource(MotorHistoryStat,
'/api/v1/motorhistorystat/<robotId>/<page>')
restfulapi.add_resource(RobotStatusQuery, '/api/v1/robotquery/<id>/<status>')
restfulapi.add_resource(RobotControl, '/api/v1/robotcontrol/<robotId>')
restfulapi.add_resource(RobotConfigUpdate, '/api/v1/robot')
restfulapi.add_resource(PTZControl, '/api/v1/ptzcontrol')
restfulapi.add_resource(RobotManualCtrDebug,
'/api/v1/robotmanualcontrol/<robotId>')
restfulapi.add_resource(RobotCurrentStatus,
'/api/v1/robotcurrentstatus/<robotId>')
#ins_belt
GetBeltInfo
restfulapi.add_resource(GetBeltInfo,"/api/v1/getBeltInfo")
restfulapi.add_resource(BeltMonitorApi,"/api/v1/beltMonitor")
restfulapi.add_resource(getRobotlogApi,'/api/v1/getRobotlog')
restfulapi.add_resource(upDateInsPlan,"/api/v1/upDateInsPlan")
restfulapi.add_resource(getInsPlan,"/api/v1/getInsPlan")
restfulapi.add_resource(getInsIpc,"/api/v1/getInsIpc")
restfulapi.add_resource(HandlerAlarmApi, '/api/v1/handler')
restfulapi.add_resource(getTodayAlarmNum, '/api/v1/getTodayAlarmNum')
restfulapi.add_resource(getAlarmByTimeAndPage, '/api/v1/getAlarmByTimeAndPage')
restfulapi.add_resource(DoHaveAlarm, '/api/v1/haveAlarm')
restfulapi.add_resource(getRecordByTime, '/api/v1/getRecordByTime')
restfulapi.add_resource(getRecordByB2E, '/api/v1/getRecordByB2E')
#robot_preset
restfulapi.add_resource(RobotPresetList, '/api/v1/RobotPresetList')
restfulapi.add_resource(AddPreset, '/api/v1/addPreset')
restfulapi.add_resource(DeletePreset, '/api/v1/deletePreset')
def setLoger():
isExists=os.path.exists("./log")
if not isExists:
os.makedirs("./log")
rf_handler = logging.handlers.TimedRotatingFileHandler(filename="./log/flask.log",when='D',interval=1,\
backupCount=10, encoding='UTF-8')
rf_handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(filename)s[:%(lineno)d] - %(message)s"))
app.logger.addHandler(rf_handler)
app.logger.setLevel(logging.INFO)
if __name__ == "__main__":
# app.debug = True
reload(sys)
sys.setdefaultencoding( "utf-8" )
setLoger()
app.run(host='0.0.0.0', debug=False,port=5555)
if __name__ == "uwsgi_file_run":
reload(sys)
sys.setdefaultencoding( "utf-8" )
setLoger()

Comment ( 0 )

Sign in for post a comment