[色子游戏]玩家抽奖记录测试数据
This commit is contained in:
122
server/app/dice/model/play_record_test/DicePlayRecordTest.php
Normal file
122
server/app/dice/model/play_record_test/DicePlayRecordTest.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | saiadmin [ saiadmin快速开发框架 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: your name
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\dice\model\play_record_test;
|
||||
|
||||
use plugin\saiadmin\basic\think\BaseModel;
|
||||
use app\dice\model\reward_config\DiceRewardConfig;
|
||||
use app\dice\model\lottery_pool_config\DiceLotteryPoolConfig;
|
||||
use think\model\relation\BelongsTo;
|
||||
|
||||
/**
|
||||
* 玩家抽奖记录(测试数据)模型
|
||||
*
|
||||
* dice_play_record_test 玩家抽奖记录(测试数据)
|
||||
*
|
||||
* @property $id ID
|
||||
* @property $lottery_config_id 彩金池配置id
|
||||
* @property $lottery_type 抽奖类型:0=付费,1=赠送
|
||||
* @property $is_win 中大奖:0=无,1=中奖
|
||||
* @property $win_coin 赢取平台币
|
||||
* @property $direction 方向:0=顺时针,1=逆时针
|
||||
* @property $reward_config_id 奖励配置id
|
||||
* @property $create_time 创建时间
|
||||
* @property $update_time 修改时间
|
||||
* @property $start_index 起始索引
|
||||
* @property $target_index 结束索引
|
||||
* @property $roll_number 摇取点数和
|
||||
* @property $roll_array 摇取点数:[1,2,3,4,5,6]
|
||||
* @property $status 状态:0=失败,1=成功
|
||||
* @property $super_win_coin 中大奖平台币
|
||||
* @property $reward_win_coin 摇色子中奖平台币
|
||||
* @property $admin_id 所属管理员
|
||||
*/
|
||||
class DicePlayRecordTest extends BaseModel
|
||||
{
|
||||
/**
|
||||
* 数据表主键
|
||||
* @var string
|
||||
*/
|
||||
protected $pk = 'id';
|
||||
|
||||
/**
|
||||
* 数据库表名称
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'dice_play_record_test';
|
||||
|
||||
/**
|
||||
* 彩金池配置
|
||||
* 关联 lottery_config_id -> DiceLotteryPoolConfig.id
|
||||
*/
|
||||
public function diceLotteryPoolConfig(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(DiceLotteryPoolConfig::class, 'lottery_config_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖励配置(终点格 = target_index 对应 DiceRewardConfig.id,表中为 reward_config_id)
|
||||
* 关联 reward_config_id -> DiceRewardConfig.id
|
||||
*/
|
||||
public function diceRewardConfig(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(DiceRewardConfig::class, 'reward_config_id', 'id');
|
||||
}
|
||||
|
||||
/** 抽奖类型 0=付费 1=赠送 */
|
||||
public function searchLotteryTypeAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('lottery_type', '=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** 方向 0=顺时针 1=逆时针 */
|
||||
public function searchDirectionAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('direction', '=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** 是否中大奖 0=无 1=中大奖 */
|
||||
public function searchIsWinAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('is_win', '=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** 赢取平台币下限 */
|
||||
public function searchWinCoinMinAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('win_coin', '>=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** 赢取平台币上限 */
|
||||
public function searchWinCoinMaxAttr($query, $value)
|
||||
{
|
||||
if ($value !== '' && $value !== null) {
|
||||
$query->where('win_coin', '<=', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** 中奖档位(按 reward_config_id 对应 DiceRewardConfig.tier) */
|
||||
public function searchRewardTierAttr($query, $value)
|
||||
{
|
||||
if ($value === '' || $value === null) {
|
||||
return;
|
||||
}
|
||||
$ids = DiceRewardConfig::where('tier', '=', $value)->column('id');
|
||||
if (!empty($ids)) {
|
||||
$query->whereIn('reward_config_id', $ids);
|
||||
} else {
|
||||
$query->whereRaw('1=0');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,17 +18,31 @@ use plugin\saiadmin\basic\think\BaseModel;
|
||||
* @property array $weight_config_snapshot 测试时权重配比快照:按档位 id,grid_number,tier,weight
|
||||
* @property array $tier_weights_snapshot 测试时 T1-T5 档位权重快照(来自奖池配置)
|
||||
* @property int|null $lottery_config_id 测试时使用的奖池配置 ID
|
||||
* @property int $total_play_count 总模拟次数(s_count+n_count)
|
||||
* @property int $over_play_count 已完成次数
|
||||
* @property int $status 状态 -1失败 0进行中 1成功
|
||||
* @property string|null $remark 失败时记录原因
|
||||
* @property int $s_count 顺时针模拟次数
|
||||
* @property int $n_count 逆时针模拟次数
|
||||
* @property array $result_counts 落点统计 grid_number=>出现次数
|
||||
* @property array|null $tier_counts 档位出现次数 T1=>count
|
||||
* @property int|null $admin_id 执行测试的管理员ID
|
||||
* @property string|null $create_time 创建时间
|
||||
*/
|
||||
class DiceRewardConfigRecord extends BaseModel
|
||||
{
|
||||
/** 状态:失败 */
|
||||
public const STATUS_FAIL = -1;
|
||||
/** 状态:进行中 */
|
||||
public const STATUS_RUNNING = 0;
|
||||
/** 状态:成功 */
|
||||
public const STATUS_SUCCESS = 1;
|
||||
|
||||
protected $pk = 'id';
|
||||
|
||||
protected $table = 'dice_reward_config_record';
|
||||
|
||||
protected $json = ['weight_config_snapshot', 'tier_weights_snapshot', 'result_counts'];
|
||||
protected $json = ['weight_config_snapshot', 'tier_weights_snapshot', 'result_counts', 'tier_counts'];
|
||||
|
||||
protected $jsonAssoc = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user