<?php
/** 
 * UQ云商：	www.uqcms.com  
 * 联系QQ：	2200631718 
 * 可免费商用，需要留UQ云商链接作为交换，只首页底部留取即可，不影响使用。
 */

defined('IN_UQ') or exit('Access Denied'); class album_uqcms extends control { function __construct() { $this->aid = @$_SESSION['admin']['aid']; parent::__construct(); } public function index() { $_GET['page_size'] = $_GET['page_size']??'40'; $uq0 = G('type'); $uq1 = ''; if($uq0 == '0'){ $uq1 .= ' type = 0 and '; }elseif($uq0){ $uq1 .= ' type = '.$uq0.' and '; } if(!empty($uq1)){ $uq1 = ' where '.trim($uq1,' and '); } $uq0 = $this->module('album')->path_type_cn(); $uq2 = $this->db->get_all("select * from ".table('album').$uq1." order by id desc ".$this->limit()); if($uq2){ foreach($uq2 as $uq3=>$uq4){ $uq4['type'] = $uq0[$uq4['type']]; $uq4['size'] = format_bytes($uq4['size']); $uq4['addtime'] = _date($uq4['addtime']); $uq5[] = $uq4; } $uq6['list'] = $uq5; $uq7 = $this->db->get_one("select count(id) as total from ".table('album').$uq1); $uq6['page'] = $this->page(['total'=>$uq7['total']]); $this->assign('data',$uq6); } $this->assign('type_arr', $this->module('album')->path_type_cn()); $this->display(); } public function del() { $uq8 = P('id', '提交编号错误'); if(!empty($uq8)){ $uq9 = explode(',',$uq8); foreach($uq9 as $uq3=>$uq4){ $uq10 = $this->db->get_one("select * from ".table("album")." where id = ".$uq4); if($uq10['id']){ $q1 = $this->module('album')->del($uq10['url']); if($q1){ $uq12[] = ''; } } } if(count($uq9) == count($uq12)){ right_json(); }else{ error_json('删除失败或者部分删除成功'); } }else{ error_json('提交不能为空'); } } public function upload() { $uq13 = G('path', '', 'temp'); $uq0 = G('type', '', '0'); $uq9 = [ 'path' =>$uq13, 'ptype' =>$uq0 ]; $uq6 = $this->module('album')->upload($uq9); echo json_encode($uq6); } public function upload_edit() { $uq13 = G('path', '', 'temp'); $uq9 = [ 'path' =>$uq13 ]; $uq14 = $this->module('album')->upload($uq9); if($uq14['error'] == '0'){ exit(json_encode(['error'=>0, 'url' =>$uq14['url']])); }else{ exit(json_encode(['error'=>1, 'message'=>$uq14['msg']])); } } } 