cms_picture_image.model.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * cms画报图片模型
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class cms_picture_imageModel extends Model{
  11. public function __construct(){
  12. parent::__construct('cms_picture_image');
  13. }
  14. /**
  15. * 读取列表
  16. * @param array $condition
  17. *
  18. */
  19. public function getList($condition,$page=null,$order='',$field='*'){
  20. $result = $this->field($field)->where($condition)->page($page)->order($order)->select();
  21. return $result;
  22. }
  23. /**
  24. * 读取单条记录
  25. * @param array $condition
  26. *
  27. */
  28. public function getOne($condition,$order=''){
  29. $result = $this->where($condition)->order($order)->find();
  30. return $result;
  31. }
  32. /*
  33. * 判断是否存在
  34. * @param array $condition
  35. *
  36. */
  37. public function isExist($condition) {
  38. $result = $this->getOne($condition);
  39. if(empty($result)) {
  40. return FALSE;
  41. }
  42. else {
  43. return TRUE;
  44. }
  45. }
  46. /*
  47. * 增加
  48. * @param array $param
  49. * @return bool
  50. */
  51. public function save($param){
  52. return $this->insert($param);
  53. }
  54. /*
  55. * 批量增加
  56. * @param array $param
  57. * @return bool
  58. */
  59. public function saveAll($param){
  60. return $this->insertAll($param);
  61. }
  62. /*
  63. * 更新
  64. * @param array $update
  65. * @param array $condition
  66. * @return bool
  67. */
  68. public function modify($update, $condition){
  69. return $this->where($condition)->update($update);
  70. }
  71. /*
  72. * 删除
  73. * @param array $condition
  74. * @return bool
  75. */
  76. public function drop($condition){
  77. return $this->where($condition)->delete();
  78. }
  79. }