54 lines
1.0 KiB
PHP
54 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace app\admin\model\wdsxh\message;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class MessageNotificationMemberId extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'wdsxh_message_notification_member_id';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = false;
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = false;
|
|
protected $updateTime = false;
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'send_status'
|
|
];
|
|
|
|
public function getSendStatusAttr($value, $data)
|
|
{
|
|
$memberNotificationObj = (new MemberNotification())
|
|
->where('notification_id', $data['notification_id'])
|
|
->where('member_id', $data['member_id'])
|
|
->find();
|
|
return $memberNotificationObj ? 1 : 2;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function member()
|
|
{
|
|
return $this->belongsTo('app\admin\model\wdsxh\Member', 'member_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
|
}
|
|
}
|