UploadFileUsed.php 915 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\store\model;
  10. use app\common\model\UploadFileUsed as UploadFileUsedModel;
  11. /**
  12. * 已上传文件使用记录表MO型
  13. * Class UploadFileUsed
  14. * @package app\store\model
  15. */
  16. class UploadFileUsed extends UploadFileUsedModel
  17. {
  18. protected $updateTime = false;
  19. /**
  20. * 新增记录
  21. * @param $data
  22. * @return false|int
  23. */
  24. public function add($data) {
  25. return $this->save($data);
  26. }
  27. /**
  28. * 移除记录
  29. * @param $from_type
  30. * @param $file_id
  31. * @param null $from_id
  32. * @return int
  33. */
  34. public function remove($from_type, $file_id, $from_id = null)
  35. {
  36. $where = compact('from_type', 'file_id');
  37. !is_null($from_id) && $where['from_id'] = $from_id;
  38. return $this->where($where)->delete();
  39. }
  40. }