File tree Expand file tree Collapse file tree
src/main/java/run/ikaros/plugin/pan115/repository Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。
44
5+ # 1.0.16
6+
7+ - 优化请求api的报错逻辑
8+
59# 1.0.15
610
711- 刷新Token后立刻刷新请求头
Original file line number Diff line number Diff line change 11group =run.ikaros.plugin
22description =A pan115 plugin for ikaros.
3- version =1.0.15
3+ version =1.0.16
Original file line number Diff line number Diff line change 1010import org .springframework .core .io .buffer .DefaultDataBufferFactory ;
1111import org .springframework .http .HttpHeaders ;
1212import org .springframework .http .HttpStatus ;
13+ import org .springframework .http .HttpStatusCode ;
1314import org .springframework .http .MediaType ;
1415import org .springframework .stereotype .Component ;
1516import org .springframework .util .Assert ;
@@ -163,6 +164,16 @@ public Mono<AttachmentDriver> refreshToken(AttachmentDriver driver) {
163164 .contentType (MediaType .APPLICATION_FORM_URLENCODED )
164165 .bodyValue (body )
165166 .exchangeToMono (rsp -> rsp .bodyToMono (Pan115Result .class ))
167+ .flatMap (r -> {
168+ if (r == null ) {
169+ return Mono .error (new Pan115RequestFailException (HttpStatusCode .valueOf (400 ),
170+ "request pan 115 api fail with result is null" ));
171+ }
172+ if (!r .getState ()) {
173+ return Mono .error (new Pan115RequestFailException (r .getMessage (), r .getCode ()));
174+ }
175+ return Mono .just (r );
176+ })
166177 .filter (r -> Objects .nonNull (r ) && r .getState ())
167178 .flatMap (r -> {
168179 if (!r .getState ()) {
You can’t perform that action at this time.
0 commit comments