web_special.model.php 1.6 KB

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