'department_id']; const STATUS_WAIT = 1; // 提现中(待审核) const STATUS_SUCCESS = 2; // 成功 const STATUS_FAIL = 3; // 提现失败 const STATUS_PENDING_PAYMENT = 4; // 待打款(审核通过) const STATUS_PENDING_REJECT = 5; // 审核拒绝 const STATUS_CANCEL = 6; // 玩家取消 const STATUS_SYSTEM_CANCEL = 7; // 系统取消 const TYPE_USDT = 1; // usdt const TYPE_SELF = 2; // 渠道提现 const TYPE_ARTIFICIAL = 3; // 人工提现 const TYPE_ESPAYOUT = 4; // ES代付 const TYPE_ONEPAYOUT = 5; // ONE代付 const TYPE_SKLPAYOUT = 6; // SKL代付 public function __construct(array $attributes = []) { parent::__construct($attributes); $this->setTable(plugin()->webman->config('database.player_withdraw_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'); } /** * 获取器 - 标签id * @param $value * @return false|string[] */ public function getPlayerTagAttribute($value) { return array_filter(explode(',', $value)); } /** * 修改器 - 标签id * @param $value * @return string */ public function setPlayerTagAttribute($value): string { return $this->attributes['player_tag'] = implode(',', $value); } /** * 实际金额 * * @param $value * @return float */ public function getInmoneyAttribute($value): float { return floatval($value); } /** * 金额 * * @param $value * @return float */ public function getMoneyAttribute($value): float { return floatval($value); } /** * 游戏点数 * * @param $value * @return float */ public function getCoinsAttribute($value): float { return floatval($value); } /** * 手续费 * * @param $value * @return float */ public function getFeeAttribute($value): float { return floatval($value); } /** * 模型的 "booted" 方法 * * @return void */ protected static function booted() { if (config('app.profit', 'task') == 'event') { static::updated(function (PlayerWithdrawRecord $playerWithdrawRecord) { $oldStatus = $playerWithdrawRecord->getOriginal('status'); // 原始值 $newStatus = $playerWithdrawRecord->status; // 游戏结束并且产生盈亏后计算分润 if ($oldStatus != $newStatus && $newStatus == PlayerWithdrawRecord::STATUS_SUCCESS) { Event::emit('promotion.playerWithdraw', $playerWithdrawRecord); } }); } } }