public function upload()
 {
     check_login();
     if (check_project_selected()) {
         $this->error(C('PROJECT_SELECT_TIP'));
     }
     $place = $_GET['place'];
     $upload = new \Think\Upload();
     $upload->maxSize = 3145728;
     $upload->exts = array('jpg', 'gif', 'png', 'jpeg');
     $upload->rootPath = './Uploads/';
     $upload->savePath = '';
     if (IS_POST) {
         $info = $upload->upload();
         if (!$info) {
             $this->error($upload->getErrorMsg());
         } else {
             $Photos = M("Photos");
             if ($Photos) {
                 foreach ($info as $file) {
                     $data['img_url'] = $file['savepath'] . $file['savename'];
                     $data['img_title'] = I("post.img_title") == null ? "unname" : I("post.img_title");
                     $data['place_id'] = $place;
                     if ($Photos->data($data)->add()) {
                         $this->success("上传成功!");
                     } else {
                         $this->error("写入失败!");
                     }
                 }
             } else {
                 $this->error($upload->getError());
             }
         }
     }
 }
 public function chooseTheme()
 {
     check_login();
     if (check_project_selected()) {
         $this->error(C('PROJECT_SELECT_TIP'));
     }
     $id = session('CURRENT_PROJECT');
     $data['theme'] = I('post.themeOption');
     if (M('Place')->where('id=' . $id)->save($data)) {
         $this->success('修改成功');
     } else {
         $this->error('你没有任何修改');
     }
 }
 public function delete()
 {
     check_login();
     if (check_project_selected()) {
         $this->error(C('PROJECT_SELECT_TIP'));
     }
     $place = $_GET['place'];
     $key = $_GET['key'];
     if (!($OP = D('Hotel'))) {
         $this->error('不存在该数据表');
     }
     if ($OP->deleteData($place, $key)) {
         $this->success('删除成功');
     } else {
         $this->error('删除失败');
     }
 }
 public function upload()
 {
     check_login();
     if (check_project_selected()) {
         $this->error(C('PROJECT_SELECT_TIP'));
     }
     $place = $_GET['place'];
     if (IS_POST) {
         $upload = new \Think\Upload();
         // 实例化上传类
         $upload->maxSize = 3145728;
         // 设置附件上传大小
         $upload->exts = array('jpg', 'gif', 'png', 'jpeg');
         // 设置附件上传类型
         $upload->rootPath = './Uploads/img/';
         $upload->savePath = '';
         $upload->saveName = $place;
         // 设置附件上传目录
         $upload->replace = true;
         // 上传文件
         $info = $upload->upload();
         if (!$info) {
             // 上传错误提示错误信息
             $this->error($upload->getError());
         } else {
             // 上传成功
             if (!($OP = M('Place'))) {
                 $this->error('不存在该数据表');
             }
             $data['cover'] = '/Uploads/img/' . $info[img]['savepath'] . $info[img]['savename'];
             if ($OP->where('id=' . $place)->save($data)) {
                 $this->success('修改成功');
             } else {
                 $this->error('修改失败');
             }
             $this->success('上传成功!');
         }
     }
 }