Service.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class Service extends Model
  5. {
  6. public $page_info;
  7. /**
  8. * 客服管理
  9. */
  10. public function getServiceList($condition = array(), $field = '*', $page = 0, $order = 'service_id desc')
  11. {
  12. if ($page) {
  13. $service_list = db('service')->where($condition)->order($order)->paginate($page, false, ['query' => request()->param()]);
  14. $this->page_info = $service_list;
  15. return $service_list->items();
  16. } else {
  17. return db('service')->where($condition)->order($order)->select();
  18. }
  19. }
  20. /**
  21. * 新增客服
  22. */
  23. public function addService($data)
  24. {
  25. return db('service')->insertGetId($data);
  26. }
  27. /**
  28. * 编辑用户
  29. */
  30. public function editService($condition, $data)
  31. {
  32. return db('service')->where($condition)->update($data);
  33. }
  34. /**
  35. * 删除用户
  36. */
  37. public function delService($condition)
  38. {
  39. return db('service')->where($condition)->delete();
  40. }
  41. /**
  42. * 取单个用户
  43. */
  44. public function getServiceInfo($condition, $field = '*')
  45. {
  46. return db('service')->field($field)->where($condition)->find();
  47. }
  48. //公司下所有客服
  49. public function allkef($condition, $field = '*'){
  50. return db('service')->field($field)->where($condition)->select();
  51. }
  52. // /**
  53. // * 更新信息
  54. // *
  55. // * @param array $param 更新数据
  56. // * @return bool 布尔类型的返回结果
  57. // */
  58. // public function updateService($param,$whe)
  59. // {
  60. // if (empty($param)) {
  61. // return false;
  62. // }
  63. // if (is_array($param)) {
  64. // $tmp = array();
  65. // $tmp['service_imgurl'] = $param;
  66. // $result = db('service')->where($whe, $k)->update($tmp);
  67. // return true;
  68. // } else {
  69. // return false;
  70. // }
  71. // }
  72. }