Delete 'intelligentinterface.lib.php'

src
pf7lbvaho 2 months ago
parent 9eb5f87e9c
commit d1b13f3c9e

@ -1,50 +0,0 @@
<?php
namespace LaneWeChat\Core;
/**
* 智能接口类,提供与微信智能接口相关的服务。
* 该类主要包含语义理解功能,可以将用户的自然语言转换为机器可理解的意图。
* Class IntelligentInterface
* User: lane
* Date: 14-10-31
* Time: 下午3:00
* E-mail: lixuan868686@163.com
* WebSite: http://www.lanecn.com
*/
class IntelligentInterface{
/**
* 语义理解接口,用于将用户的自然语言查询转换为结构化的语义表示。
* 该接口可以识别用户的意图,并返回相应的语义结果。
*
* @param string $query 输入文本串,用户的自然语言查询。
* @param string $category 需要使用的服务类型如“flight,hotel”多个类别用逗号分隔。
* @param string $openId 用户的OpenID用于标识用户。
* @param float $latitude 纬度坐标,与经度同时传入;与城市二选一传入。
* @param float $longitude 经度坐标,与纬度同时传入;与城市二选一传入。
* @param string $region 区域名称,在城市存在的情况下可省;与经纬度二选一传入。
* @param string $city 城市名称,如“北京”,与经纬度二选一传入。
* @return bool|mixed 语义理解结果失败返回false。
* 《接口协议文档》http://mp.weixin.qq.com/wiki/images/1/1f/微信语义理解协议文档.zip
*/
public static function semanticSemproxy($query, $category, $openId, $latitude='', $longitude='', $region='', $city=''){
// 构建请求URL包含access_token
$queryUrl = 'https://api.weixin.qq.com/semantic/semproxy/search?access_token='.AccessToken::getAccessToken();
// 设置请求方法为POST
$queryAction = 'POST';
// 构建请求模板
$template = array();
$template['query'] = $query;
$template['category'] = $category;
$template['appid'] = WECHAT_APPID; // 微信公众号的AppID
$template['uid'] = $openId; // 用户的OpenID
// 如果提供了经纬度信息,则添加到请求模板中
if(!empty($latitude)) $template['latitude'] = $latitude;
if(!empty($longitude)) $template['longitude'] = $longitude;
// 如果提供了区域或城市信息,则添加到请求模板中
if(!empty($region)) $template['region'] = $region;
if(!empty($city)) $template['city'] = $city;
// 将请求模板转换为JSON格式
$template = json_encode($template);
// 调用Curl类的方法发送请求并获取结果
return Curl::callWebServer($queryUrl, $template, $queryAction, 0, 0);
}
}
Loading…
Cancel
Save