Ejemplo n.º 1
0
 /**
  * 图片上传
  */
 public function picture_upload()
 {
     try {
         $this->ajax = true;
         $req = req()->_plain();
         $this->throwMsgCheck('is_post', 'is_login', 'is_active');
         $this->__lib('Picture', 'Server');
         $pic = new Picture();
         $server = new Server();
         $this->rt_msg['content'] = $pic->add($req->post('name'), $req->post('tag'), $req->post('desc'), @$_FILES['files'], $server->getNowServer(), login_user());
         $this->rt_msg['status'] = count($this->rt_msg['content']['list']) > 0;
         if ($this->rt_msg['status'] && $req->post('get_msg') == 1) {
             $this->rt_msg['content']['msg'] = $pic->get(join(',', $this->rt_msg['content']['list']), login_user()->getId());
         }
     } catch (\Exception $ex) {
         $this->rt_msg['msg'] = $ex->getMessage();
         $this->rt_msg['code'] = $ex->getCode();
     }
 }