AgentOrderDao.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author cabbage
  6. * @day 2020/11/10
  7. */
  8. namespace app\common\dao\store\order;
  9. use app\common\dao\BaseDao;
  10. use app\common\model\store\order\AgentOrder;
  11. class AgentOrderDao extends BaseDao
  12. {
  13. protected function getModel(): string
  14. {
  15. return AgentOrder::class;
  16. }
  17. public function insert(){
  18. }
  19. public function searchJoin(array $where)
  20. {
  21. return AgentOrder::getDB()->alias('a')->join('User b', 'a.uid = b.uid')
  22. ->field('a.*,b.nickname,b.account')
  23. ->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) {
  24. $query->where('a.status', $where['status']);
  25. })->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where) {
  26. $query->where('a.type', $where['type']);
  27. }) ->when(isset($where['identity']) && $where['identity'] !== '', function ($query) use ($where) {
  28. $query->where('a.identity', $where['identity']);
  29. })->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
  30. getModelTime($query, $where['date'], 'a.create_time');
  31. })->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) {
  32. $query->whereLike('a.uid|b.account', "%{$where['keyword']}%");
  33. });
  34. }
  35. }