优化
This commit is contained in:
+12
@@ -37,5 +37,17 @@ public class InternalSupplierController {
|
||||
return ApiResponse.success(service.internalBookingCandidates(carrierCode));
|
||||
}
|
||||
|
||||
public record TruckingContact(long supplierId, String name, String email) {}
|
||||
|
||||
@GetMapping("/{supplierId}/trucking-contact")
|
||||
public ApiResponse<TruckingContact> truckingContact(
|
||||
@RequestHeader(value="X-Internal-Service-Token", required=false) String token,
|
||||
@PathVariable long supplierId, @RequestParam(defaultValue="true") boolean requireActive) {
|
||||
requireToken(token);
|
||||
service.internalSnapshot(supplierId, requireActive, "TRUCKING");
|
||||
var supplier = service.detail(supplierId);
|
||||
return ApiResponse.success(new TruckingContact(supplierId, supplier.name(), supplier.email()));
|
||||
}
|
||||
|
||||
private void requireToken(String token) { if (token == null || !MessageDigest.isEqual(expected, token.getBytes(StandardCharsets.UTF_8))) throw new BizException(ResultCode.FORBIDDEN, "内部服务凭证无效"); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user