123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php namespace Upload\Api;
- use Dever;
- use Manage\Lib\Auth;
- class Manage extends Auth
- {
- # 获取图片组件信息
- public function getImage($value = false)
- {
- Dever::project('image');
- $result = array();
- $option = array();
- 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 delFile($id, $file)
- {
- $info = pathinfo($file);
- $file = explode('.', $info['filename']);
- $file = $file[0];
- return Dever::db('file', 'upload')->update(array('rule_id' => $id, 'name' => $file), array('status' => 2));
- }
- # 添加文件
- public function addFile($id, $url, $file, $source, $name, $size)
- {
- $data = Dever::load('save', 'upload')->init($id)->addFile($url, $source, $name, $file, $size);
- return $data;
- }
- }
|