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

66 lines
1.5 KiB
PHP
Raw Normal View History

2025-04-10 16:40:30 +08:00
<?php
namespace app\cunkebao\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 工作台模型
*/
class Workbench extends Model
{
2025-04-12 18:31:53 +08:00
protected $table = 'ck_workbench';
2025-04-10 16:40:30 +08:00
protected $pk = 'id';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $dateFormat = 'Y-m-d H:i:s';
// 创建时间获取器
public function getCreateTimeAttr($value)
{
return $value ? date('Y-m-d', is_numeric($value) ? $value : strtotime($value)) : '';
}
// 更新时间获取器
public function getUpdateTimeAttr($value)
{
return $value ? date('Y-m-d', is_numeric($value) ? $value : strtotime($value)) : '';
}
// 自动点赞配置关联
public function autoLike()
{
return $this->hasOne('WorkbenchAutoLike', 'workbenchId', 'id');
}
// 朋友圈同步配置关联
public function momentsSync()
{
return $this->hasOne('WorkbenchMomentsSync', 'workbenchId', 'id');
}
// 群消息推送配置关联
public function groupPush()
{
return $this->hasOne('WorkbenchGroupPush', 'workbenchId', 'id');
}
// 自动建群配置关联
public function groupCreate()
{
return $this->hasOne('WorkbenchGroupCreate', 'workbenchId', 'id');
}
/**
* 用户关联
*/
2025-04-12 15:08:21 +08:00
public function user()
{
return $this->belongsTo('User', 'userId', 'id');
2025-04-12 15:08:21 +08:00
}
2025-04-10 16:40:30 +08:00
}