Example #1
0
 public function delete()
 {
     $where = 'id=' . $this->getId();
     return Application_Model_M_ConsultDialog::delete($where);
 }
 public function dhistoryAction()
 {
     $id = $this->_getParam('id');
     //userid
     $role = $this->_getParam('role');
     //get from doctorAction
     if ($this->_auth->userid && $this->_auth->role == 2) {
         $una = Yy_Utils::getNameAvatar($id, $role);
         $out['uid'] = $id;
         $out['uname'] = $una['name'];
         $out['uavatar'] = $una['avatar'];
         $dna = Yy_Utils::getNameAvatar($this->_auth->userid, 2);
         $out['did'] = $this->_auth->userid;
         $out['dname'] = $dna['name'];
         $out['davatar'] = $dna['avatar'];
         $historys = Application_Model_M_ConsultDialog::fetchHistoryByUserIdRoleAndDoctorId($id, $role, $this->_auth->userid);
         if (count($historys) > 0) {
             $historys = array_reverse($historys);
             $out['errno'] = '0';
             $results = array();
             foreach ($historys as $history) {
                 $result = array('id' => $history->getFrom_user(), 'msg' => $history->getMessage(), 'time' => $history->getCtime());
                 array_push($results, $result);
             }
             $out['historys'] = $results;
         } else {
             $out['errno'] = '1';
         }
     } else {
         $out['errno'] = '200';
     }
     $out['msg'] = Yy_ErrMsg_Consult::getMsg('dhistory', $out['errno']);
     Yy_Utils::jsonOut($out);
 }