/** * 关键词基础处理 * @param #[关键词] @[回复体] 默认全局变量 * @return array */ public function setParam($type, $content) { $respondeinfo = array(); switch ($type) { case '#': $respondeinfo = get_single_keyword($content, $field = '*'); break; case '@': $respondeinfo = get_single_response($content, $field = '*'); break; default: global $_K; $respondeinfo = $_K; break; } //回复体状态 $this->static = $respondeinfo['response_static']; //回复体类型 Api类型 $this->type = $respondeinfo['response_reply']; //设置下文 $this->down = $respondeinfo['keyword_down']; //设置缓存 $this->cache = $respondeinfo['keyword_cache']; //原始XML体 $this->originalxml = $respondeinfo['response_xml']; //原始XML体 $this->detail = $respondeinfo['response_compos']; //菜单模式 $this->clickmodel = $respondeinfo['click_model']; //锁定模式 $this->lockmodel = $respondeinfo['lock_model']; //回复前执行 $this->behaviorhead = unserialize($respondeinfo['before_keyword']); //回复后执行 $this->behaviorend = unserialize($respondeinfo['after_keyword']); return $respondeinfo; }
/** * 获取单条关键词信息 * param: $last_do[0] 时间 $last_do[1] 关键词ID * @return array */ function error_type($id) { $info = get_single_keyword($id, $field = '*'); if ($info['keyword_post'] == 'text') { return '激活【' . $info['keyword_content'] . '】'; } else { $error_context = array('image' => '发送一张图片', 'voice' => '发送一段录音', 'video' => '发送一段视频', 'location' => '发送位置信息', 'link' => '发送一段收藏链接', 'music' => '发送一首音乐'); return $error_context[$info['keyword_post']]; } }