mall_consult.model.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * 平台客服咨询管理
  4. *
  5. *
  6. *
  7. *
  8. */
  9. defined('InShopNC') or exit('Access Invalid!');
  10. class mall_consultModel extends Model{
  11. public function __construct() {
  12. parent::__construct('mall_consult');
  13. }
  14. /**
  15. * 咨询列表
  16. *
  17. * @param array $condition
  18. * @param string $field
  19. * @param string $order
  20. * @return array
  21. */
  22. public function getMallConsultList($condition, $field = '*', $page = 0, $order = 'mc_id desc') {
  23. return $this->where($condition)->field($field)->order($order)->page($page)->select();
  24. }
  25. /**
  26. * 咨询数量
  27. *
  28. * @param array $condition
  29. * @param string $field
  30. * @param string $order
  31. * @return array
  32. */
  33. public function getMallConsultCount($condition) {
  34. return $this->where($condition)->count();
  35. }
  36. /**
  37. * 单条咨询
  38. *
  39. * @param unknown $condition
  40. * @param string $field
  41. */
  42. public function getMallConsultInfo($condition, $field = '*') {
  43. return $this->where($condition)->field($field)->find();
  44. }
  45. /**
  46. * 咨询详细信息
  47. *
  48. * @param unknown $mc_id
  49. * @return boolean|multitype:
  50. */
  51. public function getMallConsultDetail($mc_id) {
  52. $consult_info = $this->getMallConsultInfo(array('mc_id' => $mc_id));
  53. if (empty($consult_info)) {
  54. return false;
  55. }
  56. $type_info = Model('mall_consult_type')->getMallConsultTypeInfo(array('mct_id' => $consult_info['mct_id']), 'mct_name');
  57. return array_merge($consult_info, $type_info);
  58. }
  59. /**
  60. * 添加咨询
  61. * @param array $insert
  62. * @return int
  63. */
  64. public function addMallConsult($insert) {
  65. $insert['mc_addtime'] = time();
  66. return $this->insert($insert);
  67. }
  68. /**
  69. * 编辑咨询
  70. * @param array $condition
  71. * @param array $update
  72. * @return boolean
  73. */
  74. public function editMallConsult($condition, $update) {
  75. return $this->where($condition)->update($update);
  76. }
  77. /**
  78. * 删除咨询
  79. *
  80. * @param array $condition
  81. * @return boolean
  82. */
  83. public function delMallConsult($condition) {
  84. return $this->where($condition)->delete();
  85. }
  86. }