MerchantHaikeRefundDao.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-04-16
  7. *
  8. *
  9. */
  10. namespace app\common\dao\system\merchant;
  11. use app\common\dao\BaseDao;
  12. use app\common\model\system\merchant\MerchantHaikeRefund;
  13. use think\db\BaseQuery;
  14. use think\db\exception\DataNotFoundException;
  15. use think\db\exception\DbException;
  16. use think\db\exception\ModelNotFoundException;
  17. use think\Model;
  18. class MerchantHaikeRefundDao extends BaseDao
  19. {
  20. /**
  21. * @return string
  22. * @author xaboy
  23. * @day 2020-04-16
  24. */
  25. protected function getModel(): string
  26. {
  27. return MerchantHaikeRefund::class;
  28. }
  29. /**
  30. * @param array $where
  31. * @return BaseQuery
  32. * @author xaboy
  33. * @day 2020-04-16
  34. */
  35. public function search(array $where)
  36. {
  37. $query = MerchantHaikeRefund::getDB()
  38. ->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
  39. getModelTime($query, $where['date']);
  40. })->order('id', 'desc');
  41. return $query;
  42. }
  43. /**
  44. * @param int $id
  45. * @return array|Model|null
  46. * @throws DataNotFoundException
  47. * @throws DbException
  48. * @throws ModelNotFoundException
  49. * @author xaboy
  50. * @day 2020-04-17
  51. */
  52. public function get( $id)
  53. {
  54. return MerchantHaikeRefund::getInstance()->find($id);
  55. }
  56. }