优化抽奖方式,以及记录相关信息

This commit is contained in:
2026-03-26 18:10:41 +08:00
parent 77ec0dcade
commit e32f3890f1
32 changed files with 304 additions and 244 deletions

View File

@@ -76,28 +76,28 @@ class GameController extends BaseController
* header: token由 TokenMiddleware 注入 request->player_id
* body: count = 1 | 5 | 101次/100coin, 5次/500coin, 10次/1000coin
*/
public function buyLotteryTickets(Request $request): Response
{
$userId = (int) ($request->player_id ?? 0);
$count = (int) $request->post('count', 0);
if (!in_array($count, [1, 5, 10], true)) {
return $this->fail('Invalid lottery ticket purchase', ReturnCode::PARAMS_ERROR);
}
try {
$logic = new GameLogic();
$data = $logic->buyLotteryTickets($userId, $count);
return $this->success($data);
} catch (ApiException $e) {
$msg = $e->getMessage();
if ($msg === '平台币不足') {
$player = DicePlayer::find($userId);
$coin = $player ? (float) $player->coin : 0;
return $this->success(['coin' => $coin], $msg);
}
return $this->fail($msg, ReturnCode::BUSINESS_ERROR);
}
}
// public function buyLotteryTickets(Request $request): Response
// {
// $userId = (int) ($request->player_id ?? 0);
// $count = (int) $request->post('count', 0);
// if (!in_array($count, [1, 5, 10], true)) {
// return $this->fail('Invalid lottery ticket purchase', ReturnCode::PARAMS_ERROR);
// }
//
// try {
// $logic = new GameLogic();
// $data = $logic->buyLotteryTickets($userId, $count);
// return $this->success($data);
// } catch (ApiException $e) {
// $msg = $e->getMessage();
// if ($msg === '平台币不足') {
// $player = DicePlayer::find($userId);
// $coin = $player ? (float) $player->coin : 0;
// return $this->success(['coin' => $coin], $msg);
// }
// return $this->fail($msg, ReturnCode::BUSINESS_ERROR);
// }
// }
/**
* 获取彩金池(中奖配置表)
@@ -194,10 +194,11 @@ class GameController extends BaseController
$langLower = strtolower($lang);
$isEn = $langLower === 'en' || str_starts_with($langLower, 'en-');
if (is_array($data) && array_key_exists('reward_config_id', $data)) {
$rewardConfigId = (int) $data['reward_config_id'];
if ($rewardConfigId > 0) {
$configRow = DiceRewardConfig::getCachedById($rewardConfigId);
if (is_array($data)) {
$rewardTier = array_key_exists('reward_tier', $data) ? (string) ($data['reward_tier'] ?? '') : '';
$targetIndex = array_key_exists('target_index', $data) ? (int) ($data['target_index'] ?? 0) : 0;
if ($rewardTier !== 'BIGWIN' && $targetIndex > 0) {
$configRow = DiceRewardConfig::getCachedById($targetIndex);
if ($configRow !== null) {
$uiText = '';
$uiTextEn = '';
@@ -247,9 +248,8 @@ class GameController extends BaseController
'win_coin' => 0,
'super_win_coin' => 0,
'reward_win_coin' => 0,
'use_coins' => 0,
'direction' => $direction,
'reward_config_id' => 0,
'reward_tier' => '',
'start_index' => 0,
'target_index' => 0,
'roll_array' => '[]',

View File

@@ -91,7 +91,7 @@ class UserController extends BaseController
if (empty($user)) {
return $this->fail('User not found', ReturnCode::NOT_FOUND);
}
$fields = ['id', 'username', 'phone', 'uid', 'name', 'coin', 'total_ticket_count'];
$fields = ['id', 'username', 'phone', 'uid', 'name', 'coin', 'total_ticket_count', 'free_ticket'];
$info = [];
foreach ($fields as $field) {
if (array_key_exists($field, $user)) {

View File

@@ -24,6 +24,8 @@ use support\think\Db;
*/
class PlayStartLogic
{
/** 钱包流水类型:购买抽奖次数 */
public const WALLET_TYPE_BUY_DRAW = 2;
/** 抽奖类型:付费 */
public const LOTTERY_TYPE_PAID = 0;
/** 抽奖类型:免费 */
@@ -74,12 +76,32 @@ class PlayStartLogic
throw new ApiException('当前注数不合规,请选择正确的注数');
}
// 免费抽奖:不再使用抽奖券作为开始条件,仅用 free_ticket_count 表示“免费抽奖次数”
$freeCount = (int) ($player->free_ticket_count ?? 0);
$isFree = $freeCount > 0;
// 免费抽奖:优先使用 free_ticket带 ante 与 count兼容旧字段 free_ticket_count
$freeTicket = $player->free_ticket ?? null;
$freeTicketAnte = null;
$freeTicketCount = 0;
if (is_array($freeTicket)) {
$a = $freeTicket['ante'] ?? null;
$c = $freeTicket['count'] ?? null;
if ($a !== null && $a !== '' && is_numeric($a)) {
$freeTicketAnte = (int) $a;
}
if ($c !== null && $c !== '' && is_numeric($c)) {
$freeTicketCount = (int) $c;
}
}
$legacyFreeCount = (int) ($player->free_ticket_count ?? 0);
$isFree = ($freeTicketAnte !== null && $freeTicketCount > 0) || $legacyFreeCount > 0;
$ticketType = $isFree ? self::LOTTERY_TYPE_FREE : self::LOTTERY_TYPE_PAID;
// 若为免费抽奖:注数必须与上一次触发免费抽奖时的注数一致
// 若为 free_ticket 免费抽奖:注数必须与券的 ante 一致
if ($ticketType === self::LOTTERY_TYPE_FREE && $freeTicketAnte !== null && $freeTicketCount > 0) {
if ($ante !== $freeTicketAnte) {
throw new ApiException('您有一张底注为' . $freeTicketAnte . '的免费抽奖券');
}
}
// 若为免费抽奖(旧逻辑):注数必须与上一次触发免费抽奖时的注数一致
if ($isFree) {
$requiredAnte = Cache::get(self::FREE_ANTE_KEY_PREFIX . $playerId);
if ($requiredAnte !== null && $requiredAnte !== '' && (int) $requiredAnte !== $ante) {
@@ -231,7 +253,6 @@ class PlayStartLogic
$adminId,
$configId,
$type0ConfigId,
$rewardId,
$configName,
$ticketType,
$ante,
@@ -247,8 +268,10 @@ class PlayStartLogic
$targetIndex,
$rollArray,
$isTierT5,
$tier,
&$record
) {
$rewardTier = ($isWin === 1 && $superWinCoin > 0) ? 'BIGWIN' : (string) ($tier ?? '');
$record = DicePlayRecord::create([
'player_id' => $playerId,
'admin_id' => $adminId,
@@ -260,14 +283,12 @@ class PlayStartLogic
'win_coin' => $winCoin,
'super_win_coin' => $superWinCoin,
'reward_win_coin' => $rewardWinCoin,
'use_coins' => $paidAmount,
'direction' => $direction,
'reward_config_id' => $rewardId,
'reward_tier' => $rewardTier,
'start_index' => $startIndex,
'target_index' => $targetIndex,
'roll_array' => is_array($rollArray) ? json_encode($rollArray) : $rollArray,
'roll_number' => is_array($rollArray) ? array_sum($rollArray) : 0,
'lottery_name' => $configName,
'status' => self::RECORD_STATUS_SUCCESS,
]);
@@ -279,9 +300,31 @@ class PlayStartLogic
// 开始前先扣付费金额,再加中奖金额(免费抽奖 paid_amount=0
$coinAfter = $coinBefore - $paidAmount + $winCoin;
$p->coin = $coinAfter;
// 不再使用抽奖券作为抽奖条件:付费不扣抽奖次数;免费抽奖消耗 free_ticket_count
// 免费抽奖消耗:优先消耗 free_ticket.count耗尽则清空 free_ticket否则兼容旧 free_ticket_count
if ($ticketType === self::LOTTERY_TYPE_FREE) {
$p->free_ticket_count = max(0, (int) $p->free_ticket_count - 1);
$ft = $p->free_ticket ?? null;
$ftAnte = null;
$ftCount = 0;
if (is_array($ft)) {
$a = $ft['ante'] ?? null;
$c = $ft['count'] ?? null;
if ($a !== null && $a !== '' && is_numeric($a)) {
$ftAnte = (int) $a;
}
if ($c !== null && $c !== '' && is_numeric($c)) {
$ftCount = (int) $c;
}
}
if ($ftAnte !== null && $ftCount > 0) {
$next = $ftCount - 1;
if ($next <= 0) {
$p->free_ticket = null;
} else {
$p->free_ticket = ['ante' => $ftAnte, 'count' => $next];
}
} else {
$p->free_ticket_count = max(0, (int) $p->free_ticket_count - 1);
}
}
// 记录每次游玩:写入抽奖券记录(用于后台“抽奖券记录”追踪付费/免费游玩与消耗)
@@ -299,9 +342,32 @@ class PlayStartLogic
'remark' => ($isPaidPlay ? '付费游玩' : '免费游玩') . '|play_record_id=' . $record->id,
]);
// 若本局中奖档位为 T5则额外赠送 1 次免费抽奖次数(总次数也 +1并记录抽奖券获取记录
// 若本局中奖档位为 T5则额外赠送 1 次免费抽奖次数
// - 新结构:写入 free_ticketante=本局注数count+1
// - 兼容旧结构free_ticket_count +1
if ($isTierT5) {
$p->free_ticket_count = (int) $p->free_ticket_count + 1;
$ft = $p->free_ticket ?? null;
$ftAnte = null;
$ftCount = 0;
if (is_array($ft)) {
$a = $ft['ante'] ?? null;
$c = $ft['count'] ?? null;
if ($a !== null && $a !== '' && is_numeric($a)) {
$ftAnte = (int) $a;
}
if ($c !== null && $c !== '' && is_numeric($c)) {
$ftCount = (int) $c;
}
}
if ($ftAnte === null) {
$ftAnte = $ante;
}
if ($ftAnte === $ante) {
$p->free_ticket = ['ante' => $ante, 'count' => $ftCount + 1];
} else {
// 若已有不同注数的免费券,则仍保留旧字段累加,避免覆盖玩家已有券
$p->free_ticket_count = (int) $p->free_ticket_count + 1;
}
DicePlayerTicketRecord::create([
'player_id' => $playerId,
@@ -314,7 +380,15 @@ class PlayStartLogic
Cache::set(self::FREE_ANTE_KEY_PREFIX . $playerId, $ante, self::FREE_ANTE_TTL);
} else {
// 若本次消耗了最后一次免费抽奖,则清理注数锁
if ($ticketType === self::LOTTERY_TYPE_FREE && (int) $p->free_ticket_count <= 0) {
$ft = $p->free_ticket ?? null;
$ftCount = 0;
if (is_array($ft)) {
$c = $ft['count'] ?? null;
if ($c !== null && $c !== '' && is_numeric($c)) {
$ftCount = (int) $c;
}
}
if ($ticketType === self::LOTTERY_TYPE_FREE && $ftCount <= 0 && (int) $p->free_ticket_count <= 0) {
Cache::delete(self::FREE_ANTE_KEY_PREFIX . $playerId);
}
}
@@ -338,15 +412,30 @@ class PlayStartLogic
]);
}
// 钱包流水拆分:先记录购券扣费,再记录抽奖结果(中奖/惩罚)
if ($paidAmount > 0) {
$walletAfterBuy = $coinBefore - $paidAmount;
DicePlayerWalletRecord::create([
'player_id' => $playerId,
'admin_id' => $adminId,
'coin' => -$paidAmount,
'type' => self::WALLET_TYPE_BUY_DRAW,
'wallet_before' => $coinBefore,
'wallet_after' => $walletAfterBuy,
'remark' => '抽奖购券扣费|play_record_id=' . $record->id,
]);
}
$walletBeforeDraw = $coinBefore - $paidAmount;
$drawRemark = ($winCoin >= 0 ? '抽奖中奖' : '抽奖惩罚') . '|play_record_id=' . $record->id;
DicePlayerWalletRecord::create([
'player_id' => $playerId,
'admin_id' => $adminId,
// 钱包流水记录本局净变化:-付费金额 + 中奖金额(免费抽奖付费金额为 0
'coin' => $winCoin - (float) $paidAmount,
'coin' => $winCoin,
'type' => self::WALLET_TYPE_DRAW,
'wallet_before' => $coinBefore,
'wallet_before' => $walletBeforeDraw,
'wallet_after' => $coinAfter,
'remark' => '抽奖|play_record_id=' . $record->id,
'remark' => $drawRemark,
]);
});
} catch (\Throwable $e) {
@@ -361,9 +450,8 @@ class PlayStartLogic
'win_coin' => 0,
'super_win_coin' => 0,
'reward_win_coin' => 0,
'use_coins' => 0,
'direction' => $direction,
'reward_config_id' => 0,
'reward_tier' => '',
'start_index' => $startIndex,
'target_index' => 0,
'roll_array' => '[]',
@@ -390,7 +478,7 @@ class PlayStartLogic
$arr['roll_array'] = json_decode($arr['roll_array'], true) ?? [];
}
$arr['roll_number'] = is_array($arr['roll_array'] ?? null) ? array_sum($arr['roll_array']) : 0;
$arr['tier'] = $tier ?? '';
$arr['reward_tier'] = ($isWin === 1 && $superWinCoin > 0) ? 'BIGWIN' : (string) ($tier ?? '');
// 记录完数据后返回当前玩家余额与抽奖次数
$arr['coin'] = $updated ? (float) $updated->coin : 0;
return $arr;
@@ -619,10 +707,10 @@ class PlayStartLogic
$winCoin = $superWinCoin + $rewardWinCoin;
$configId = $config !== null ? (int) $config->id : 0;
$rewardId = ($isWin === 1 && $superWinCoin > 0) ? 0 : $targetIndex;
$configName = $config !== null ? (string) ($config->name ?? '') : '自定义';
$costRealEv = $realEv + ($isWin === 1 ? $bigWinRealEv : 0.0);
$paidAmount = $lotteryType === 0 ? ($ante * self::UNIT_COST) : 0;
$rewardTier = ($isWin === 1 && $superWinCoin > 0) ? 'BIGWIN' : (string) ($tier ?? '');
return [
'player_id' => 0,
@@ -635,14 +723,12 @@ class PlayStartLogic
'paid_amount' => $paidAmount,
'super_win_coin' => $superWinCoin,
'reward_win_coin' => $rewardWinCoin,
'use_coins' => $paidAmount,
'direction' => $direction,
'reward_config_id' => $rewardId,
'reward_tier' => $rewardTier,
'start_index' => $startIndex,
'target_index' => $targetIndex,
'roll_array' => json_encode($rollArray),
'roll_number' => array_sum($rollArray),
'lottery_name' => $configName,
'status' => self::RECORD_STATUS_SUCCESS,
'tier' => $tier,
'roll_number_for_count' => $rollNumber,

View File

@@ -12,7 +12,6 @@ use app\dice\logic\play_record\DicePlayRecordLogic;
use app\dice\validate\play_record\DicePlayRecordValidate;
use app\dice\model\player\DicePlayer;
use app\dice\model\lottery_pool_config\DiceLotteryPoolConfig;
use app\dice\model\reward\DiceRewardConfig;
use plugin\saiadmin\service\Permission;
use support\Request;
use support\Response;
@@ -57,7 +56,6 @@ class DicePlayRecordController extends BaseController
AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null);
$query->with([
'dicePlayer',
'diceRewardConfig',
'diceLotteryPoolConfig',
]);
@@ -101,23 +99,6 @@ class DicePlayRecordController extends BaseController
return $this->success($data);
}
/**
* 获取奖励配置选项id、ui_text、tier
*/
#[Permission('玩家抽奖记录列表', 'dice:play_record:index:index')]
public function getRewardConfigOptions(Request $request): Response
{
$list = DiceRewardConfig::field('id,ui_text,tier')->select();
$data = $list->map(function ($item) {
return [
'id' => $item['id'],
'ui_text' => $item['ui_text'] ?? '',
'tier' => $item['tier'] ?? ''
];
})->toArray();
return $this->success($data);
}
/**
* 读取数据
* @param Request $request

View File

@@ -50,7 +50,7 @@ class DicePlayRecordTestController extends BaseController
['roll_number', ''],
]);
$query = $this->logic->search($where);
$query->with(['diceLotteryPoolConfig', 'diceRewardConfig']);
$query->with(['diceLotteryPoolConfig']);
// 按当前筛选条件统计:平台总盈利 = 付费金额(paid_amount 求和) - 玩家总收益(win_coin 求和)
$sumQuery = clone $query;

View File

@@ -19,6 +19,26 @@ use support\think\Db;
class WeightTestRunner
{
private const BATCH_SIZE = 10;
/** 测试记录写库白名单字段 */
private const PLAY_RECORD_TEST_COLUMNS = [
'reward_config_record_id',
'admin_id',
'lottery_config_id',
'lottery_type',
'is_win',
'win_coin',
'super_win_coin',
'reward_win_coin',
'direction',
'reward_tier',
'ante',
'paid_amount',
'start_index',
'target_index',
'roll_array',
'roll_number',
'status',
];
/**
* 执行指定测试记录:按付费/免费、顺/逆方向交替模拟(付费顺→付费逆→免费顺→免费逆),每 10 条写入一次测试表并更新进度
@@ -194,10 +214,10 @@ class WeightTestRunner
'reward_config_record_id' => $rewardConfigRecordId,
];
$keys = [
'player_id', 'admin_id', 'lottery_config_id', 'lottery_type', 'is_win', 'win_coin',
'super_win_coin', 'reward_win_coin', 'use_coins', 'direction', 'reward_config_id',
'admin_id', 'lottery_config_id', 'lottery_type', 'is_win', 'win_coin',
'super_win_coin', 'reward_win_coin', 'direction', 'reward_tier',
'ante', 'paid_amount',
'start_index', 'target_index', 'roll_array', 'roll_number', 'lottery_name', 'status',
'start_index', 'target_index', 'roll_array', 'roll_number', 'status',
];
foreach ($keys as $k) {
if (array_key_exists($k, $row)) {
@@ -223,7 +243,19 @@ class WeightTestRunner
return;
}
foreach ($rows as $row) {
DicePlayRecordTest::create($row);
if (!is_array($row)) {
continue;
}
$payload = [];
foreach (self::PLAY_RECORD_TEST_COLUMNS as $column) {
if (array_key_exists($column, $row)) {
$payload[$column] = $row[$column];
}
}
if ($payload === []) {
continue;
}
Db::name((new DicePlayRecordTest())->getTable())->insert($payload);
}
}

View File

@@ -30,7 +30,7 @@ use think\model\relation\BelongsTo;
* @property $reward_win_coin 摇色子中奖平台币
* @property $use_coins 消耗平台币(兼容字段:付费局=paid_amount免费局=0
* @property $direction 方向:0=顺时针,1=逆时针
* @property $reward_config_id 奖励配置id
* @property $reward_tier 中奖档位T1,T2,T3,T4,T5,BIGWIN
* @property $lottery_id 奖池
* @property $start_index 起始索引
* @property $target_index 结束索引
@@ -64,15 +64,6 @@ class DicePlayRecord extends BaseModel
return $this->belongsTo(DicePlayer::class, 'player_id', 'id');
}
/**
* 中奖配置
* 关联模型 diceRewardConfig
*/
public function diceRewardConfig(): BelongsTo
{
return $this->belongsTo(DiceRewardConfig::class, 'reward_config_id', 'id');
}
/**
* 彩金池配置
* 关联模型 diceLotteryPoolConfig
@@ -252,24 +243,19 @@ class DicePlayRecord extends BaseModel
}
$ids = DiceRewardConfig::where('ui_text', 'like', '%' . $value . '%')->column('id');
if (!empty($ids)) {
$query->whereIn('reward_config_id', $ids);
$query->whereIn('target_index', $ids);
} else {
$query->whereRaw('1=0');
}
}
/** 按奖励档位(diceRewardConfig.tier中奖名 T1-T5 */
/** 按奖励档位(表字段 reward_tier中奖名 T1-T5/BIGWIN */
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');
}
$query->where('reward_tier', '=', $value);
}
/** 方向 0=顺时针 1=逆时针 */

