cms_module_frame.model.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * cms模板模块模型
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class cms_module_frameModel extends Model{
  11. public function __construct(){
  12. parent::__construct('cms_module_frame');
  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 $update
  57. * @param array $condition
  58. * @return bool
  59. */
  60. public function modify($update, $condition){
  61. return $this->where($condition)->update($update);
  62. }
  63. /*
  64. * 删除
  65. * @param array $condition
  66. * @return bool
  67. */
  68. public function drop($condition){
  69. return $this->where($condition)->delete();
  70. }
  71. }