public function updateCode() { if (empty($this->cid)) { return false; } $data = array('status' => 1, 'updatetime' => FNbase::getTime()); $this->codelist->cid = $this->cid; $this->codelist->edit($data); return true; }
protected function requestProxy($params, $channel) { $url = $this->formatURL($channel); $params['apikey'] = $this->accesskey; $params['timestamp'] = FNbase::getTime(); $sign = $this->sign('POST', $url, $params); $params['sign'] = $sign; $options = array(); $options['url'] = $url; $options['method'] = $params['method']; if ($params['method'] == 'GET') { $options['url'] = $this->combineURL($options['url'], $params); } else { $options['content'] = $this->combineParams($params); } $response = $this->request($options); return $response->isOK() ? $response->getBodyJson() : false; }
protected function setSession($delete = false) { //$cache = FN::server('cache','session'); if ($delete) { //$cache->delete($this->session); $this->st->delete($this->session); } else { if (empty($this->user)) { return false; } if (empty($this->session)) { $this->session = FNbase::random(10); } //10位的随机性已经足够 $this->st->add(array('session' => $this->session, 'value' => FNbase::setEscape(json_encode($this->user), true), 'inserttime' => FNbase::getTime(), 'cachetime' => $this->cacheTime), true); //$cache->set($this->session,json_encode($this->user),false,$this->cacheTime); if (isset($this->user['password']) && $this->user['password']) { $this->login = '******'; } } $this->setCookie($delete); return true; }