[运营]用户阅读记录
This commit is contained in:
33
app/admin/controller/operation/UserNoticeRead.php
Normal file
33
app/admin/controller/operation/UserNoticeRead.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\operation;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use support\Response;
|
||||
use Webman\Http\Request as WebmanRequest;
|
||||
|
||||
/**
|
||||
* 用户公告阅读记录
|
||||
*/
|
||||
class UserNoticeRead extends Backend
|
||||
{
|
||||
protected ?object $model = null;
|
||||
|
||||
protected string|array $preExcludeFields = ['id', 'create_time'];
|
||||
|
||||
protected string|array $quickSearchField = ['id', 'user_id', 'notice_id'];
|
||||
|
||||
protected string|array $defaultSortField = ['id' => 'desc'];
|
||||
|
||||
protected string|array $orderGuarantee = ['id' => 'desc'];
|
||||
|
||||
protected array $withJoinTable = ['user', 'operationNotice'];
|
||||
|
||||
protected bool $modelValidate = false;
|
||||
|
||||
protected function initController(WebmanRequest $request): ?Response
|
||||
{
|
||||
$this->model = new \app\common\model\UserNoticeRead();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
28
app/common/model/UserNoticeRead.php
Normal file
28
app/common/model/UserNoticeRead.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use support\think\Model;
|
||||
|
||||
class UserNoticeRead extends Model
|
||||
{
|
||||
protected $name = 'user_notice_read';
|
||||
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
protected $type = [
|
||||
'create_time' => 'integer',
|
||||
'read_at' => 'integer',
|
||||
'confirmed' => 'integer',
|
||||
];
|
||||
|
||||
public function user(): \think\model\relation\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function operationNotice(): \think\model\relation\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(OperationNotice::class, 'notice_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user