DpsbDevice2Action.class.php 863 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. class DpsbDevice2Action extends CommonAction {
  3. const tableName = 'dpsb_device2';
  4. const pkName = 'ID';
  5. function set_screen_msg2( ){
  6. $_GET['id'] = 0;
  7. //根据设备地址获取id信息
  8. if (IS_POST || $_GET['addr']) {
  9. if ($_GET['addr']) {
  10. $addr = $_GET['addr'];
  11. } else {
  12. $input = json_decode(file_get_contents("php://input"), true);
  13. $addr = $input['DeviceAddr'];
  14. }
  15. if (!$addr) {
  16. json_fail('设备地址有误');
  17. }
  18. $where = array('DeviceAddr' => $addr);
  19. $rows = M(self::tableName)->field('id')->where($where)->select();
  20. if (!$rows || count($rows) != 1) {
  21. json_fail('设备地址错误');
  22. }
  23. $_GET['id'] = $rows[0]['id'];
  24. }
  25. $form = new \Jiaruan\LigerIframeForm();
  26. $form->before_save = function(&$data){
  27. };
  28. $form->display($this);
  29. }
  30. }