|
|
@@ -1,14 +1,10 @@
|
|
|
package org.dromara.server.consume.controller.v2;
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import org.dromara.common.core.constant.ApiErrorTypeConstants;
|
|
|
+import org.dromara.common.core.api.ReturnResult;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
-import org.dromara.common.core.domain.model.ErrorInfo;
|
|
|
-import org.dromara.common.core.domain.model.ErrorResult;
|
|
|
import org.dromara.server.consume.business.TermBusiness;
|
|
|
import org.dromara.server.consume.domain.vo.yc.TermToken;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@RestController
|
|
|
@@ -26,19 +22,13 @@ public class AuthControllerV2 {
|
|
|
*/
|
|
|
@GetMapping("/token/term/{termId}")
|
|
|
public Object getTermToken(@PathVariable("termId") Long termId, @RequestHeader(name = "admin") String admin,
|
|
|
- @RequestHeader(name = "pwd") String pwd) {
|
|
|
+ @RequestHeader(name = "pwd") String pwd) {
|
|
|
|
|
|
R<TermToken> mapResult = termBusiness.getTermToken(termId, admin, pwd);
|
|
|
|
|
|
if (R.isError(mapResult)) {
|
|
|
- ErrorResult result = new ErrorResult();
|
|
|
- result.setStatusCode(HttpStatus.BAD_REQUEST.value());
|
|
|
- result.setMessage("获取Token失败");
|
|
|
- result.getErrors().add(new ErrorInfo(1, "获取设备Token失败", ApiErrorTypeConstants.BAD_REQUEST, mapResult.getMsg()));
|
|
|
-
|
|
|
- return new ResponseEntity<Object>(result, null, HttpStatus.BAD_REQUEST);
|
|
|
+ return new ReturnResult(false, 1, "获取设备Token失败", null, System.currentTimeMillis());
|
|
|
}
|
|
|
-
|
|
|
- return mapResult.getData();
|
|
|
+ return new ReturnResult(true, 1, "获取设备Token成功", mapResult.getData(), System.currentTimeMillis());
|
|
|
}
|
|
|
}
|