ServiceLog.php 990 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. /**
  5. * 工单模型
  6. */
  7. class ServiceLog extends Model
  8. {
  9. /**
  10. * 数据统计
  11. *
  12. * @access public
  13. * @param mixed $where 条件
  14. * @return array 返回类型
  15. */
  16. public function countServiceLog($where=[])
  17. {
  18. $result = $this->where($where)->count();
  19. return $result;
  20. }//end countServiceLog()
  21. /**
  22. * 数据查询
  23. *
  24. * @access public
  25. * @param mixed $join 关联表
  26. * @param mixed $where 条件
  27. * @return array 返回类型
  28. */
  29. public function selectServiceLog($field, $join, $where=[])
  30. {
  31. $result = $this->field($field);
  32. if (empty($join) === false) {
  33. $result = $result->alias('a');
  34. foreach ($join as $k => $v) {
  35. $result = $result->join($k, $v);
  36. }
  37. }
  38. $result = $result->where($where)->select();
  39. return $result;
  40. }//end selectServiceLog()
  41. }