Manage.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php namespace Upload\Api;
  2. use Dever;
  3. use Manage\Lib\Auth;
  4. class Manage extends Auth
  5. {
  6. # 获取图片组件信息
  7. public function getImage($value = false)
  8. {
  9. Dever::project('image');
  10. $result = array();
  11. $option = array();
  12. if ($value == 1) {
  13. $option = Dever::db('thumb', 'image')->select([])->fetchAll();
  14. } elseif ($value == 2) {
  15. $option = Dever::db('crop', 'image')->select([])->fetchAll();
  16. } elseif ($value == 3) {
  17. $option = Dever::db('water_pic', 'image')->select([])->fetchAll();
  18. } elseif ($value == 4) {
  19. $option = Dever::db('water_txt', 'image')->select([])->fetchAll();
  20. }
  21. $result['type_id']['type'] = 'select';
  22. $result['type_id']['option'] = $option;
  23. $result['type_id']['value'] = $option[0]['id'] ?? '';
  24. return $result;
  25. }
  26. # 删除文件
  27. public function delFile($id, $file)
  28. {
  29. $info = pathinfo($file);
  30. $file = explode('.', $info['filename']);
  31. $file = $file[0];
  32. return Dever::db('file', 'upload')->update(array('rule_id' => $id, 'name' => $file), array('status' => 2));
  33. }
  34. }