public function set()
 {
     if (!defined('VIRIFY')) {
         aboutaa();
     }
     if (IS_POST) {
         $where['id'] = I('post.id');
         $update_arr = I('post.user');
         M('sys')->where($where)->save($update_arr);
         $this->success('操作成功', U('sys/set'));
     } else {
         $sysinfo = M('sys')->where()->find();
         $this->assign('user', $sysinfo);
         $this->display();
     }
 }
 public function index()
 {
     if (!defined('VIRIFY')) {
         aboutaa();
     }
     $m = M('cate');
     $type = I('get.filetype', 'bgType');
     $where = array('type' => $type);
     $count = $m->where($where)->count();
     $p = getpage($count, 16);
     $list = $m->field(true)->where($where)->order('create_time desc')->limit($p->firstRow, $p->listRows)->select();
     $this->assign('select', $list);
     $this->assign('page', $p->show());
     $this->assign('type', $type);
     $this->display();
 }
 public function index()
 {
     if (!defined('VIRIFY')) {
         aboutaa();
     }
     $m = M('users');
     $where = array();
     $count = $m->where($where)->count();
     $p = getpage($count, 16);
     $list = $m->field(true)->where($where)->order('create_time desc')->limit($p->firstRow, $p->listRows)->select();
     $this->assign('select', $list);
     $this->assign('page', $p->show());
     //var_export($list);
     //echo C('TEST_ADMIN_ID');
     $this->display();
 }
 public function tagpagelist()
 {
     if (!defined('VIRIFY')) {
         aboutaa();
     }
     //$where['userid_int']  = 0;
     $m_tag = M('tag');
     $where['pageid_bigint'] = I('get.id', 0);
     $tagids_int_str = M('scenepagesys')->where($where)->getField('tagids_int');
     $m_upfilelist = $m_tag->where('tagid_int in (' . $tagids_int_str . ")")->select();
     $jsonstr = '{"success":true,"code":200,"msg":"success","obj":null,"map":null,"list":[';
     $jsonstrtemp = '';
     foreach ($m_upfilelist as $vo) {
         $jsonstrtemp = $jsonstrtemp . '{"id":' . $vo["tagid_int"] . ',"name":' . json_encode($vo["name_varchar"]) . ',"createUser":"******","createTime":1423122412000,"bizType":' . $vo["biztype_int"] . '},';
     }
     $jsonstr = $jsonstr . rtrim($jsonstrtemp, ',') . '';
     $jsonstr = $jsonstr . ']}';
     echo $jsonstr;
 }
 public function upload()
 {
     if (!defined('VIRIFY')) {
         aboutaa();
     }
     if (intval(session("userid")) == 0) {
         header('Content-type: text/json');
         header('HTTP/1.1 401 error');
         echo json_encode(array("success" => false, "code" => 1001, "msg" => "请先登录!", "obj" => null, "map" => null, "list" => null));
         exit;
     }
     $upload = new \Think\Upload();
     // 实例化上传类
     $upload->maxSize = 3145728;
     // 设置附件上传大小
     if (I('get.fileType', 0) == 2) {
         $upload->exts = array('mp3');
         // 设置附件上传类型
         $upload->savePath = 'mp3/' . session("userid") . '/';
         // 设置附件上传(子)目录
     } else {
         $upload->exts = array('jpg', 'gif', 'png', 'jpeg');
         // 设置附件上传类型
         $upload->savePath = 'pic/' . session("userid") . '/';
         // 设置附件上传(子)目录
     }
     $upload->rootPath = './Uploads/';
     // 设置附件上传根目录
     $upload->subName = array('date', 'Ym');
     // 采用时间戳命名
     $upload->saveName = 'uniqid';
     // 采用GUID序列命名
     //$upload->saveName = 'guid';
     // 上传文件
     $info = $upload->upload();
     if (!$info) {
         // 上传错误提示错误信息
         header('Content-type: text/json');
         header('HTTP/1.1 401 error');
         echo json_encode(array("success" => false, "code" => 1001, "msg" => "文件上传错误!", "obj" => null, "map" => null, "list" => null));
         echo $this->error($upload->getError());
         exit;
         //$this->error($upload->getError());
     } else {
         // 上传成功 获取上传文件信息
         header('Content-type: text/json');
         header('HTTP/1.1 200 ok');
         foreach ($info as $file) {
             $thubimagenew = $file['savepath'] . $file['savename'];
             if (I('get.fileType', 0) != 2) {
                 $image = new \Think\Image();
                 $thubimage = $file['savepath'] . $file['savename'];
                 $image->open($upload->rootPath . $thubimage);
                 $thubimagenew = str_replace("." . $file['ext'], "_thumb." . $file['ext'], $file['savename']);
                 $thubimagenewftp = $thubimagenew;
                 $thubimagenew = $file['savepath'] . $thubimagenew;
                 //echo $thubimagenew; exit;
                 // 按照原图的比例生成一个最大为150*150的缩略图并保存为thumb.jpg
                 if (I('get.fileType', 0) == 0) {
                     $image->thumb(80, 126)->save($upload->rootPath . $thubimagenew);
                 } else {
                     $image->thumb(80, 80)->save($upload->rootPath . $thubimagenew);
                 }
             }
             $sizeint = intval($file['size'] / 1024);
             $jsonstr = '{"success":true,"code":200,"msg":"success","obj":{"id":9386090,"name":"' . $file['savename'] . '","extName":"' . strtoupper($file['ext']) . '","fileType":0,"bizType":0,"path":"' . $file['savepath'] . $file['savename'] . '","tmbPath":"' . $thubimagenew . '","createTime":1426209412922,"createUser":"******"userid") . '","sort":0,"size":' . $sizeint . ',"status":1},"map":null,"list":null}';
             $model = M('upfile');
             // 取得成功上传的文件信息
             // 保存当前数据对象
             $data['ext_varchar'] = strtoupper($file['ext']);
             $data['filename_varchar'] = $file['name'];
             $data['filetype_int'] = I('get.fileType', 0);
             $data['biztype_int'] = I('get.bizType', 0);
             $data['userid_int'] = session("userid");
             $data['filesrc_varchar'] = $file['savepath'] . $file['savename'];
             $data['sizekb_int'] = $sizeint;
             $data['filethumbsrc_varchar'] = $thubimagenew;
             $data['create_time'] = date('y-m-d H:i:s', time());
             $model->add($data);
             echo $jsonstr;
         }
     }
 }