consult.model.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * 咨询管理
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class consultModel extends Model{
  11. public function __construct() {
  12. parent::__construct('consult');
  13. }
  14. /**
  15. * 咨询数量
  16. *
  17. * @param array $condition
  18. * @return int
  19. */
  20. public function getConsultCount($condition) {
  21. return $this->where($condition)->count();
  22. }
  23. /**
  24. * 添加咨询
  25. * @param array $insert
  26. * @return int
  27. */
  28. public function addConsult($insert){
  29. return $this->insert($insert);
  30. }
  31. /**
  32. * 商品咨询列表
  33. * @param unknown $condition
  34. * @param string $field
  35. * @param number $limit
  36. * @param number $page
  37. * @param string $order
  38. * @return array
  39. */
  40. public function getConsultList($condition, $field = '*', $limit = 0, $page = 0, $order = 'consult_id desc') {
  41. return $this->where($condition)->field($field)->order($order)->limit($limit)->page($page)->select();
  42. }
  43. public function getConsultInfo($condition) {
  44. return $this->where($condition)->find();
  45. }
  46. /**
  47. * 删除咨询
  48. *
  49. * @param unknown_type $id
  50. */
  51. public function delConsult($condition){
  52. return $this->where($condition)->delete();
  53. }
  54. /**
  55. * 回复咨询
  56. *
  57. * @param unknown_type $input
  58. */
  59. public function editConsult($condition, $update){
  60. $update['consult_reply_time'] = time();
  61. return $this->where($condition)->update($update);
  62. }
  63. }