Пример #1
0
 public function replyAction()
 {
     $content = $this->getRequest()->getParam('context');
     // echo $content;
     //得到expertid
     $expertid = $_SESSION["userinfo"][0][id];
     $questionid = $_SESSION["question"][questionid];
     $usertable = new UserModel();
     $db1 = $usertable->getAdapter();
     $response = new Expert_ResponseModel();
     $db2 = $response->getAdapter();
     $question = new User_QuestionModel();
     $db3 = $question->getAdapter();
     //  exit();
     $questions = $db3->query('SELECT userconquestion.* FROM userconquestion WHERE id=? ', $questionid)->fetchAll();
     $userid = $questions[0][userid];
     //   print_r($questions);
     //获取当前时间
     $t = time();
     $time = date("Y-m-d H:i:s", $t);
     $set = array('expertid' => $expertid, 'userid' => $userid, 'questionid' => $questionid, 'response' => $content, 'time' => $time);
     //   print_r($insertset);
     $flag1 = $response->insert($set);
     $state = 0;
     $updateset = array('state' => $state);
     $question->update($updateset, $db3->quoteInto('id = ?', $questionid));
     $this->view->info = '回复成功';
     $this->view->expertid = $expertid;
     $this->_forward('result7', 'globals');
 }