144 lines
3.8 KiB
PHP
144 lines
3.8 KiB
PHP
<?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 PlayerLotteryRecord
|
|
* @property int id 主键
|
|
* @property int player_id 玩家id
|
|
* @property string uuid 玩家uuid
|
|
* @property string player_phone 玩家手机号
|
|
* @property string player_name 玩家昵称
|
|
* @property int department_id 渠道id
|
|
* @property int machine_id 机台id
|
|
* @property string machine_name 机台名
|
|
* @property string machine_code 机台code
|
|
* @property int game_type 机台类型
|
|
* @property string odds 比值
|
|
* @property float amount 派彩
|
|
* @property int is_max 是否最高
|
|
* @property int lottery_id 彩金id
|
|
* @property string lottery_name 彩金名
|
|
* @property float lottery_pool_amount 彩金池金额
|
|
* @property float lottery_rate 金额比例
|
|
* @property int lottery_type 彩金类型
|
|
* @property int lottery_multiple 彩金倍数
|
|
* @property int lottery_sort 排序
|
|
* @property float cate_rate 派彩系数
|
|
* @property int user_id 管理员id
|
|
* @property int user_name 管理员名称
|
|
* @property string reject_reason 拒绝原因
|
|
* @property int status 状态
|
|
* @property string audit_at 审核时间
|
|
* @property string updated_at 最后一次修改时间
|
|
* @property string deleted_at 删除时间
|
|
*
|
|
* @property Player player 玩家信息
|
|
* @property Machine machine 机台信息
|
|
* @property Lottery lottery 彩金信息
|
|
* @property Channel channel 渠道信息
|
|
* @package addons\webman\model
|
|
*/
|
|
class PlayerLotteryRecord extends Model
|
|
{
|
|
use HasDateTimeFormatter, DataPermissions;
|
|
|
|
//数据权限字段
|
|
protected $dataAuth = ['department_id' => 'department_id'];
|
|
|
|
const STATUS_UNREVIEWED = 0; // 未审核
|
|
const STATUS_REJECT = 1; // 未通过
|
|
const STATUS_PASS = 2; // 通过
|
|
const STATUS_COMPLETE = 3; // 已完成
|
|
|
|
public function __construct(array $attributes = [])
|
|
{
|
|
parent::__construct($attributes);
|
|
$this->setTable(plugin()->webman->config('database.player_lottery_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')->withTrashed();
|
|
}
|
|
|
|
/**
|
|
* 机台信息
|
|
* @return BelongsTo
|
|
*/
|
|
public function machine(): BelongsTo
|
|
{
|
|
return $this->belongsTo(plugin()->webman->config('database.machine_model'), 'machine_id')->withTrashed();
|
|
}
|
|
|
|
/**
|
|
* 彩金信息
|
|
* @return BelongsTo
|
|
*/
|
|
public function lottery(): BelongsTo
|
|
{
|
|
return $this->belongsTo(plugin()->webman->config('database.lottery_model'), 'lottery_id')->withTrashed();
|
|
}
|
|
|
|
/**
|
|
* 派彩金额
|
|
*
|
|
* @param $value
|
|
* @return float
|
|
*/
|
|
public function getAmountAttribute($value): float
|
|
{
|
|
return floatval($value);
|
|
}
|
|
|
|
/**
|
|
* 金额比例
|
|
*
|
|
* @param $value
|
|
* @return float
|
|
*/
|
|
public function getLotteryRateAttribute($value): float
|
|
{
|
|
return floatval($value);
|
|
}
|
|
|
|
/**
|
|
* 派彩系数
|
|
*
|
|
* @param $value
|
|
* @return float
|
|
*/
|
|
public function getCateRateAttribute($value): float
|
|
{
|
|
return floatval($value);
|
|
}
|
|
|
|
/**
|
|
* 派彩系数
|
|
*
|
|
* @param $value
|
|
* @return float
|
|
*/
|
|
public function getLotteryPoolAmountAttribute($value): float
|
|
{
|
|
return floatval($value);
|
|
}
|
|
} |