PHP code example of jncinet / qihucms-information
1. Go to this page and download the library: Download jncinet/qihucms-information library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jncinet / qihucms-information example snippets
请求:GET
地址:information/friends?status=1,好友状态&limit=15每页条数&page=页码
返回值:
{
data: [
{
'id' => 1,
'user_id' => 2,
'friend' => {好友会员资料},
'friend_name' => "好友1", // 好友备注名
'status' => 1, // 好友状态
'information_messages_count' => 0, // 消息总数
'information_messages_first' => "你好", // 最新消息
'created_at' => "1秒前",
},
...
],
links:{},
meta:{}
}
请求:POST
地址:information/friends
参数:
{
friend_id: 要添加会员ID,
password: 好友验证密码,
answer: 好友验证问题答案
}
返回值:
{
'id' => 1,
'user_id' => 2,
'friend' => {好友会员资料},
'friend_name' => "好友1", // 好友备注名
'status' => 1, // 好友状态
'information_messages_count' => 0, // 消息总数
'information_messages_first' => "你好", // 最新消息
'created_at' => "1秒前",
}
请求:GET
地址:information/friends/{id=好友ID}?status={有此参数无论何值均为不通过,无此参数即为通过}
返回值:
{
status: SUCCESS,
result: {
friend_id: 好友ID,
status: 1, // ['待确认', '已通过', '已拒绝', '已删除']
}
}
请求:PATCH|PUT
地址:information/friends/{id=好友ID}
参数:{
friend_name: '备注名'
}
返回值:
{
status: SUCCESS,
result: {
friend_id: 好友ID,
friend_name: '备注名'
}
}
请求:DELETE
地址:information/friends/{id=好友ID}
返回值:
{
status: SUCCESS,
result: {
friend_id: 好友ID,
}
}
请求:GET
地址:information/messages/{id=好友关系ID}
返回值:
{
data: [
{
'id' => 1,
'user_id' => 2,
'information_friend' => {好友会员资料},
'friend_name' => "好友1", // 好友备注名
'status' => 1, // 好友状态
'information_messages_count' => 0, // 消息总数
'information_messages_first' => "你好", // 最新消息
'created_at' => "1秒前",
},
...
],
links:{},
meta:{}
}
请求:GET
地址:information/messages?limit=15每页条数&page=页码
返回值:
{
data: [
{
'id' => 1,
'user_id' => 2,
'information_friend' => {
'id' => 1,
'user_id' => 2,
'friend' => {好友会员资料},
'friend_name' => "好友1", // 好友备注名
'status' => 1, // 好友状态
'information_messages_count' => 0, // 消息总数
'information_messages_first' => "你好", // 最新消息
'created_at' => "1秒前",
},
'type' => 0, // ['文本', '图片', '视频', '音频', '分享连接']
'message' => "消息内容",
'status' => 1, // 消息状态
'created_at' => "1秒前",
},
...
],
links:{},
meta:{}
}
// 添加好友
Qihucms\Information\Events\AddFriend;
// 发送消息
Qihucms\Information\Events\SendMessage;
shell
$ php artisan migrate
shell
$ php artisan vendor:publish --provider="Qihucms\Information\InformationServiceProvider"
shell
$ php artisan information:checkMessage