Down.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. class Down extends DooModel {
  4. public $did;
  5. public $title;
  6. public $fulltitle;
  7. public $down_url;
  8. public $key_number;
  9. public $size;
  10. public $_table = 'sc_down';
  11. public $_primarykey = 'did';
  12. public $_fields = array('did', 'title','fulltitle', 'down_url','key_number','size');
  13. function getDownById($did = 0) {
  14. return $this->find ( array ( 'where' => 'did=' . $did, 'asArray' => TRUE ) );
  15. }
  16. function getDownList($data = array(), $condition = "", $limit = ""){
  17. foreach ( $data as $key => $value ) {
  18. if (is_numeric ( $value ))
  19. $condition .= " and " . $key . " = " . $value;
  20. else
  21. $condition .= " and " . $key . " like '%" . $value . "%' ";
  22. }
  23. $condition = ' where 1 ' . $condition . $limit;
  24. $sql = "select * from " . $this->_table . $condition;
  25. $query = Doo::db ()->query ( $sql );
  26. $result = $query->fetchAll ();
  27. return $result;
  28. }
  29. function getDownByIdList($id){
  30. //; order by did asc
  31. $sql = "select * from " . $this->_table . " where did in ( " . $id . " ) order by field(did,".$id.")";
  32. $query = Doo::db ()->query ( $sql );
  33. $result = $query->fetchAll ();
  34. return $result;
  35. }
  36. function deleteDownByIdList($id){
  37. $id = implode ( ",", $id );
  38. $sql = "delete from " . $this->_table . " where did in ( " . $id . " )";
  39. Doo::db ()->query ( $sql );
  40. }
  41. }
  42. ?>