public static function fetchAll($where = null, $order = null, $limit = null, $offset = null) { $resultSet = self::getDbTable()->fetchAll($where, $order, $limit, $offset); $entries = array(); foreach ($resultSet as $row) { $entry = new Application_Model_O_ConsultDialog(); $entry->setId($row->id)->setFrom_user($row->from_user)->setFrom_role($row->from_role)->setTo_user($row->to_user)->setTo_role($row->to_role)->setMessage($row->message)->setCtime($row->ctime)->setUtime($row->utime)->setStatus($row->status); $entry->setNew(false); $entries[] = $entry; } return $entries; }
public function im2userAction() { $id = $this->_getParam('id'); $role = $this->_getParam('role'); //get from doctorAction $msg = $this->_getParam('msg'); if ($this->_auth->userid && $this->_auth->role == 2) { if ($role == 1) { //nuser $imuser = Application_Model_M_Nuser::find($id); } elseif ($role == 2) { //doctor $imuser = Application_Model_M_Doctor::find($id); } elseif ($role == 3) { //hospital $imuser = Application_Model_M_Hospital::find($id); } if ($imuser && $imuser->getStatus() == 1) { $dailog = new Application_Model_O_ConsultDialog(); $dailog->setFrom_user($this->_auth->userid)->setFrom_role(2)->setTo_user($id)->setTo_role($role)->setMessage($msg)->setCtime(date('Y-m-d H:i:s')); try { $out['errno'] = '0'; $dailog->save(); } catch (Zend_Db_Exception $e) { $out['errno'] = '1'; } } else { $out['errno'] = '1'; } } else { $out['errno'] = '200'; } $out['msg'] = Yy_ErrMsg_Consult::getMsg('im2user', $out['errno']); Yy_Utils::jsonOut($out); }