change_alarm_limit.py 686 B

123456789101112131415161718
  1. from abstract_api import AbstractApi
  2. from apis.operate_mysql import OperateMysql
  3. import traceback
  4. class Change_alarm_limit(AbstractApi):
  5. def operation(self, request):
  6. operate_mysql = OperateMysql()
  7. id = request['id']
  8. alarm_low_limit = request['alarm_low_limit']
  9. alarm_up_limit = request['alarm_up_limit']
  10. sql = "UPDATE data_point_tbl SET alarm_low_limit=%s, alarm_up_limit=%s WHERE id=%s" % (alarm_low_limit, alarm_up_limit, id)
  11. try:
  12. operate_mysql.execute_sql(sql)
  13. return "报警上下限修改成功"
  14. except:
  15. print(traceback.format_exc())
  16. return "报警上下限修改失败"