此章接口都来源于:http://api.ajaxsns.com/ ,感谢作者的无私奉献。
先看效果图
代码如下:
1、共同方法
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
private
function
_ajaxsns_comm(
$msg
){
$param
=
array
(
"key"
=>
"free"
,
"appid"
=>
"0"
,
"msg"
=>
"$msg"
);
$json
=json_decode(
$datas
);
if
(
$json
->result==0){
$content
=
str_replace
(
"{br}"
,
"\n"
,
$json
->content);
}
else
{
$content
=
"从前有座山,山上有座庙,庙里有个小和尚,-^-,连接出错,请稍后再试,^_^."
;
}
$content
.=
"\n\n小助手:回复 @ 进入主界面"
;
return
array
(
$content
,
"text"
);
}
|
2、其他实现
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//中英互译
private
function
get_translate(
$find_name
){
return
$this
->_ajaxsns_comm(
"翻译"
.
$find_name
);
}
//歌词
private
function
get_lyric(
$find_name
){
return
$this
->_ajaxsns_comm(
"歌词"
.
$find_name
);
}
//藏头诗
private
function
get_poem(
$find_name
){
return
$this
->_ajaxsns_comm(
"藏头诗"
.
$find_name
);
}
//智能多天
private
function
get_chat(
$find_name
){
return
$this
->_ajaxsns_comm(
$find_name
);
}
|
OK ,收工