LogDao.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-04-15
  7. *
  8. *
  9. */
  10. namespace app\common\dao\system\admin;
  11. use app\common\dao\BaseDao;
  12. use app\common\model\BaseModel;
  13. use app\common\model\system\admin\Log;
  14. use think\db\BaseQuery;
  15. /**
  16. * Class LogDao
  17. * @package app\common\dao\system\admin
  18. * @author xaboy
  19. * @day 2020-04-16
  20. */
  21. class LogDao extends BaseDao
  22. {
  23. /**
  24. * @return BaseModel
  25. * @author xaboy
  26. * @day 2020-03-30
  27. */
  28. protected function getModel(): string
  29. {
  30. return Log::class;
  31. }
  32. /**
  33. * @param array $where
  34. * @param $merId
  35. * @return BaseQuery
  36. * @author xaboy
  37. * @day 2020-04-16
  38. */
  39. public function search(array $where, $merId)
  40. {
  41. $query = Log::getDB()->where('mer_id', $merId);
  42. if (isset($where['method']) && $where['method']) $query->where('method', $where['method']);
  43. if (isset($where['admin_id']) && $where['admin_id']) $query->where('admin_id', $where['admin_id']);
  44. if (isset($where['section_startTime']) && $where['section_startTime'] && isset($where['section_endTime']) && $where['section_endTime'])
  45. $query->where('create_time', '>', $where['section_startTime'])->where('create_time', '<', $where['section_endTime']);
  46. return $query;
  47. }
  48. }