/** * 压入队列 */ public function actionRefreshPush() { // server setting // $this->server->setting['redis_host'] // $this->server->setting['redis_port'] $response = $this->argv['response']; $response->header('Content-Type', 'application/json'); $response->header('Server', 'VC-SERVER'); $method = $this->argv['request']['method']; if ('POST' != strtoupper($method)) { $error_message = json_encode(array('code' => 0, 'message' => 'that should only be accessible via the POST method')); $response->end($error_message); (yield Swoole\Coroutine\SysCall::end('end')); return; } // global vars, data is encode $data = $this->argv['request']['post']['data']; $redis_key = 'refresh_' . md5($data); $model = new APIModel(); $res = (yield $model->redisSet($redis_key, $data)); // success if ($res == 'OK') { $ok_message = json_encode(array('code' => 1, 'message' => 'success')); $this->server->scheduler->newTask($this->RefreshExecute($data)); $this->server->scheduler->run(); //$response->end($ok_message); } }
public function actionTest() { SysLog::info(__METHOD__, __CLASS__); $response = $this->argv['response']; $res = (yield $this->test()); SysLog::debug(__METHOD__ . " res == " . print_r($res, true), __CLASS__); $response->end(" test response 16" . print_r($res, true)); (yield Swoole\Coroutine\SysCall::end('test for syscall end')); }
public function actionTest() { $response = $this->argv['response']; $test = ''; foreach (self::input_parser(self::$input) as $id => $fields) { $test .= $id . $fields[0] . $fields[1] . "\n"; } $response->end($test); (yield Swoole\Coroutine\SysCall::end('end')); //yield Swoole\Coroutine\SysCall::end('test for syscall end'); /*SysLog::info(__METHOD__, __CLASS__); $response = $this ->argv['response']; $res =(yield $this ->test()); SysLog::debug(__METHOD__ ." res == ".print_r($res, true), __CLASS__); $response ->end(" test response "); yield Swoole\Coroutine\SysCall::end('test for syscall end');*/ }