public function __construct($data) { global $root_path; $this->msg = $data; $this->time = time() - 1200; $this->qun = M('qun')->where("UserName='******'user']['id']}'")->find(); $this->user = M('qun_user')->where("UserName='******'content']['user']['id']}'")->find(); $this->json = $json = array('msg_code' => 10001, 'msg_content' => '', 'data' => array('type' => 1, 'uid' => $data['user']['id'], 'message' => "", 'expand' => '')); flogs($root_path . '/auto/msg.log', json_encode($data)); }
if (!$json['data']['uid']) { $json['msg_code'] = 10004; $json['msg_content'] = 'ERROR MSG'; break; } $word = $data['content']['data']; $cl = new SphinxClient(); //$cl-> $cl->SetServer('127.0.0.1', 9312); $cl->SetConnectTimeout(3); $cl->SetArrayResult(true); $cl->SetMatchMode(SPH_MATCH_EXTENDED2); $word = str_replace('@', '', $word); $res = $cl->Query("@command {$word}", "*"); if (empty($res)) { flogs(__DIR__ . '/search.log', $word); $json['msg_code'] = 10005; $json['msg_content'] = $word; break; } try { if ($res['matches']) { $res = $res['matches'][0]; $json['command'] = $res['attrs']['command_str']; $json['ext'] = $res; if ($res['attrs']['msgtype'] == 'msg') { $msg = M('qun_command')->find($res['id']); $json['data']['message'] = $msg['message']; break; } else { $fun = $res['attrs']['action'];