micro_goods_class.model.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * 微商城推荐商品分类模型
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class micro_goods_classModel extends Model{
  11. public function __construct(){
  12. parent::__construct('micro_goods_class');
  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. }