public static function append($log, $type = 'opococ', $line = 0) { Mylog::add('info', $log, $type, $line); }
/** * 排序 * * @param int $id 分类ID * @param string $position 排序方向 * @return boolean */ public function position($id, $position) { $orm = ORM::factory('carrier_range')->where('id', $id)->find(); if ($orm->loaded) { if ($position == 'up') { $orm->position = $orm->position - 3; } else { $orm->position = $orm->position + 3; } $orm->save(); $orm_list = ORM::factory('carrier_range')->where(array('site_id' => $orm->site_id))->orderby(array('position' => 'ASC'))->find_all(); foreach ($orm_list as $key => $rs) { if ($rs->position != $key * 2 + 1) { $rs->position = $key * 2 + 1; $rs->save(); } } return TRUE; } else { $error = 'ID ' . $id . ' 数据不存在'; Mylog::instance()->error($error, __FILE__, __LINE__); return FALSE; } }