version.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. /**
  4. * Created by PhpStorm.
  5. * User: ellisran
  6. * Date: 2016/9/22
  7. * Time: 16:20
  8. */
  9. class Version extends DooModel {
  10. public $verid;
  11. public $reportid;
  12. public $vername;
  13. public $content;
  14. public $xmlheader;
  15. public $xmlbody;
  16. public $status;
  17. public $addtime;
  18. public $edittime;
  19. public $_table = 'fc_version';
  20. public $_primarykey = 'verid';
  21. public $_fields = array('verid', 'reportid', 'vername', 'content', 'xmlheader', 'xmlbody', 'status', 'addtime', 'edittime');
  22. public function __construct() {
  23. parent::setupModel(__CLASS__);
  24. }
  25. public function getRowbyreport($reportid){
  26. return $this->find(array('where' => 'status!=0 and reportid='.$reportid, 'desc' => 'addtime', 'asArray' => TRUE));
  27. }
  28. public function getRowbyid($id){
  29. return $this->getOne(array('where' => 'verid='.$id ,'asArray' => TRUE));
  30. }
  31. public function getRowbyVername($ver){
  32. return $this->getOne(array('where' => 'vername='.$ver ,'asArray' => TRUE));
  33. }
  34. public function getreportidbyid($id){
  35. $result = $this->getOne(array('select' => 'reportid', 'where' => 'verid='.$id, 'asArray' => TRUE));
  36. return $result['reportid'];
  37. }
  38. public function getvertime($id){
  39. $result = $this->getOne(array('select' => 'addtime', 'where' => 'verid='.$id, 'asArray' => TRUE));
  40. return $result['addtime'];
  41. }
  42. public function getLastVerbyrid($rid){
  43. return $this->getOne(array('where' => 'status=2 and reportid='.$rid, 'desc' => 'addtime', 'asArray' => TRUE));
  44. }
  45. }