私域抄盘手 - 设备详情返工
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
@@ -7,49 +8,4 @@ class Attachment extends Model
|
||||
{
|
||||
// 设置表名
|
||||
protected $name = 'attachments';
|
||||
|
||||
// 设置主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 自动写入时间戳
|
||||
protected $autoWriteTimestamp = 'datetime';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'create_at';
|
||||
protected $updateTime = 'update_at';
|
||||
protected $deleteTime = 'delete_at';
|
||||
|
||||
// 定义字段类型
|
||||
protected $type = [
|
||||
'id' => 'integer',
|
||||
'dl_count' => 'integer',
|
||||
'size' => 'integer',
|
||||
'scene' => 'integer',
|
||||
'create_at' => 'datetime',
|
||||
'update_at' => 'datetime',
|
||||
'delete_at' => 'datetime'
|
||||
];
|
||||
|
||||
/**
|
||||
* 添加附件记录
|
||||
* @param array $data 附件数据
|
||||
* @return int|bool
|
||||
*/
|
||||
public static function addAttachment($data)
|
||||
{
|
||||
$attachment = new self();
|
||||
return $attachment->allowField(true)->save($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据hash_key获取附件
|
||||
* @param string $hashKey
|
||||
* @return array|null
|
||||
*/
|
||||
public static function getByHashKey($hashKey)
|
||||
{
|
||||
return self::where('hash_key', $hashKey)
|
||||
->where('delete_at', null)
|
||||
->find();
|
||||
}
|
||||
}
|
||||
14
Server/application/common/model/Device.php
Normal file
14
Server/application/common/model/Device.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 设备模型类
|
||||
*/
|
||||
class Device extends Model
|
||||
{
|
||||
// 设置表名
|
||||
protected $name = 'device';
|
||||
}
|
||||
14
Server/application/common/model/DeviceTaskconf.php
Normal file
14
Server/application/common/model/DeviceTaskconf.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 设备任务配置模型类
|
||||
*/
|
||||
class DeviceTaskconf extends Model
|
||||
{
|
||||
// 设置表名
|
||||
protected $name = 'device_taskconf';
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class DeviceUser extends Model
|
||||
* 数据表名
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'tk_device_user';
|
||||
protected $name = 'device_user';
|
||||
|
||||
/**
|
||||
* 设置主键
|
||||
@@ -150,26 +150,7 @@ class DeviceUser extends Model
|
||||
])->delete() !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否有权限操作指定设备
|
||||
* @param int $userId 用户ID
|
||||
* @param int $deviceId 设备ID
|
||||
* @param int $companyId 公司ID
|
||||
* @return bool 是否有权限
|
||||
*/
|
||||
public static function checkUserDevicePermission($userId, $deviceId, $companyId = null)
|
||||
{
|
||||
$where = [
|
||||
'userId' => $userId,
|
||||
'deviceId' => $deviceId
|
||||
];
|
||||
|
||||
if (!is_null($companyId)) {
|
||||
$where['companyId'] = $companyId;
|
||||
}
|
||||
|
||||
return self::where($where)->count() > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关联用户模型
|
||||
|
||||
14
Server/application/common/model/DeviceWechatLogin.php
Normal file
14
Server/application/common/model/DeviceWechatLogin.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 微信好友模型类
|
||||
*/
|
||||
class DeviceWechatLogin extends Model
|
||||
{
|
||||
// 登录日志最新登录 alive = 1,旧数据全部设置0
|
||||
protected $name = 'device_wechat_login';
|
||||
}
|
||||
14
Server/application/common/model/WechatAccount.php
Normal file
14
Server/application/common/model/WechatAccount.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 微信账号模型类
|
||||
*/
|
||||
class WechatAccount extends Model
|
||||
{
|
||||
// 设置表名
|
||||
protected $name = 'wechat_account';
|
||||
}
|
||||
14
Server/application/common/model/WechatFriend.php
Normal file
14
Server/application/common/model/WechatFriend.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 微信好友模型类
|
||||
*/
|
||||
class WechatFriend extends Model
|
||||
{
|
||||
// 设置表名
|
||||
protected $name = 'wechat_friend';
|
||||
}
|
||||
Reference in New Issue
Block a user