初始化
This commit is contained in:
62
addons/webman/model/Game.php
Normal file
62
addons/webman/model/Game.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Game
|
||||
* @property int id 主键
|
||||
* @property int platform_id 平台id
|
||||
* @property int game_code 游戏编号
|
||||
* @property float consume 抽奖消耗
|
||||
* @property int platform_game_type 平台游戏类型
|
||||
* @property int game_type 游戏类型
|
||||
* @property int prize_num 奖品数量
|
||||
* @property string name 游戏名
|
||||
* @property string player_num_range 玩家数量范围
|
||||
* @property int status 状态
|
||||
* @property int is_hot 是否热门
|
||||
* @property int is_online 是否上线
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string test_url 测试地址
|
||||
* @property string game_url 游戏地址
|
||||
*
|
||||
* @property GamePlatform gamePlatform 游戏平台信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Game extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
|
||||
protected $fillable = ['platform_id', 'game_code', 'platform_game_type', 'game_image', 'name', 'game_data', 'game_type', 'prize_num'];
|
||||
|
||||
const GAME_TYPE_EGG = 1; // 砸金蛋
|
||||
const GAME_TYPE_TURNTABLE = 2; // 转盘
|
||||
const GAME_TYPE_BLINDBOX = 3; // 盲盒
|
||||
const GAME_TYPE_TICKET = 4; // 刮刮乐
|
||||
const GAME_TYPE_LOTTERY = 5; // 抽奖
|
||||
const GAME_TYPE_DICE = 6; // 摇色子
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.game_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function gamePlatform(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.game_platform_model'), 'platform_id')->withTrashed();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user