ProductCopyDao.php 898 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\common\dao\store\product;
  3. use app\common\dao\BaseDao;
  4. use app\common\model\store\product\ProductCopy as model;
  5. class ProductCopyDao extends BaseDao
  6. {
  7. protected function getModel(): string
  8. {
  9. return model::class;
  10. }
  11. public function search(array $where)
  12. {
  13. return $this->getModel()::getDB()
  14. ->when(isset($where['mer_id']) && $where['mer_id'] !== '',function($query)use($where){
  15. $query->where('mer_id',$where['mer_id']);
  16. })
  17. ->when(isset($where['type']) && $where['type'] !== '',function($query)use($where){
  18. if($where['type'] == 'copy'){
  19. $query->where('type','in',['taobao','jd','copy']);
  20. } else {
  21. $query->where('type',$where['type']);
  22. }
  23. })
  24. ->order('create_time DESC');
  25. }
  26. }