UploadFileUsed.php 806 B

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