53 lines
1.1 KiB
PHP
Executable File
53 lines
1.1 KiB
PHP
Executable File
<?php
|
|
namespace app\model;
|
|
|
|
use think\model\relation\HasOne;
|
|
|
|
/**
|
|
* 分享注册收益日志表
|
|
*
|
|
* Class ShareRegLog
|
|
* @package app\model
|
|
*/
|
|
class ShareRegLog extends Base
|
|
{
|
|
// 当前为2级分销
|
|
public const SHARE_GRADE_FIRST = 'first'; // 一级分销
|
|
public const SHARE_GRADE_SECOND = 'second'; // 二级分销
|
|
public const SHARE_GRADE_SERVICE = 'service'; // 服务接待收益
|
|
|
|
/**
|
|
* 可用分享层级
|
|
* @return string[]
|
|
*/
|
|
public static function allowShareGrades(): array
|
|
{
|
|
return [
|
|
self::SHARE_GRADE_FIRST,
|
|
self::SHARE_GRADE_SECOND,
|
|
self::SHARE_GRADE_SERVICE
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 模型关联:注册用户
|
|
*
|
|
* @return HasOne
|
|
*/
|
|
public function account(): HasOne
|
|
{
|
|
return $this->hasOne(Account::class, 'id', 'reg_account_id');
|
|
}
|
|
|
|
/**
|
|
* 模型关联:绑定的邀请人
|
|
*
|
|
* @return HasOne
|
|
*/
|
|
public function inviter(): HasOne
|
|
{
|
|
return $this->hasOne(Account::class, 'id', 'inviter_account_id');
|
|
}
|
|
|
|
|
|
} |