/** * 重载save方法,为了增加modId * @param array $data * @return int */ public function save($data = array()) { $temp = array(); foreach ($this->properties() as $property) { if (!is_null($this->{$property})) { $temp[$property] = $this->{$property}; } } $log = ''; try { if (1 == parent::save($data)) { $temp['id'] = $this->id; Model_Log_HouseLogIndexNew::doubleWrite(array_merge($temp, $data), $this->splitSuffix); return 1; } } catch (Exception $e) { $log = $e->getTraceAsString(); } $logFile = sprintf('/data1/logs/Model_House_HouseLogIndex-%d.log', $this->splitSuffix); @file_put_contents($logFile, sprintf('[%s] %s %s' . PHP_EOL, date('Y-m-d H:i:s'), __CLASS__, json_encode($temp)), FILE_APPEND); if ($log != '') { @file_put_contents($logFile, sprintf('[%s] %s %s' . PHP_EOL, date('Y-m-d H:i:s'), __CLASS__, $log), FILE_APPEND); } return 0; }