Files
cunkebao_v3/Server/application/cunkebao/model/WechatAccount.php

57 lines
1.2 KiB
PHP
Raw Normal View History

2025-03-19 12:01:02 +08:00
<?php
2025-04-09 10:35:28 +08:00
namespace app\cunkebao\model;
2025-03-19 12:01:02 +08:00
use think\Model;
/**
* 微信账号模型类
*/
class WechatAccount extends Model
{
// 设置表名
protected $name = 'wechat_account';
2025-03-19 12:01:02 +08:00
/**
* 获取在线微信账号数量
*
2025-03-19 12:01:02 +08:00
* @param array $where 额外的查询条件
* @return int 微信账号数量
*/
public static function getOnlineWechatCount($where = [])
{
$condition = [
'deviceAlive' => 1,
'wechatAlive' => 1,
'isDeleted' => 0
2025-03-19 12:01:02 +08:00
];
2025-03-19 12:01:02 +08:00
// 合并额外条件
if (!empty($where)) {
$condition = array_merge($condition, $where);
}
2025-03-19 12:01:02 +08:00
return self::where($condition)->count();
}
2025-03-19 12:01:02 +08:00
/**
* 获取有登录微信的设备数量
*
2025-03-19 12:01:02 +08:00
* @param array $where 额外的查询条件
* @return int 设备数量
*/
public static function getDeviceWithWechatCount($where = [])
{
$condition = [
'deviceAlive' => 1,
'isDeleted' => 0
2025-03-19 12:01:02 +08:00
];
2025-03-19 12:01:02 +08:00
// 合并额外条件
if (!empty($where)) {
$condition = array_merge($condition, $where);
}
2025-03-19 12:01:02 +08:00
return self::where($condition)->count();
}
}