1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2016/10/6
- * Time: 下午10:35
- */
- namespace search;
- class processor implements IProcessor
- {
- const GetRelatedWord = 1;
- const SearchReasult = 2;
- public function handle_input($body)
- {
- $body = unserialize($body);
- $type = $body['type'];
- if($type == self::GetRelatedWord)
- {
- $words = $body['keyword'];
- $result = searcher::instance()->get_word($words);
- return serialize($result);
- }
- else if($type == self::SearchReasult) {
- $params = $body['params'];
- $result = searcher::instance()->get_result($params);
- return serialize($result);
- }
- else {
- }
- }
- }
|