View File

@@ -7,7 +7,6 @@
namespace app\dice\model\play_record_test;
use plugin\saiadmin\basic\think\BaseModel;
use app\dice\model\reward_config\DiceRewardConfig;
use app\dice\model\reward_config_record\DiceRewardConfigRecord;
use app\dice\model\lottery_pool_config\DiceLotteryPoolConfig;
use think\model\relation\BelongsTo;
@@ -25,7 +24,7 @@ use think\model\relation\BelongsTo;
* @property int|null $ante 底注/注数dice_ante_config.mult
* @property int|null $paid_amount 付费金额(付费局=ante*100免费局=0
* @property $direction 方向:0=顺时针,1=逆时针
* @property $reward_config_id 奖励配置id
* @property $reward_tier 中奖档位T1,T2,T3,T4,T5,BIGWIN
* @property $create_time 创建时间
* @property $update_time 修改时间
* @property $start_index 起始索引
@@ -61,15 +60,6 @@ class DicePlayRecordTest extends BaseModel
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');
}
/**
* 关联的权重测试记录
* reward_config_record_id -> DiceRewardConfigRecord.id
@@ -135,18 +125,13 @@ class DicePlayRecordTest extends BaseModel
}
}
/** 中奖档位(按 reward_config_id 对应 DiceRewardConfig.tier */
/** 中奖档位(按表字段 reward_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');
}
$query->where('reward_tier', '=', $value);
}
/** 点数和 roll_number摇取点数和 5-30 */

