Exemple #1
0
 /**
  * Saves the current attributes to the DB.
  */
 public function save()
 {
     $this->beforeSave();
     // Trims out non-fields and serializes data for DB entry.
     $info = $this->info(true, true);
     if (!$this->exists) {
         $this->beforeCreate();
         $this->_zendDb->insert($this->tableName(), $info);
         if (!$this->id) {
             $this->id = $this->_zendDb->lastInsertId();
         }
         $this->_afterCommand('insert');
         $this->exists = true;
         $this->afterCreate();
     } else {
         $this->_zendDb->update($this->tableName(), $info, 'id = ' . $this->_zendDb->quote($this->id));
         $this->_afterCommand('update');
     }
     $this->afterSave();
     $this->_lastSaveRow = $this->info();
 }
 /**
  * 更新登录时间
  *
  * @param  integer  $uid
  */
 public function updateLogin($uid)
 {
     $where = $this->_db->quoteInto('uid=?', $uid);
     $set = array('last_ip' => get_client_ip(), 'last_time' => time());
     $this->_db->update('user', $set, $where);
 }
Exemple #3
0
 /**
  * Enter description here ...
  * @param unknown_type $id
  * @param unknown_type $active
  */
 public function setActive($id, $active)
 {
     $active = intval($active);
     $this->db->update("intro", array('active' => $active), "id=" . $id);
 }