You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/common/model/invite/InviteLog.php

56 lines
1.0 KiB

<?php
declare (strict_types=1);
namespace app\common\model\invite;
use app\common\model\User;
use cores\BaseModel;
use think\model\relation\HasOne;
/**
* 邀请记录表
*
* This class represents the invite log entity.
* It extends the BaseModel class.
*/
class InviteLog extends BaseModel
{
// 定义表名
protected $name = 'invite_log';
// 定义主键
protected $pk = 'invite_id';
public function user(): HasOne
{
return $this->hasOne(User::class, 'user_id', 'user_id');
}
public function invitee(): HasOne
{
return $this->hasOne(User::class, 'user_id', 'invitee_user_id');
}
/**
* @notes:新增
* @param $data
* @return bool
* @author: wanghousheng
*/
public function add($data): bool
{
$data['store_id'] = self::$storeId;
return $this->save($data);
}
/**
* 详情
* @param array $where
* @return static|array|null
*/
public static function detail(array $where)
{
return self::get($where);
}
}