Commit 50c5028b by 汪鑫

旅馆一件事

parent a723e7d6
...@@ -16,7 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -16,7 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;
import java.io.IOException;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -67,4 +69,14 @@ public class CommonController extends BaseController { ...@@ -67,4 +69,14 @@ public class CommonController extends BaseController {
public RespInfo<List<OrgCodeVO>> getAreaCode(){ public RespInfo<List<OrgCodeVO>> getAreaCode(){
return RespInfo.mobiSuccess(hotelMaterialListingService.getAreaCode()); return RespInfo.mobiSuccess(hotelMaterialListingService.getAreaCode());
} }
@ApiOperation("图片转base64")
@PostMapping("imageToBase64")
public RespInfo<String> imageToBase64(MultipartFile file) throws IOException {
String baseStr = null;
BASE64Encoder encoder = new BASE64Encoder();
baseStr= encoder.encode(file.getBytes());
baseStr = baseStr.replaceAll("\r\n", "");
return RespInfo.mobiSuccess(baseStr);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment