一、两个curl请求
@echo off
set username=gemengkai
set password=123456
set loginFile= loginResult.txt
for /F %%i in ('curl -H "Content-Type: application/json" -X POST -d "{"""username""":"""%username%""","""password""":"""%password%"""}" http://127.0.0.1:8081/login') do (set token=%%i)
echo %token% > %loginFile%
for /f "delims=, tokens=3" %%i in (%loginFile%) do ( set token=%%i)
for /f "delims=: tokens=3" %%i in (%token%) do ( set tokenresult=%%i)
for /F %%i in ('curl -H "token:%tokenresult:~1%" -X POST http://127.0.0.1:8081/clockOut') do echo %%i