存客宝应用接口初始化
This commit is contained in:
37
application/common/model/DeviceWechatLogin.php
Normal file
37
application/common/model/DeviceWechatLogin.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 微信好友模型类
|
||||
*/
|
||||
class DeviceWechatLogin extends Model
|
||||
{
|
||||
const ALIVE_WECHAT_ACTIVE = 1; // 微信在线
|
||||
const ALIVE_WECHAT_DIED = 0; // 微信离线
|
||||
|
||||
// 登录日志最新登录 alive = 1,旧数据全部设置0
|
||||
protected $name = 'device_wechat_login';
|
||||
|
||||
// 自动写入时间戳
|
||||
protected $autoWriteTimestamp = true;
|
||||
protected $createTime = 'createTime';
|
||||
protected $updateTime = 'updateTime';
|
||||
|
||||
/**
|
||||
* 获取设备最新登录记录的id
|
||||
*
|
||||
* @param array $deviceIds
|
||||
* @return array
|
||||
*/
|
||||
public static function getDevicesLatestLogin(array $deviceIds): array
|
||||
{
|
||||
return static::fieldRaw('max(id) as lastedId,deviceId')
|
||||
->whereIn('deviceId', $deviceIds)
|
||||
->group('deviceId')
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user