32 lines
663 B
PHP
32 lines
663 B
PHP
<?php
|
|
|
|
namespace app\admin\model;
|
|
use think\model;
|
|
use think\model\relation\BelongsTo;
|
|
|
|
/**
|
|
* PromoReward 模型
|
|
*/
|
|
class PromoReward extends model
|
|
{
|
|
protected $autoWriteTimestamp = true;
|
|
protected $updateTime = false;
|
|
|
|
public static function onBeforeDelete(): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function getGameTypeTextAttr($value, $data)
|
|
{
|
|
$gameType = $data['game_type'] ?? 0;
|
|
return UserScoreLog::GAME_TYPE_LIST[$gameType] ?? 'Unknown Game';
|
|
}
|
|
protected $append = ['game_type_text'];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
} |