This commit is contained in:
2025-09-30 09:42:43 +08:00
parent 9719228d6d
commit c5ac27cdec
15 changed files with 222 additions and 139 deletions

View File

@@ -36,10 +36,17 @@ public class BanmaOrderController extends BaseController {
*/
@PostMapping("/accounts")
public R<?> saveAccount(@RequestBody BanmaAccount body) {
// 先验证Token
String token = ((com.ruoyi.system.service.impl.BanmaAccountServiceImpl) accountService)
.validateAndGetToken(body.getUsername(), body.getPassword());
if (token == null) {
return R.fail("账号或密码错误无法获取Token");
}
// 验证成功后保存账号
Long id = accountService.saveOrUpdate(body);
boolean ok = false;
try { ok = accountService.refreshToken(id); } catch (Exception ignore) {}
return ok ? R.ok(Map.of("id", id)) : R.fail("账号或密码错误无法获取Token");
// 刷新Token到数据库
accountService.refreshToken(id);
return R.ok(Map.of("id", id));
}
/**