Attachment.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. namespace We7\Table\Core;
  7. class Attachment extends \We7Table {
  8. protected $tableName = 'core_attachment';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'uniacid',
  12. 'uid',
  13. 'filename',
  14. 'attachment',
  15. 'type',
  16. 'createtime',
  17. 'module_upload_dir',
  18. 'group_id',
  19. 'displayorder',
  20. );
  21. protected $default = array(
  22. 'uniacid' => '',
  23. 'uid' => '',
  24. 'filename' => '',
  25. 'attachment' => '',
  26. 'type' => '',
  27. 'createtime' => '',
  28. 'module_upload_dir' => '',
  29. 'group_id' => '0',
  30. 'displayorder' => '',
  31. );
  32. public function deleteById($id) {
  33. return $this->where('id', $id)->delete();
  34. }
  35. public function searchWithUniacid($uniacid) {
  36. return $this->query->where('uniacid', $uniacid);
  37. }
  38. public function searchWithUid($uid) {
  39. return $this->query->where('uid', $uid);
  40. }
  41. public function searchWithUploadDir($module_upload_dir) {
  42. return $this->query->where(array('module_upload_dir' => $module_upload_dir));
  43. }
  44. public function searchWithType($type) {
  45. return $this->query->where(array('type' => $type));
  46. }
  47. public function searchWithGroupId($groupid) {
  48. return $this->query->where(array('group_id =' => $groupid));
  49. }
  50. public function searchWithTime($start_time, $end_time) {
  51. return $this->query->where(array('createtime >=' => $start_time))->where(array('createtime <=' => $end_time));
  52. }
  53. }