View File

@@ -32,6 +32,7 @@ use app\dice\model\lottery_pool_config\DiceLotteryPoolConfig;
* @property $total_ticket_count 总抽奖次数
* @property $paid_ticket_count 购买抽奖次数
* @property $free_ticket_count 赠送抽奖次数
* @property array|null $free_ticket 免费抽奖券:{"ante":1,"count":1}
* @property $create_time 创建时间
* @property $update_time 更新时间
* @property $delete_time 删除时间
@@ -54,6 +55,10 @@ class DicePlayer extends BaseModel
protected $updateTime = 'update_time';
protected $json = ['free_ticket'];
protected $jsonAssoc = true;
/**
* 新增前:生成唯一 uid昵称 name 默认使用 uid
* 用 try-catch 避免表尚未含 uid 时 getAttr/getData 抛 InvalidArgumentException

View File

@@ -22,7 +22,7 @@ class DicePlayRecordValidate extends BaseValidate
'lottery_type' => 'require',
'is_win' => 'require',
'win_coin' => 'require',
'reward_config_id' => 'require',
'reward_tier' => 'require',
'roll_array' => 'require|checkRollArray',
];
@@ -35,7 +35,7 @@ class DicePlayRecordValidate extends BaseValidate
'lottery_type' => '抽奖类型必须填写',
'is_win' => '中奖必须填写',
'win_coin' => '赢取平台币必须填写',
'reward_config_id' => '奖励配置必须填写',
'reward_tier' => '中奖档位必须填写',
'roll_array.require' => '摇取点数必须填写',
];
@@ -49,7 +49,7 @@ class DicePlayRecordValidate extends BaseValidate
'lottery_type',
'is_win',
'win_coin',
'reward_config_id',
'reward_tier',
'roll_array',
],
'update' => [
@@ -58,7 +58,7 @@ class DicePlayRecordValidate extends BaseValidate
'lottery_type',
'is_win',
'win_coin',
'reward_config_id',
'reward_tier',
'roll_array',
],
];

View File

@@ -21,7 +21,7 @@ class DicePlayRecordTestValidate extends BaseValidate
'lottery_type' => 'require',
'is_win' => 'require',
'direction' => 'require',
'reward_config_id' => 'require',
'reward_tier' => 'require',
'status' => 'require',
];
@@ -33,7 +33,7 @@ class DicePlayRecordTestValidate extends BaseValidate
'lottery_type' => '抽奖类型:0=付费,1=免费必须填写',
'is_win' => '中大奖:0=无,1=中奖必须填写',
'direction' => '方向:0=顺时针,1=逆时针必须填写',
'reward_config_id' => '奖励配置id必须填写',
'reward_tier' => '中奖档位必须填写',
'status' => '状态:0=失败,1=成功必须填写',
];
@@ -46,7 +46,7 @@ class DicePlayRecordTestValidate extends BaseValidate
'lottery_type',
'is_win',
'direction',
'reward_config_id',
'reward_tier',
'status',
],
'update' => [
@@ -54,7 +54,7 @@ class DicePlayRecordTestValidate extends BaseValidate
'lottery_type',
'is_win',
'direction',
'reward_config_id',
'reward_tier',
'status',
],
];

View File

@@ -46,7 +46,7 @@ Route::group('/api', function () {
Route::any('/user/walletRecord', [app\api\controller\UserController::class, 'walletRecord']);
Route::any('/user/playGameRecord', [app\api\controller\UserController::class, 'playGameRecord']);
Route::any('/game/config', [app\api\controller\GameController::class, 'config']);
Route::any('/game/buyLotteryTickets', [app\api\controller\GameController::class, 'buyLotteryTickets']);
// Route::any('/game/buyLotteryTickets', [app\api\controller\GameController::class, 'buyLotteryTickets']);
Route::any('/game/lotteryPool', [app\api\controller\GameController::class, 'lotteryPool']);
Route::any('/game/anteConfig', [app\api\controller\GameController::class, 'anteConfig']);
Route::any('/game/playStart', [app\api\controller\GameController::class, 'playStart']);

View File

@@ -97,7 +97,6 @@ Route::group('/core', function () {
fastRoute('dice/play_record/DicePlayRecord', \app\dice\controller\play_record\DicePlayRecordController::class);
Route::get('/dice/play_record/DicePlayRecord/getPlayerOptions', [\app\dice\controller\play_record\DicePlayRecordController::class, 'getPlayerOptions']);
Route::get('/dice/play_record/DicePlayRecord/getLotteryConfigOptions', [\app\dice\controller\play_record\DicePlayRecordController::class, 'getLotteryConfigOptions']);
Route::get('/dice/play_record/DicePlayRecord/getRewardConfigOptions', [\app\dice\controller\play_record\DicePlayRecordController::class, 'getRewardConfigOptions']);
fastRoute('dice/player_wallet_record/DicePlayerWalletRecord', \app\dice\controller\player_wallet_record\DicePlayerWalletRecordController::class);
Route::get('/dice/player_wallet_record/DicePlayerWalletRecord/getPlayerOptions', [\app\dice\controller\player_wallet_record\DicePlayerWalletRecordController::class, 'getPlayerOptions']);
Route::get('/dice/player_wallet_record/DicePlayerWalletRecord/getPlayerWalletBefore', [\app\dice\controller\player_wallet_record\DicePlayerWalletRecordController::class, 'getPlayerWalletBefore']);