客户照片上传功能
This commit is contained in:
34
src/main/java/com/rj/dto/CustomerPhotoUploadResult.java
Normal file
34
src/main/java/com/rj/dto/CustomerPhotoUploadResult.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.rj.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 客户照片上传至 MinIO 的结果,供控制器映射 HTTP 状态与 JSON。
|
||||
*/
|
||||
@Getter
|
||||
public class CustomerPhotoUploadResult {
|
||||
|
||||
private final int httpStatus;
|
||||
private final boolean success;
|
||||
private final String message;
|
||||
private final String url;
|
||||
|
||||
private CustomerPhotoUploadResult(int httpStatus, boolean success, String message, String url) {
|
||||
this.httpStatus = httpStatus;
|
||||
this.success = success;
|
||||
this.message = message;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public static CustomerPhotoUploadResult ok(String url) {
|
||||
return new CustomerPhotoUploadResult(200, true, "上传成功", url);
|
||||
}
|
||||
|
||||
public static CustomerPhotoUploadResult badRequest(String message) {
|
||||
return new CustomerPhotoUploadResult(400, false, message, null);
|
||||
}
|
||||
|
||||
public static CustomerPhotoUploadResult serverError(String message) {
|
||||
return new CustomerPhotoUploadResult(500, false, message, null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user