1
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user