User.php
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Created by PhpStorm.
* User: Kevin
* Date: 2022/03/16 1500
* Time: 15:00
*/
namespace app\api\controller\getui;
use think\Db;
use think\Request;
/**
* 用户(unipush)
* @package app\api\controller\core
*/
class User extends Base
{
/**
* 1. 用户API_查询用户状态
*/
public function queryUserStatus()
{
$cid = $this->request->param("cid");
if(empty($cid)){
$this->error("用户id不能为空");
}
$cid_arr = [];//查询一个或者多个用户都要用数组
$cid_arr[] = $cid;
$result = $this->api->userApi()->queryUserStatus($cid_arr);
if (!empty($result)) {
if ($result['code'] == 0) {
$this->success("请求成功", $result['data'][$cid]);//状态,online在线 offline离线
} else {
$this->error("请求异常[" . $result['code'] . $result['msg'] . "]");
}
} else {
$this->error("unipush服务器请求异常");
}
}
}