feat: 实现社区激励金(公户)系统,经济闭环
- 新增 CommunityFund / FundLog 模型(公户余额单行表 + 6种流水类型) - 新增 FundRepo 仓储(GetBalance / IncrBalance / CreateLog / ListLogs / WithTx) - 改造 EnergyService 五个方法:Energize 税收入公户、DeductOnRename/DeductOnDeletePost 入公户、RefundOnRenameReject 从公户支出、AdminAdjust 拆分为 admin_transfer/system_operation - 新增 ErrInsufficientFund 错误哨兵 - 管理后台新增公户余额展示 + 公户流水页面 + 域能调整资金来源选择 - 新增 energy.css / energy.js 前端交互 - 侧边栏新增公户流水入口
This commit is contained in:
30
templates/admin/html/energy/fund_logs.html
Normal file
30
templates/admin/html/energy/fund_logs.html
Normal file
@ -0,0 +1,30 @@
|
||||
{{template "admin/layout/base.html" .}}
|
||||
<div class="page-header">
|
||||
<h1>公户流水</h1>
|
||||
<p class="page-desc">查看社区激励金(公户)的全部收支记录</p>
|
||||
</div>
|
||||
|
||||
<div class="filter-bar">
|
||||
<label for="fund-log-type-filter" style="font-size:0.85rem;color:#4a5568;font-weight:500;">类型筛选:</label>
|
||||
<select id="fund-log-type-filter">
|
||||
<option value="">全部类型</option>
|
||||
{{range $type, $name := .LogTypes}}<option value="{{$type}}">{{$name}}</option>{{end}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<table class="log-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>时间</th>
|
||||
<th>变动</th>
|
||||
<th>类型</th>
|
||||
<th>说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="fund-log-tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="fund-log-pagination" class="pagination"></div>
|
||||
{{template "admin/layout/footer.html" .}}
|
||||
@ -1,2 +1,44 @@
|
||||
{{template "admin/layout/base.html" .}}
|
||||
<div class="page-header">
|
||||
<h1>域能管理</h1>
|
||||
<p class="page-desc">管理公户余额与用户域能调整</p>
|
||||
</div>
|
||||
|
||||
<div class="fund-card">
|
||||
<div class="fund-info">
|
||||
<h3>公户余额</h3>
|
||||
<p id="fund-balance" class="fund-balance{{if lt .FundBalance 0}} negative{{end}}">{{printf "%.1f" .FundBalanceDisplay}}</p>
|
||||
</div>
|
||||
<div class="fund-icon">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="48" height="48"><path d="M12 1v4M12 19v4M4.22 4.22l2.83 2.83M16.95 16.95l2.83 2.83M1 12h4M19 12h4M4.22 19.78l2.83-2.83M16.95 7.05l2.83-2.83"/></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="adjust-form">
|
||||
<h3>调整用户域能</h3>
|
||||
<form id="adjust-form">
|
||||
<div class="form-group">
|
||||
<label for="user_ids">目标用户 UID(多个用英文逗号分隔)</label>
|
||||
<input type="text" id="user_ids" name="user_ids" placeholder="例如:1,2,3" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="amount">调整金额(正数为增加,负数为扣减,×10存储)</label>
|
||||
<input type="number" id="amount" name="amount" placeholder="例如:10 表示 +1.0 域能" required>
|
||||
<div class="form-hint">存储单位 ×10:输入 10 = +1.0 域能,输入 -5 = -0.5 域能</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="adjust-mode">资金来源</label>
|
||||
<select id="adjust-mode" name="mode">
|
||||
<option value="admin_transfer">公户转出(受余额约束)</option>
|
||||
{{if .IsOwner}}<option value="system_operation">系统操作(不受余额约束,仅站长可用)</option>{{end}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="description">操作说明</label>
|
||||
<textarea id="description" name="description" placeholder="简要说明调整原因" required maxlength="500"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn-primary">确认调整</button>
|
||||
<div id="adjust-message" class="form-message"></div>
|
||||
</form>
|
||||
</div>
|
||||
{{template "admin/layout/footer.html" .}}
|
||||
|
||||
@ -1,2 +1,31 @@
|
||||
{{template "admin/layout/base.html" .}}
|
||||
<div class="page-header">
|
||||
<h1>域能日志</h1>
|
||||
<p class="page-desc">查看所有用户的域能流水记录</p>
|
||||
</div>
|
||||
|
||||
<div class="filter-bar">
|
||||
<label for="log-type-filter" style="font-size:0.85rem;color:#4a5568;font-weight:500;">类型筛选:</label>
|
||||
<select id="log-type-filter">
|
||||
<option value="">全部类型</option>
|
||||
{{range $type, $name := .LogTypes}}<option value="{{$type}}">{{$name}}</option>{{end}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<table class="log-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>时间</th>
|
||||
<th>用户UID</th>
|
||||
<th>变动</th>
|
||||
<th>类型</th>
|
||||
<th>说明</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="energy-log-tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="energy-log-pagination" class="pagination"></div>
|
||||
{{template "admin/layout/footer.html" .}}
|
||||
|
||||
Reference in New Issue
Block a user