live_groupbuy.model.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * 线下抢购管理
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class live_groupbuyModel extends Model {
  11. public function __construct(){
  12. parent::__construct('live_groupbuy');
  13. }
  14. /**
  15. * 线下抢购信息
  16. * @param array $condition
  17. * @param string $field
  18. * @return array
  19. */
  20. public function live_groupbuyInfo($condition, $field = '*') {
  21. return $this->table('live_groupbuy')->field($field)->where($condition)->find();
  22. }
  23. /**
  24. * 线下抢购列表
  25. * @param array $condition
  26. * @param string $field
  27. * @param number $page
  28. * @param string $order
  29. * @param string $limit
  30. */
  31. public function getList($condition = array(), $field = '*', $page='15', $order = 'groupbuy_id desc') {
  32. return $this->table('live_groupbuy')->where($condition)->page($page)->order($order)->select();
  33. }
  34. /**
  35. * 添加线下抢购
  36. * @param array $data
  37. */
  38. public function add($data){
  39. return $this->table('live_groupbuy')->insert($data);
  40. }
  41. /**
  42. * 编辑线下抢购
  43. * @param array $condition
  44. * @param array $data
  45. */
  46. public function edit($condition, $data) {
  47. return $this->table('live_groupbuy')->where($condition)->update($data);
  48. }
  49. /**
  50. * 删除线下分类
  51. * @param array $condition
  52. */
  53. public function del($condition){
  54. return $this->table('live_groupbuy')->where($condition)->delete();
  55. }
  56. /**
  57. * 待审核抢购统计
  58. */
  59. public function getLivegroupbuyCount(){
  60. return $this->table('live_groupbuy')->where(array('is_audit'=>1))->count();
  61. }
  62. }