rabin 3 天之前
父节点
当前提交
fcc643c2d3
共有 2 个文件被更改,包括 0 次插入139 次删除
  1. 0 106
      api/Manage.php
  2. 0 33
      api/Save.php

+ 0 - 106
api/Manage.php

@@ -1,106 +0,0 @@
-<?php namespace Upload\Api;
-use Dever;
-use Manage\Lib\Auth;
-class Manage extends Auth
-{
-    # 获取图片组件信息
-    public function getImage($value = false)
-    {
-        Dever::project('image');
-        $result = [];
-        $option = [];
-        if ($value == 1) {
-            $option = Dever::db('thumb', 'image')->select([]);
-        } elseif ($value == 2) {
-            $option = Dever::db('crop', 'image')->select([]);
-        } elseif ($value == 3) {
-            $option = Dever::db('water_pic', 'image')->select([]);
-        } elseif ($value == 4) {
-            $option = Dever::db('water_txt', 'image')->select([]);
-        }
-        $result['type_id']['type'] = 'select';
-        $result['type_id']['option'] = $option;
-        $result['type_id']['value'] = $option[0]['id'] ?? '';
-        return $result;
-    }
-
-    # 删除文件
-    public function upFileStatus()
-    {
-        $rule_id = Dever::input('id');
-        $id = Dever::input('file_id');
-        $status = Dever::input('status', 'is_numeric', '状态', 2);
-        $user_id = Dever::load('util', 'upload')->getUser();
-        return Dever::db('file', 'upload')->update(['id' => $id, 'user_id' => $user_id], ['status' => $status]);
-    }
-
-    # 彻底删除文件
-    public function delFile()
-    {
-        $rule_id = Dever::input('id');
-        $id = Dever::input('file_id');
-        $user_id = Dever::load('util', 'upload')->getUser();
-        $state = Dever::db('file', 'upload')->delete(['id' => $id, 'status' => 2, 'user_id' => $user_id]);
-        if ($state) {
-            # 同时删除文件
-        }
-        return 'ok';
-    }
-
-    # 添加文件
-    public function addFile($id, $url, $file, $source, $name, $size)
-    {
-        $data = Dever::load('save', 'upload')->init($id)->addFile($url, $source, $name, $file, $size);
-        return $data;
-    }
-
-    # 获取文件库文件列表
-    public function getFileList()
-    {
-        $type = Dever::input('type', 'is_numeric', '类型', 0);
-        $id = Dever::input('id', 'is_numeric', '上传规则错误', 1);
-        $cate_id = Dever::input('cate_id', 'is_numeric', '上传分类', 1);
-        $group_id = Dever::load('util', 'upload')->getGroup();
-        $user_id = Dever::load('util', 'upload')->getUser();
-        $file = Dever::input('file');
-
-        $data = Dever::input();
-
-        $set = [];
-        $set['num'] = 18;
-        $where['rule_id'] = $id;
-        $where['status'] = 1;
-        #$where['cate_id'] = $cate_id;
-        if ($type == 1) {
-            $where['group_id'] = $group_id;
-        } elseif ($type == 2) {
-            $where['user_id'] = $user_id;
-        } elseif ($type == 4) {
-            $where['status'] = 2;
-        }
-        
-        $result['file'] = Dever::db('file', 'upload')->select($where, $set);
-        if ($result['file']) {
-            foreach ($result['file'] as &$v) {
-                if ($v['source_name']) {
-                    $v['name'] = $v['source_name'];
-                }
-                $v['url'] = Dever::load('view', 'upload')->getUrl($v);
-                $v['class'] = '';
-                $v['del'] = 2;
-                if ($user_id == $v['user_id']) {
-                    $v['del'] = 1;
-                }
-                if ($file) {
-                    foreach ($file as $v1) {
-                        if ($v1 && $v1['url'] == $v['url']) {
-                            $v['class'] = 'show-image-active';
-                        }
-                    }
-                }
-            }
-        }
-        $result['total'] = Dever::page('total');
-        return $result;
-    }
-}

+ 0 - 33
api/Save.php

@@ -1,33 +0,0 @@
-<?php namespace Upload\Api;
-use Dever;
-class Save
-{
-    public function __construct()
-    {
-        $this->id = Dever::input('id', 'is_numeric', '上传规则错误', 1);
-        $this->file = Dever::input('file', '!empty', '上传文件错误');
-        $this->cate_id = Dever::input('cate_id', 'is_numeric', '上传分类', 1);
-        $this->group_id = Dever::load('util', 'upload')->getGroup();
-        $this->user_id = Dever::load('util', 'upload')->getUser();
-    }
-
-    public function act()
-    {
-        return Dever::load('save', 'upload')->init($this->id, $this->cate_id, $this->group_id, $this->user_id)->act($this->file);
-    }
-
-    public function wangEditor()
-    {
-        Dever::config('setting', ['output_app' => [], 'output' => [
-            'status' => ['errno', ['1' => 0, '2' => 1]],
-            'msg' => 'message',
-        ]]);
-        return $this->act();
-    }
-
-    public function avatar()
-    {
-        $uid = Dever::input('uid', 'is_numeric', '用户ID');
-        return Dever::load('save', 'upload')->init($this->id, $this->cate_id, $this->group_id, $this->user_id)->act($this->file, 'jpg', $uid);
-    }
-}