1. 请在views/rental/nodeDetail 页面添加出租设置功能 2. 一个租赁节点只能绑定一个钱包地址,添加验证和页面布局,请修改views/rental/nodeDetail 页面,并添加换绑功能。

This commit is contained in:
lu7213 committed 2026-10-30 20:25:31 -04:00
1 parent 624110e43c
commit 4b6ea31e6a
4 files changed
+163

No files matched your search

@@ -184,6 +184,29 @@ public class RentalController {
return AjaxResult.success();
}
/** 本人节点及绑定钱包详情,显式选列保护认证材料。 */
@GetMapping("/node/{id}")
@PreAuthorize("@ss.hasPermi('rent:portal:view')")
public AjaxResult nodeDetail(@PathVariable long id) {
Map<String, Object> node = store.one("SELECT id,node_no,name,status,connection_status,heartbeat_at FROM rent_node WHERE id=? AND user_id=?", id, user());
require(node != null, "节点不存在或无权访问");
if (node.get("heartbeat_at") != null) {
node.put("heartbeat_at", time(node.get("heartbeat_at")).toEpochMilli());
}
// 按节点查询而非在全量钱包的第一页过滤;显式选列不输出挑战或签名。
List<Map<String, Object>> wallets = store.rows("SELECT id,node_id,network,address,status,ownership_verified_at,"
+ "energy_enabled,bandwidth_enabled,energy_retain_sun,bandwidth_retain_sun FROM rent_wallet WHERE node_id=? ORDER BY id", id);
return AjaxResult.success(map("node", node, "wallets", wallets));
}
/** 本人离线节点换绑,旧钱包历史关联与新地址合法性在事务内校验。 */
@PostMapping("/wallet/{id}/rebind")
@PreAuthorize("@ss.hasPermi('rent:wallet:bind')")
public AjaxResult rebindWallet(@PathVariable long id, @RequestBody Map<String, Object> body) {
provisioning.rebindWallet(id, body, user());
return AjaxResult.success();
}
/** 删除本人尚未完成所有权验证的待审核地址。 */
@DeleteMapping("/wallet/{id}")
@PreAuthorize("@ss.hasPermi('rent:wallet:bind')")