SystemAttachmentDao.php 848 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\extra\dao\system;
  3. use app\extra\basic\Dao;
  4. use app\model\system\SystemAttachment;
  5. class SystemAttachmentDao extends Dao
  6. {
  7. /**
  8. * 设置模型
  9. * @return string
  10. */
  11. protected function setModel(): string
  12. {
  13. return SystemAttachment::class;
  14. }
  15. public function getList(array $where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
  16. {
  17. return $this->getModel()->where($where)->where('module_type', 1)->field($field)->when($page&&$limit,function($query)use($page,$limit){
  18. $query->page($page,$limit);
  19. })->select();
  20. }
  21. /**
  22. * 移动图片
  23. * @param array $data
  24. */
  25. public function move(array $data)
  26. {
  27. return $this->getModel()->whereIn('att_id', $data['images'])->update(['pid' => $data['pid']]);
  28. }
  29. }