1234567891011121314151617181920212223242526272829303132333435 |
- <?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([])->fetchAll();
- } elseif ($value == 2) {
- $option = Dever::db('crop', 'image')->select([])->fetchAll();
- } elseif ($value == 3) {
- $option = Dever::db('water_pic', 'image')->select([])->fetchAll();
- } elseif ($value == 4) {
- $option = Dever::db('water_txt', 'image')->select([])->fetchAll();
- }
- $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));
- }
- }
|