Ai_GirlFriend/xunifriend_RaeeC/application/common/model/FriendRequests.php

29 lines
612 B
PHP
Raw Normal View History

2026-01-31 19:15:41 +08:00
<?php
namespace app\common\model;
use think\Model;
use app\common\model\User ;
class FriendRequests extends Model
{
protected $name = 'friend_requests';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
public function fromUser()
{
return $this->belongsTo('User', 'from_user_id', 'id');
}
public static function getNotification($to_user_id)
{
return self::where(['to_user_id'=>$to_user_id,'status'=>0])->count();
}
}