Files
dafuweng/addons/webman/model/CommissionRecord.php
2026-03-02 13:44:38 +08:00

73 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace addons\webman\model;
use addons\webman\traits\DataPermissions;
use addons\webman\traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class SignIns
* @property int id 主键
* @property int player_id 玩家id
* @property int department_id 渠道id
* @property int parent_player_id 推广玩家
* @property float recharge_amount 充值金额
* @property float chip_amount 打码量
* @property float total_amount 总佣金
* @property float damage_amount 客损金额
* @property float amount 佣金
* @property float ratio 佣金比例
* @property string date 日期
* @property string created_at 创建时间
* @property string updated_at 最后一次修改时间
*
* @property Player player 玩家
* @property Player parentPlayer 分润玩家
* @property Channel channel 渠道
* @package addons\webman\model
*/
class CommissionRecord extends Model
{
use HasDateTimeFormatter, DataPermissions;
//数据权限字段
protected
$dataAuth = ['department_id' => 'department_id'];
//简写省略id默认后台用户表的id
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->setTable(plugin()->webman->config('database.commission_record_table'));
}
/**
* 渠道信息
* @return BelongsTo
*/
public function channel(): BelongsTo
{
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
}
/**
* 玩家信息
* @return BelongsTo
*/
public function player(): BelongsTo
{
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id');
}
/**
* 分润玩家信息
* @return BelongsTo
*/
public function parentPlayer(): BelongsTo
{
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'parent_player_id');
}
}