1.压注记录修改为游玩记录

2.测试结算并测试
3.备份数据库
This commit is contained in:
2026-04-23 17:21:02 +08:00
parent 1531115a26
commit f2b4dab54f
20 changed files with 2130 additions and 94 deletions

View File

@@ -599,6 +599,9 @@ class Channel extends Backend
if ($response !== null) {
return $response;
}
if (!$this->auth->isSuperAdmin()) {
return $this->error('仅超管可执行结算,结算后系统会自动发放至管理员钱包');
}
$id = (int) ($request->post('id', $request->get('id', 0)));
if ($id <= 0) {
@@ -614,18 +617,11 @@ class Channel extends Backend
$remark = trim((string) $request->post('remark', ''));
if ($this->auth->isSuperAdmin()) {
$res = ChannelSettlementService::settleBySuperAdmin((int) $row['id'], intval($this->auth->id), $remark, false);
if (($res['ok'] ?? false) !== true) {
return $this->error((string) ($res['msg'] ?? '结算失败'));
}
return $this->success('超管结算完成,渠道分红余额已入账');
}
$res = ChannelSettlementService::settleDividendByChannelAdmin((int) $row['id'], intval($this->auth->id), $remark);
$res = ChannelSettlementService::settleBySuperAdmin((int) $row['id'], intval($this->auth->id), $remark, false);
if (($res['ok'] ?? false) !== true) {
return $this->error((string) ($res['msg'] ?? '结算失败'));
}
return $this->success('渠道分红已结算完成');
return $this->success('超管结算完成,已按分配比例自动发放给管理员');
}
/**

View File

@@ -0,0 +1,77 @@
<?php
namespace app\admin\controller\admin;
use app\common\controller\Backend;
use support\Response;
use Webman\Http\Request as WebmanRequest;
/**
* 管理员钱包(只读)
*/
class AdminWallet extends Backend
{
protected ?object $model = null;
protected bool $modelValidate = false;
protected string|array $quickSearchField = ['id', 'admin_id'];
protected string|array $defaultSortField = ['id' => 'desc'];
protected string|array $orderGuarantee = ['id' => 'desc'];
protected array $withJoinTable = ['admin'];
protected function initController(WebmanRequest $request): ?Response
{
$this->model = new \app\common\model\AdminWallet();
return null;
}
protected function _index(): Response
{
if ($this->request && $this->request->get('select')) {
return $this->select($this->request);
}
list($where, $alias, $limit, $order) = $this->queryBuilder();
$table = strtolower($this->model->getTable());
$mainShort = $alias[$table] ?? '';
if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) {
// 非超管仅可查看自己钱包
$where[] = [$mainShort . '.admin_id', '=', intval($this->auth->id ?? 0)];
}
$res = $this->model
->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable)
->visible([
'admin' => ['username', 'channel_id'],
])
->alias($alias)
->where($where)
->order($order)
->paginate($limit);
return $this->success('', [
'list' => $res->items(),
'total' => $res->total(),
'remark' => get_route_remark(),
]);
}
protected function _add(): Response
{
return $this->error('管理员钱包不允许手动新增');
}
protected function _edit(): Response
{
return $this->error('管理员钱包不允许手动编辑');
}
protected function _del(): Response
{
return $this->error('管理员钱包不允许删除');
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace app\admin\controller\admin;
use app\common\controller\Backend;
use support\Response;
use Webman\Http\Request as WebmanRequest;
/**
* 管理员钱包流水(只读)
*/
class AdminWalletRecord extends Backend
{
protected ?object $model = null;
protected bool $modelValidate = false;
protected string|array $quickSearchField = ['id', 'biz_type', 'ref_type', 'idempotency_key', 'remark'];
protected string|array $defaultSortField = ['id' => 'desc'];
protected string|array $orderGuarantee = ['id' => 'desc'];
protected array $withJoinTable = ['admin', 'channel', 'operatorAdmin'];
protected function initController(WebmanRequest $request): ?Response
{
$this->model = new \app\common\model\AdminWalletRecord();
return null;
}
protected function _index(): Response
{
if ($this->request && $this->request->get('select')) {
return $this->select($this->request);
}
list($where, $alias, $limit, $order) = $this->queryBuilder();
$table = strtolower($this->model->getTable());
$mainShort = $alias[$table] ?? '';
if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) {
$where[] = [$mainShort . '.admin_id', '=', intval($this->auth->id ?? 0)];
}
$res = $this->model
->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable)
->visible([
'admin' => ['username'],
'channel' => ['name'],
'operatorAdmin' => ['username'],
])
->alias($alias)
->where($where)
->order($order)
->paginate($limit);
return $this->success('', [
'list' => $res->items(),
'total' => $res->total(),
'remark' => get_route_remark(),
]);
}
protected function _add(): Response
{
return $this->error('管理员钱包流水不允许手动新增');
}
protected function _edit(): Response
{
return $this->error('管理员钱包流水不允许手动编辑');
}
protected function _del(): Response
{
return $this->error('管理员钱包流水不允许删除');
}
}

View File

@@ -0,0 +1,120 @@
<?php
namespace app\admin\controller\game;
use app\common\controller\Backend;
use support\Response;
use Webman\Http\Request as WebmanRequest;
/**
* 游玩记录(原压注订单)
*/
class PlayRecord extends Backend
{
protected ?object $model = null;
protected bool $modelValidate = false;
protected string|array $quickSearchField = ['id', 'period_no', 'idempotency_key'];
protected string|array $defaultSortField = ['id' => 'desc'];
protected string|array $orderGuarantee = ['id' => 'desc'];
protected array $withJoinTable = ['user', 'channel', 'gameRecord'];
protected function initController(WebmanRequest $request): ?Response
{
$this->model = new \app\common\model\PlayRecord();
return null;
}
public function add(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
return $this->error('游玩记录由游戏接口生成,禁止后台手工新增');
}
public function edit(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
return $this->error('游玩记录不可编辑');
}
public function del(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
return $this->error('游玩记录不可删除');
}
public function sortable(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
return $this->error('不支持排序');
}
protected function _index(): Response
{
if ($this->request && $this->request->get('select')) {
return $this->select($this->request);
}
list($where, $alias, $limit, $order) = $this->queryBuilder();
$table = strtolower($this->model->getTable());
$mainShort = $alias[$table] ?? '';
if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) {
$where[] = ['user.admin_id', 'in', $this->scopedAdminIds()];
}
$res = $this->model
->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable)
->visible([
'user' => ['username', 'phone'],
'channel' => ['name'],
'gameRecord' => ['period_no', 'status'],
])
->alias($alias)
->where($where)
->order($order)
->paginate($limit);
return $this->success('', [
'list' => $res->items(),
'total' => $res->total(),
'remark' => get_route_remark(),
]);
}
/**
* @return int[]
*/
private function scopedAdminIds(): array
{
if (!$this->auth) {
return [0];
}
if ($this->auth->isSuperAdmin()) {
return [];
}
$groupIds = $this->auth->getAdminChildGroups();
$adminIds = $groupIds ? $this->auth->getGroupAdmins($groupIds) : [];
$adminIds[] = $this->auth->id;
$adminIds = array_map(static fn($id) => intval(strval($id)), $adminIds);
$adminIds = array_values(array_unique(array_filter($adminIds, static fn($id) => $id > 0)));
return $adminIds === [] ? [0] : $adminIds;
}
}