diff --git a/saiadmin-artd/src/views/plugin/dice/api/player/index.ts b/saiadmin-artd/src/views/plugin/dice/api/player/index.ts index 1833540..30556c6 100644 --- a/saiadmin-artd/src/views/plugin/dice/api/player/index.ts +++ b/saiadmin-artd/src/views/plugin/dice/api/player/index.ts @@ -83,5 +83,29 @@ export default { }) const rows = (Array.isArray(res) ? res : (res?.data ?? [])) as Array<{ id: number; name: string }> return rows.map((r) => ({ id: Number(r.id), name: String(r.name ?? r.id ?? '') })) + }, + + /** + * 获取后台管理员选项(SystemUser),供 admin_id 下拉使用 + * @returns [ { id, username, realname, label } ] + */ + async getSystemUserOptions(): Promise< + Array<{ id: number; username: string; realname: string; label: string }> + > { + const res = await request.get({ + url: '/dice/player/DicePlayer/getSystemUserOptions' + }) + const rows = (Array.isArray(res) ? res : (res?.data ?? [])) as Array<{ + id: number + username: string + realname: string + label: string + }> + return rows.map((r) => ({ + id: Number(r.id), + username: String(r.username ?? ''), + realname: String(r.realname ?? ''), + label: String(r.label ?? r.username ?? r.id ?? '') + })) } } diff --git a/saiadmin-artd/src/views/plugin/dice/player/index/modules/edit-dialog.vue b/saiadmin-artd/src/views/plugin/dice/player/index/modules/edit-dialog.vue index 5b12ca8..b1c833e 100644 --- a/saiadmin-artd/src/views/plugin/dice/player/index/modules/edit-dialog.vue +++ b/saiadmin-artd/src/views/plugin/dice/player/index/modules/edit-dialog.vue @@ -34,6 +34,23 @@ + + + + + >([]) /** 彩金池选项加载中 */ const lotteryConfigLoading = ref(false) + /** 后台管理员下拉选项(SystemUser) */ + const systemUserOptions = ref< + Array<{ id: number; username: string; realname: string; label: string }> + >([]) + /** 管理员选项加载中 */ + const systemUserOptionsLoading = ref(false) /** 当前选中的 DiceLotteryConfig 完整数据(用于展示) */ const currentLotteryConfig = ref | null>(null) @@ -306,10 +331,22 @@ } } + /** 加载后台管理员选项 */ + async function loadSystemUserOptions() { + systemUserOptionsLoading.value = true + try { + systemUserOptions.value = await api.getSystemUserOptions() + } catch { + systemUserOptions.value = [] + } finally { + systemUserOptionsLoading.value = false + } + } + const initPage = async () => { currentLotteryConfig.value = null Object.assign(formData, initialFormData) - await loadLotteryConfigOptions() + await Promise.all([loadLotteryConfigOptions(), loadSystemUserOptions()]) if (props.data) { await nextTick() initForm() @@ -355,7 +392,7 @@ if (numKeys.includes(key)) { if (key === 'id') { ;(formData as any)[key] = val != null ? Number(val) || null : null - } else if (key === 'lottery_config_id') { + } else if (key === 'lottery_config_id' || key === 'admin_id') { const num = Number(val) ;(formData as any)[key] = val != null && !Number.isNaN(num) && num !== 0 ? num : null } else { diff --git a/server/app/api/controller/GameController.php b/server/app/api/controller/GameController.php index e87d759..60d4dfd 100644 --- a/server/app/api/controller/GameController.php +++ b/server/app/api/controller/GameController.php @@ -137,9 +137,16 @@ class GameController extends BaseController ]); $timeoutRecord = null; $timeout_message = ''; + $adminId = null; + try { + $timeoutPlayer = DicePlayer::find($userId); + $adminId = ($timeoutPlayer && ($timeoutPlayer->admin_id ?? null)) ? (int) $timeoutPlayer->admin_id : null; + } catch (\Throwable $_) { + } try { $timeoutRecord = DicePlayRecord::create([ 'player_id' => $userId, + 'admin_id' => $adminId, 'lottery_config_id' => 0, 'lottery_type' => 0, 'is_win' => 0, diff --git a/server/app/api/controller/v1/GameController.php b/server/app/api/controller/v1/GameController.php index e5259af..c4f9a27 100644 --- a/server/app/api/controller/v1/GameController.php +++ b/server/app/api/controller/v1/GameController.php @@ -6,6 +6,7 @@ namespace app\api\controller\v1; use app\api\logic\UserLogic; use app\api\util\ReturnCode; use app\dice\model\player\DicePlayer; +use plugin\saiadmin\app\model\system\SystemUser; use app\dice\model\play_record\DicePlayRecord; use app\dice\model\player_wallet_record\DicePlayerWalletRecord; use app\dice\model\player_ticket_record\DicePlayerTicketRecord; @@ -40,9 +41,18 @@ class GameController extends BaseController $time = (string) time(); } + $adminId = null; + $agentId = trim((string) ($request->agent_id ?? '')); + if ($agentId !== '') { + $systemUser = SystemUser::where('agent_id', $agentId)->find(); + if ($systemUser) { + $adminId = (int) $systemUser->id; + } + } + try { $logic = new UserLogic(); - $result = $logic->loginByUsername($username, $password, 'chs', 0.0, $time); + $result = $logic->loginByUsername($username, $password, 'chs', 0.0, $time, $adminId); } catch (\plugin\saiadmin\exception\ApiException $e) { return $this->fail($e->getMessage(), ReturnCode::PARAMS_ERROR); } @@ -264,8 +274,10 @@ class GameController extends BaseController $player->coin = $walletAfter; $player->save(); + $adminId = ($player->admin_id ?? null) ? (int) $player->admin_id : null; $record = DicePlayerWalletRecord::create([ 'player_id' => (int) $player->id, + 'admin_id' => $adminId, 'coin' => $coinVal, 'type' => $type, 'wallet_before' => $walletBefore, diff --git a/server/app/api/logic/GameLogic.php b/server/app/api/logic/GameLogic.php index 73423a0..4170538 100644 --- a/server/app/api/logic/GameLogic.php +++ b/server/app/api/logic/GameLogic.php @@ -69,10 +69,12 @@ class GameLogic UserCache::setUser($playerId, $updatedUserArr); + $adminId = ($player->admin_id ?? null) ? (int) $player->admin_id : null; try { Db::transaction(function () use ( $player, $playerId, + $adminId, $cost, $coinBefore, $coinAfter, @@ -91,6 +93,7 @@ class GameLogic DicePlayerWalletRecord::create([ 'player_id' => $playerId, + 'admin_id' => $adminId, 'coin' => -$cost, 'type' => self::WALLET_TYPE_BUY_DRAW, 'wallet_before' => $coinBefore, @@ -103,6 +106,7 @@ class GameLogic DicePlayerTicketRecord::create([ 'player_id' => $playerId, + 'admin_id' => $adminId, 'use_coins' => $cost, 'total_ticket_count' => $addTotal, 'paid_ticket_count' => $addPaid, diff --git a/server/app/api/logic/PlayStartLogic.php b/server/app/api/logic/PlayStartLogic.php index 2054a98..d2febe0 100644 --- a/server/app/api/logic/PlayStartLogic.php +++ b/server/app/api/logic/PlayStartLogic.php @@ -160,9 +160,11 @@ class PlayStartLogic $rewardId = $chosenId; $configName = (string) ($config->name ?? ''); $isTierT5 = (string) ($chosen['tier'] ?? '') === 'T5'; + $adminId = ($player->admin_id ?? null) ? (int) $player->admin_id : null; try { Db::transaction(function () use ( $playerId, + $adminId, $configId, $rewardId, $configName, @@ -181,6 +183,7 @@ class PlayStartLogic ) { $record = DicePlayRecord::create([ 'player_id' => $playerId, + 'admin_id' => $adminId, 'lottery_config_id' => $configId, 'lottery_type' => $ticketType, 'is_win' => $isWin, @@ -218,9 +221,10 @@ class PlayStartLogic $p->total_ticket_count = (int) $p->total_ticket_count + 1; DicePlayerTicketRecord::create([ - 'player_id' => $playerId, + 'player_id' => $playerId, + 'admin_id' => $adminId, 'free_ticket_count' => 1, - 'remark' => '中奖结果为T5', + 'remark' => '中奖结果为T5', ]); } @@ -236,6 +240,7 @@ class PlayStartLogic DicePlayerWalletRecord::create([ 'player_id' => $playerId, + 'admin_id' => $adminId, 'coin' => $winCoin, 'type' => self::WALLET_TYPE_DRAW, 'wallet_before' => $coinBefore, @@ -248,6 +253,7 @@ class PlayStartLogic try { $record = DicePlayRecord::create([ 'player_id' => $playerId, + 'admin_id' => $adminId ?? null, 'lottery_config_id' => $configId ?? 0, 'lottery_type' => $ticketType, 'is_win' => 0, diff --git a/server/app/api/logic/UserLogic.php b/server/app/api/logic/UserLogic.php index 46c4cc9..c37e9c2 100644 --- a/server/app/api/logic/UserLogic.php +++ b/server/app/api/logic/UserLogic.php @@ -45,8 +45,10 @@ class UserLogic * 登录(JSON:username, password, lang, coin, time) * 存在则校验密码并更新 coin(累加);不存在则创建用户并写入 coin。 * 将会话写入 Redis,返回 token 与前端连接地址。 + * + * @param int|null $adminId 创建新用户时关联的后台管理员ID(sa_system_user.id),可选 */ - public function loginByUsername(string $username, string $password, string $lang, float $coin, string $time): array + public function loginByUsername(string $username, string $password, string $lang, float $coin, string $time, ?int $adminId = null): array { $username = trim($username); if ($username === '') { @@ -72,6 +74,9 @@ class UserLogic $player->password = $this->hashPassword($password); $player->status = self::STATUS_NORMAL; $player->coin = $coin; + if ($adminId !== null && $adminId > 0) { + $player->admin_id = $adminId; + } $player->save(); } diff --git a/server/app/dice/controller/play_record/DicePlayRecordController.php b/server/app/dice/controller/play_record/DicePlayRecordController.php index bd17270..2952efd 100644 --- a/server/app/dice/controller/play_record/DicePlayRecordController.php +++ b/server/app/dice/controller/play_record/DicePlayRecordController.php @@ -6,6 +6,7 @@ // +---------------------------------------------------------------------- namespace app\dice\controller\play_record; +use app\dice\helper\AdminScopeHelper; use plugin\saiadmin\basic\BaseController; use app\dice\logic\play_record\DicePlayRecordLogic; use app\dice\validate\play_record\DicePlayRecordValidate; @@ -53,6 +54,7 @@ class DicePlayRecordController extends BaseController ['direction', ''], ]); $query = $this->logic->search($where); + AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null); $query->with([ 'dicePlayer', 'diceRewardConfig', @@ -68,7 +70,9 @@ class DicePlayRecordController extends BaseController #[Permission('玩家抽奖记录列表', 'dice:play_record:index:index')] public function getPlayerOptions(Request $request): Response { - $list = DicePlayer::field('id,username')->select(); + $query = DicePlayer::field('id,username'); + AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null); + $list = $query->select(); $data = $list->map(function ($item) { return ['id' => $item['id'], 'username' => $item['username'] ?? '']; })->toArray(); @@ -115,12 +119,15 @@ class DicePlayRecordController extends BaseController { $id = $request->input('id', ''); $model = $this->logic->read($id); - if ($model) { - $data = is_array($model) ? $model : $model->toArray(); - return $this->success($data); - } else { + if (!$model) { return $this->fail('未查找到信息'); } + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) { + return $this->fail('无权限查看该记录'); + } + $data = is_array($model) ? $model : $model->toArray(); + return $this->success($data); } /** diff --git a/server/app/dice/controller/player/DicePlayerController.php b/server/app/dice/controller/player/DicePlayerController.php index bb6a12a..c06f0cf 100644 --- a/server/app/dice/controller/player/DicePlayerController.php +++ b/server/app/dice/controller/player/DicePlayerController.php @@ -6,7 +6,9 @@ // +---------------------------------------------------------------------- namespace app\dice\controller\player; +use app\dice\helper\AdminScopeHelper; use app\dice\model\lottery_config\DiceLotteryConfig; +use plugin\saiadmin\app\model\system\SystemUser; use plugin\saiadmin\basic\BaseController; use app\dice\logic\player\DicePlayerLogic; use app\dice\validate\player\DicePlayerValidate; @@ -44,6 +46,35 @@ class DicePlayerController extends BaseController return $this->success($data); } + /** + * 获取后台管理员选项(SystemUser.id、username、realname),供 admin_id 下拉使用 + * 根据当前登录用户权限过滤(超级管理员可见全部,普通管理员按部门) + * @param Request $request + * @return Response 返回 [ ['id' => int, 'username' => string, 'realname' => string], ... ] + */ + #[Permission('大富翁-玩家列表', 'dice:player:index:index')] + public function getSystemUserOptions(Request $request): Response + { + $query = SystemUser::field('id,username,realname')->where('status', 1)->order('id', 'asc'); + if (isset($this->adminInfo['id']) && (int) $this->adminInfo['id'] > 1) { + $deptList = $this->adminInfo['deptList'] ?? []; + if (!empty($deptList)) { + $query->auth($deptList); + } + } + $list = $query->select(); + $data = $list->map(function ($item) { + $label = trim((string) ($item['realname'] ?? '')) ?: (string) ($item['username'] ?? ''); + return [ + 'id' => (int) $item['id'], + 'username' => (string) ($item['username'] ?? ''), + 'realname' => (string) ($item['realname'] ?? ''), + 'label' => $label ?: (string) $item['id'], + ]; + })->toArray(); + return $this->success($data); + } + /** * 数据列表 * @param Request $request @@ -61,6 +92,7 @@ class DicePlayerController extends BaseController ['lottery_config_id', ''], ]); $query = $this->logic->search($where); + AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null); $query->with(['diceLotteryConfig']); $data = $this->logic->getList($query); return $this->success($data); @@ -76,12 +108,15 @@ class DicePlayerController extends BaseController { $id = $request->input('id', ''); $model = $this->logic->read($id); - if ($model) { - $data = is_array($model) ? $model : $model->toArray(); - return $this->success($data); - } else { + if (!$model) { return $this->fail('未查找到信息'); } + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) { + return $this->fail('无权限查看该玩家'); + } + $data = is_array($model) ? $model : $model->toArray(); + return $this->success($data); } /** @@ -94,6 +129,10 @@ class DicePlayerController extends BaseController { $data = $request->post(); $this->validate('save', $data); + // 新增时若未选择管理员,默认使用当前登录用户 + if (empty($data['admin_id']) && isset($this->adminInfo['id']) && (int) $this->adminInfo['id'] > 0) { + $data['admin_id'] = (int) $this->adminInfo['id']; + } $result = $this->logic->add($data); if ($result) { return $this->success('添加成功'); @@ -112,6 +151,13 @@ class DicePlayerController extends BaseController { $data = $request->post(); $this->validate('update', $data); + $model = $this->logic->read($data['id'] ?? 0); + if ($model) { + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) { + return $this->fail('无权限修改该玩家'); + } + } $result = $this->logic->edit($data['id'], $data); if ($result) { return $this->success('修改成功'); @@ -136,6 +182,13 @@ class DicePlayerController extends BaseController if ($status === null || $status === '') { return $this->fail('缺少 status'); } + $model = $this->logic->read($id); + if ($model) { + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) { + return $this->fail('无权限修改该玩家'); + } + } $this->logic->edit($id, ['status' => (int) $status]); return $this->success('修改成功'); } @@ -152,6 +205,22 @@ class DicePlayerController extends BaseController if (empty($ids)) { return $this->fail('请选择要删除的数据'); } + $ids = is_array($ids) ? $ids : explode(',', (string) $ids); + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null) { + $models = $this->logic->model->whereIn('id', $ids)->column('admin_id', 'id'); + $validIds = []; + foreach ($ids as $id) { + $adminId = (int) ($models[$id] ?? 0); + if (in_array($adminId, $allowedIds, true)) { + $validIds[] = $id; + } + } + $ids = $validIds; + if (empty($ids)) { + return $this->fail('无权限删除所选玩家'); + } + } $result = $this->logic->destroy($ids); if ($result) { return $this->success('删除成功'); diff --git a/server/app/dice/controller/player_ticket_record/DicePlayerTicketRecordController.php b/server/app/dice/controller/player_ticket_record/DicePlayerTicketRecordController.php index 6fa1aed..e0925a1 100644 --- a/server/app/dice/controller/player_ticket_record/DicePlayerTicketRecordController.php +++ b/server/app/dice/controller/player_ticket_record/DicePlayerTicketRecordController.php @@ -6,6 +6,7 @@ // +---------------------------------------------------------------------- namespace app\dice\controller\player_ticket_record; +use app\dice\helper\AdminScopeHelper; use plugin\saiadmin\basic\BaseController; use app\dice\logic\player_ticket_record\DicePlayerTicketRecordLogic; use app\dice\validate\player_ticket_record\DicePlayerTicketRecordValidate; @@ -51,6 +52,7 @@ class DicePlayerTicketRecordController extends BaseController ['create_time_max', ''], ]); $query = $this->logic->search($where); + AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null); $query->with([ 'dicePlayer', ]); @@ -66,7 +68,9 @@ class DicePlayerTicketRecordController extends BaseController #[Permission('抽奖券获取记录列表', 'dice:player_ticket_record:index:index')] public function getPlayerOptions(Request $request): Response { - $list = DicePlayer::field('id,username')->select(); + $query = DicePlayer::field('id,username'); + AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null); + $list = $query->select(); $data = $list->map(function ($item) { return ['id' => $item['id'], 'username' => $item['username'] ?? '']; })->toArray(); @@ -83,12 +87,15 @@ class DicePlayerTicketRecordController extends BaseController { $id = $request->input('id', ''); $model = $this->logic->read($id); - if ($model) { - $data = is_array($model) ? $model : $model->toArray(); - return $this->success($data); - } else { + if (!$model) { return $this->fail('未查找到信息'); } + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) { + return $this->fail('无权限查看该记录'); + } + $data = is_array($model) ? $model : $model->toArray(); + return $this->success($data); } /** diff --git a/server/app/dice/controller/player_wallet_record/DicePlayerWalletRecordController.php b/server/app/dice/controller/player_wallet_record/DicePlayerWalletRecordController.php index 4d98f5e..ec9cbcd 100644 --- a/server/app/dice/controller/player_wallet_record/DicePlayerWalletRecordController.php +++ b/server/app/dice/controller/player_wallet_record/DicePlayerWalletRecordController.php @@ -6,6 +6,7 @@ // +---------------------------------------------------------------------- namespace app\dice\controller\player_wallet_record; +use app\dice\helper\AdminScopeHelper; use plugin\saiadmin\basic\BaseController; use app\dice\logic\player_wallet_record\DicePlayerWalletRecordLogic; use app\dice\validate\player_wallet_record\DicePlayerWalletRecordValidate; @@ -47,6 +48,7 @@ class DicePlayerWalletRecordController extends BaseController ['create_time_max', ''], ]); $query = $this->logic->search($where); + AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null); $query->with([ 'dicePlayer', 'operator', @@ -63,7 +65,9 @@ class DicePlayerWalletRecordController extends BaseController #[Permission('玩家钱包流水列表', 'dice:player_wallet_record:index:index')] public function getPlayerOptions(Request $request): Response { - $list = DicePlayer::field('id,username')->select(); + $query = DicePlayer::field('id,username'); + AdminScopeHelper::applyAdminScope($query, $this->adminInfo ?? null); + $list = $query->select(); $data = $list->map(function ($item) { return ['id' => $item['id'], 'username' => $item['username'] ?? '']; })->toArray(); @@ -83,10 +87,14 @@ class DicePlayerWalletRecordController extends BaseController if ($playerId === null || $playerId === '') { return $this->fail('缺少 player_id'); } - $player = DicePlayer::field('coin')->where('id', $playerId)->find(); + $player = DicePlayer::field('coin,admin_id')->where('id', $playerId)->find(); if (!$player) { return $this->fail('玩家不存在'); } + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null && !in_array((int) ($player->admin_id ?? 0), $allowedIds, true)) { + return $this->fail('无权限操作该玩家'); + } return $this->success(['wallet_before' => (float) $player['coin']]); } @@ -100,12 +108,15 @@ class DicePlayerWalletRecordController extends BaseController { $id = $request->input('id', ''); $model = $this->logic->read($id); - if ($model) { - $data = is_array($model) ? $model : $model->toArray(); - return $this->success($data); - } else { + if (!$model) { return $this->fail('未查找到信息'); } + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) { + return $this->fail('无权限查看该记录'); + } + $data = is_array($model) ? $model : $model->toArray(); + return $this->success($data); } /** @@ -155,6 +166,14 @@ class DicePlayerWalletRecordController extends BaseController return $this->fail('请先登录'); } + $player = DicePlayer::field('admin_id')->where('id', $playerId)->find(); + if ($player) { + $allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null); + if ($allowedIds !== null && !in_array((int) ($player->admin_id ?? 0), $allowedIds, true)) { + return $this->fail('无权限操作该玩家'); + } + } + try { $this->logic->adminOperate($data, $adminId); return $this->success('操作成功'); diff --git a/server/app/dice/helper/AdminScopeHelper.php b/server/app/dice/helper/AdminScopeHelper.php new file mode 100644 index 0000000..4ef053d --- /dev/null +++ b/server/app/dice/helper/AdminScopeHelper.php @@ -0,0 +1,60 @@ +auth($deptList); + $ids = $query->column('id'); + return array_map('intval', $ids ?: []); + } + + /** + * 对查询应用 admin_id 范围过滤 + * + * @param object $query ThinkORM 查询对象 + * @param array|null $adminInfo 当前登录管理员信息 + * @return void + */ + public static function applyAdminScope($query, ?array $adminInfo): void + { + $allowedIds = self::getAllowedAdminIds($adminInfo); + if ($allowedIds === null) { + return; + } + if (empty($allowedIds)) { + $query->whereRaw('1=0'); + return; + } + $query->whereIn('admin_id', $allowedIds); + } +} diff --git a/server/app/dice/logic/player_wallet_record/DicePlayerWalletRecordLogic.php b/server/app/dice/logic/player_wallet_record/DicePlayerWalletRecordLogic.php index 330417d..ba6cd56 100644 --- a/server/app/dice/logic/player_wallet_record/DicePlayerWalletRecordLogic.php +++ b/server/app/dice/logic/player_wallet_record/DicePlayerWalletRecordLogic.php @@ -73,8 +73,10 @@ class DicePlayerWalletRecordLogic extends BaseLogic DicePlayer::where('id', $playerId)->update(['coin' => $walletAfter]); + $playerAdminId = ($player->admin_id ?? null) ? (int) $player->admin_id : null; $record = [ 'player_id' => $playerId, + 'admin_id' => $playerAdminId, 'coin' => $type === 3 ? $coin : -$coin, 'type' => $type, 'wallet_before' => $walletBefore, diff --git a/server/app/dice/model/play_record/DicePlayRecord.php b/server/app/dice/model/play_record/DicePlayRecord.php index 861a16b..4e3aede 100644 --- a/server/app/dice/model/play_record/DicePlayRecord.php +++ b/server/app/dice/model/play_record/DicePlayRecord.php @@ -19,6 +19,7 @@ use think\model\relation\BelongsTo; * * @property $id ID * @property $player_id 玩家id + * @property $admin_id 关联玩家所属管理员ID(DicePlayer.admin_id) * @property $lottery_config_id 彩金池配置 * @property $lottery_type 抽奖类型 * @property $is_win 是否中大奖:豹子号[1,1,1,1,1]~[6,6,6,6,6]为1,否则0 diff --git a/server/app/dice/model/player/DicePlayer.php b/server/app/dice/model/player/DicePlayer.php index d9c2ae3..686ede9 100644 --- a/server/app/dice/model/player/DicePlayer.php +++ b/server/app/dice/model/player/DicePlayer.php @@ -22,6 +22,7 @@ use app\dice\model\lottery_config\DiceLotteryConfig; * @property $password 密码 * @property $status 状态 * @property $coin 平台币 + * @property $admin_id 创建该玩家的后台管理员ID,关联 sa_system_user.id * @property $lottery_config_id 彩金池配置ID(0或null时使用自定义权重*_weight) * @property $t1_weight T1池权重 * @property $t2_weight T2池权重 diff --git a/server/app/dice/model/player_ticket_record/DicePlayerTicketRecord.php b/server/app/dice/model/player_ticket_record/DicePlayerTicketRecord.php index 5109c3f..bcde180 100644 --- a/server/app/dice/model/player_ticket_record/DicePlayerTicketRecord.php +++ b/server/app/dice/model/player_ticket_record/DicePlayerTicketRecord.php @@ -17,6 +17,7 @@ use think\model\relation\BelongsTo; * * @property $id ID * @property $player_id 玩家id + * @property $admin_id 关联玩家所属管理员ID(DicePlayer.admin_id) * @property $use_coins 消耗硬币 * @property $total_ticket_count 总抽奖次数 * @property $paid_ticket_count 购买抽奖次数 diff --git a/server/app/dice/model/player_wallet_record/DicePlayerWalletRecord.php b/server/app/dice/model/player_wallet_record/DicePlayerWalletRecord.php index 05434c5..c1fec97 100644 --- a/server/app/dice/model/player_wallet_record/DicePlayerWalletRecord.php +++ b/server/app/dice/model/player_wallet_record/DicePlayerWalletRecord.php @@ -18,6 +18,7 @@ use think\model\relation\BelongsTo; * * @property $id ID * @property $player_id 用户id + * @property $admin_id 关联玩家所属管理员ID(DicePlayer.admin_id) * @property $coin 平台币变化 * @property $type 类型:0=充值 1=提现 2=购买抽奖次数 * @property $wallet_before 钱包操作前 diff --git a/server/plugin/saiadmin/config/route.php b/server/plugin/saiadmin/config/route.php index 1e7e2ac..51dc8b4 100644 --- a/server/plugin/saiadmin/config/route.php +++ b/server/plugin/saiadmin/config/route.php @@ -87,6 +87,7 @@ Route::group('/core', function () { fastRoute('dice/player/DicePlayer', \app\dice\controller\player\DicePlayerController::class); Route::put('/dice/player/DicePlayer/updateStatus', [\app\dice\controller\player\DicePlayerController::class, 'updateStatus']); Route::get('/dice/player/DicePlayer/getLotteryConfigOptions', [\app\dice\controller\player\DicePlayerController::class, 'getLotteryConfigOptions']); + Route::get('/dice/player/DicePlayer/getSystemUserOptions', [\app\dice\controller\player\DicePlayerController::class, 'getSystemUserOptions']); 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']);