/** * @static * @return rest_Server */ public static function instance() { if (self::$self == NULL) { self::$self = new self(); } return self::$self; }
/** * Scaffold delete */ protected function ScaffoldRemove() { $this->rest->method('POST'); $parms = $this->getRequest()->getPost(); $this->rest->paramsMustMap = array('primary'); $this->rest->paramsMustValid($parms); $result = $this->db->delete($this->table_name, array($this->primary => $parms['primary'])); if ($result) { $this->rest->success(); } $this->rest->error(); }
/** * 主要check流程 * @param string $key */ public function check($key = NULL) { self::getkey($key); $ready = $this->cache->get($this->key); if ($ready == FALSE) { $this->cache->set($this->key, array(time())); return; } $ready_ = $ready; if (self::checkCountAndTime($ready_)) { $this->rest->error(rest_Code::STATUS_ERROR_API_QUENCY_M); } unset($ready_); array_push($ready, time()); $this->cache->set($this->key, $ready); }
function __construct() { $this->rest = rest_Server::instance(); }