Animation.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. class Animation extends DooModel {
  4. public $aid;
  5. public $title;
  6. public $url;
  7. public $down_url;
  8. public $img_url;
  9. public $belong;
  10. public $_table = 'sc_animation';
  11. public $_primarykey = 'aid';
  12. public $_fields = array('aid', 'title', 'url', 'down_url','img_url','belong');
  13. function getAnimationById($aid = 0) {
  14. return $this->find ( array ( 'where' => 'aid=' . $aid, 'asArray' => TRUE ) );
  15. }
  16. function getAnimationByIdList($anid=0){
  17. return $this->find ( array ( 'where' => 'aid in ( ' . $anid.' )', 'asArray' => TRUE ) );
  18. }
  19. function getAnimationByBelong($belong=1){
  20. return $this->find ( array ( 'where' => 'belong='.$belong , 'asArray' => TRUE ) );
  21. }
  22. function getAnimationList($data = array(), $condition = "", $limit = ""){
  23. foreach ( $data as $key => $value ) {
  24. if (is_numeric ( $value ))
  25. $condition .= " and " . $key . " = " . $value;
  26. else
  27. $condition .= " and " . $key . " like '%" . $value . "%' ";
  28. }
  29. $condition = ' where 1 ' . $condition . $limit;
  30. $sql = "select * from " . $this->_table . $condition;
  31. $query = Doo::db ()->query ( $sql );
  32. $result = $query->fetchAll ();
  33. return $result;
  34. }
  35. function deleteAnimationByIdList($id){
  36. $id = implode ( ",", $id );
  37. $sql = "delete from " . $this->_table . " where aid in ( " . $id . " )";
  38. Doo::db ()->query ( $sql );
  39. }
  40. }
  41. ?>