コード例 #1
0
 /**
  * 查看站内信
  */
 public function action_view()
 {
     $this->template->msgId = $msgId = (int) $this->getQuery('msg_id');
     $select = DB::select('mb.*', 'msgs.title', 'msgs.content', 'msgs.msg_time', 'u2.username', array('u.username', 'send_username'), 'msgs.msg_time', 'msgs.title')->from(array('msg_boxs', 'mb'))->join('msgs')->on('msgs.msg_id', '=', 'mb.msg_id')->join(array('users', 'u'))->on('u.uid', '=', 'mb.uid')->join(array('users', 'u2'))->on('u2.uid', '=', 'msgs.uid')->where('mb.type', '=', 'inbox')->where('mb.is_del', '=', '0')->where('mb.uid', '=', $this->auth['uid'])->where('mb.msg_id', '=', $msgId);
     $msg = new Msg($this->auth['uid']);
     $msg->setRead($msgId);
     $this->template->info = $info = $select->execute()->current();
     if ($this->isPost()) {
         $receiver = trim($this->getPost('receiver'));
         $title = trim($this->getPost('title'));
         $content = trim($this->getPost('content'));
         try {
             $msg->sendMsg($receiver, $title, $content, 0);
             $links[] = array('text' => '返回收件箱', 'href' => '/message/list');
             $this->show_message('回复邮件成功', 1, array(), true);
         } catch (Exception $e) {
             $this->show_message($e->getMessage(), 0, array(), true);
         }
     }
 }