| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.web; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.config.annotation.LoginNoRequired; |
| | | import com.doumee.core.annotation.trace.Trace; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.haikang.model.HKConstants; |
| | | import com.doumee.core.haikang.model.param.BaseResponse; |
| | | import com.doumee.core.haikang.model.param.request.FacePictureCheckRequest; |
| | | import com.doumee.core.haikang.model.param.respose.FacePictureCheckResponse; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.FtpUtil; |
| | | import com.doumee.core.utils.aliyun.ALiYunUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartResolver; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.imageio.stream.ImageOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author Eva.Caesar Liu |
| | | * @date 2023/02/14 11:14 |
| | | */ |
| | | @Api(tags = "ãå
¬ä¼å·ãå
Œ
±æ¥å£") |
| | | @Trace(exclude = true) |
| | | @RestController |
| | | @LoginNoRequired |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/web/public") |
| | | @Slf4j |
| | | public class WebPublicController extends BaseController { |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ ", notes = "ä¸ä¼ ", httpMethod = "POST", position = 6) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "folder", value = "æä»¶å¤¹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), |
| | | }) |
| | | @PostMapping(value = "/upload", headers = "content-type=multipart/form-data") |
| | | public void uploadMobile(String folder, HttpServletRequest request, HttpServletResponse response,Integer isFace) throws Exception { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | upload(multipartRequest, response, folder + "/", |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode(),isFace); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ å¾ç", notes = "ä¸ä¼ å¾ç", httpMethod = "POST", position = 6) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "folder", value = "æä»¶å¤¹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), |
| | | }) |
| | | @PostMapping(value = "/uploadPicture", headers = "content-type=multipart/form-data") |
| | | public void uploadPicture(String folder, HttpServletRequest request, HttpServletResponse response,Integer isFace) throws Exception { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | Iterator<String> fileNames = multipartRequest.getFileNames(); |
| | | Map<String, Object> context = new HashMap<>(); |
| | | while (fileNames.hasNext()){ |
| | | MultipartFile file = multipartRequest.getFile(fileNames.next()); |
| | | String fileName = file.getOriginalFilename(); |
| | | String suffix = fileName.substring(fileName.lastIndexOf(".")); |
| | | if ( !StringUtils.equalsIgnoreCase(suffix, ".jpg") || !StringUtils.equalsIgnoreCase(suffix, ".png")) { |
| | | context.put("code", 0); |
| | | context.put("message", "对ä¸èµ·ï¼æä»¶æ ¼å¼ä¸ä¼ æè¯¯ï¼"); |
| | | } |
| | | } |
| | | upload(multipartRequest, response, folder + "/", |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.BUCKETNAME).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode(),isFace); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public static FtpUtil ftp = null; |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ æä»¶å°FTP") |
| | | @RequestMapping(method= RequestMethod.POST,value="uploadFtp.do",headers = "content-type=multipart/form-data") |
| | | @ResponseBody |
| | | public void uploadFtp(HttpServletRequest request, HttpServletResponse response, String folderCode,Integer isFace) throws Exception { |
| | | System.out.println("ä¸ä¼ ä¸"); |
| | | String folder = systemDictDataBiz.queryByCode(Constants.FTP,folderCode).getCode(); |
| | | String prefixPath = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode(); |
| | | InputStream is = null; |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | Map<String, Object> context = new HashMap<>(); |
| | | try { |
| | | if(ftp == null){ |
| | | ftp = new FtpUtil(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_HOST).getCode(), |
| | | Integer.parseInt(systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PORT).getCode()), |
| | | systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_USERNAME).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_PWD).getCode()); |
| | | }else{ |
| | | ftp.connect(); |
| | | } |
| | | CommonsMultipartResolver multipartResovler = new CommonsMultipartResolver(); |
| | | if (multipartResovler.isMultipart(request)) { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | Iterator<String> it = multipartRequest.getFileNames(); |
| | | while (it.hasNext()) { |
| | | MultipartFile file = multipartRequest.getFile(it.next()); |
| | | is = file.getInputStream(); |
| | | String date = DateUtil.getNowShortDate(); |
| | | String fName = date+"/"+ UUID.randomUUID()+".jpg"; |
| | | String fileName = folder+fName; |
| | | // boolean r = ftp.uploadInputstream(compressImg(is),fileName); |
| | | boolean r = ftp.uploadInputstream(is,fileName); |
| | | if(r){ |
| | | if(Objects.nonNull(isFace) && Constants.equalsInteger(isFace,Constants.ZERO)){ |
| | | //éªè¯äººè¸è¯å |
| | | //人è¸è¯å |
| | | FacePictureCheckRequest param = new FacePictureCheckRequest(); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode(); |
| | | param.setFacePicUrl(prefixUrl + fileName); |
| | | BaseResponse<FacePictureCheckResponse> responseBaseResponse = HKService.facePictureCheck(param); |
| | | if(responseBaseResponse == null || !StringUtils.equals(responseBaseResponse.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | // throw new BusinessException(com.doumee.core.constants.ResponseStatus.SERVER_ERROR.getCode(), "对ä¸èµ·ï¼äººè¸è¯åè·åæ°æ®å¤±è´¥~"); |
| | | context.put("code", 0); |
| | | context.put("message", "对ä¸èµ·ï¼äººè¸è¯åè·åæ°æ®å¤±è´¥~"); |
| | | context.put("errno",0); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | FacePictureCheckResponse facePictureCheckResponse = responseBaseResponse.getData(); |
| | | if(Objects.isNull(facePictureCheckResponse) || Objects.isNull(facePictureCheckResponse.getCheckResult())){ |
| | | // throw new BusinessException(com.doumee.core.constants.ResponseStatus.SERVER_ERROR.getCode(), "对ä¸èµ·ï¼äººè¸è¯åè·åæ°æ®å¤±è´¥~"); |
| | | context.put("code", 0); |
| | | context.put("message", "对ä¸èµ·ï¼äººè¸è¯åè·åæ°æ®å¤±è´¥~"); |
| | | context.put("errno",0); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | if(!facePictureCheckResponse.getCheckResult()){ |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), facePictureCheckResponse.getStatusMessage()); |
| | | context.put("code", 0); |
| | | context.put("message", facePictureCheckResponse.getStatusMessage()); |
| | | context.put("errno",0); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | context.put("success", true); |
| | | context.put("code", 200); |
| | | context.put("errno",0); |
| | | JSONObject fileJSON = new JSONObject(); |
| | | fileJSON.put("halfPath", fName); |
| | | fileJSON.put("prefixPath", prefixPath); |
| | | fileJSON.put("folder", folder); |
| | | fileJSON.put("addr", prefixPath+fileName); |
| | | context.put("data",fileJSON); |
| | | context.put("message","è¯·æ±æå"); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("ãä¸ä¼ FTP失败ã======================"+e.getMessage()); |
| | | } |
| | | context.put("code", 0); |
| | | context.put("message", "ä¸ä¼ 失败"); |
| | | context.put("errno",0); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | |
| | | |
| | | public InputStream compressImg(InputStream is){ |
| | | try { |
| | | long originalFileSize = is.available(); |
| | | BufferedImage originalImage = ImageIO.read(is); |
| | | |
| | | double compressionRatio = Math.sqrt((double)originalFileSize / (200 * 1024.0)); |
| | | |
| | | if(compressionRatio >1){ |
| | | int compressedWidth = (int) (originalImage.getWidth() / compressionRatio); |
| | | int compressedHeight = (int) (originalImage.getHeight() / compressionRatio); |
| | | |
| | | BufferedImage compressedImage = new BufferedImage(compressedWidth, compressedHeight, BufferedImage.TYPE_INT_RGB); |
| | | Graphics2D graphics = compressedImage.createGraphics(); |
| | | graphics.drawImage(originalImage, 0, 0, compressedWidth, compressedHeight, null); |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | ImageOutputStream imOut = ImageIO.createImageOutputStream(byteArrayOutputStream); |
| | | ImageIO.write(compressedImage, "jpg", imOut); |
| | | InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); |
| | | graphics.dispose(); |
| | | return inputStream; |
| | | }else{ |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | ImageOutputStream imOut = ImageIO.createImageOutputStream(byteArrayOutputStream); |
| | | ImageIO.write(originalImage, "jpg", imOut); |
| | | InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); |
| | | return inputStream; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return is; |
| | | } |
| | | |
| | | |
| | | public void upload(HttpServletRequest request, HttpServletResponse response, String folder, String bucketName, |
| | | String access_id, String access_key, String resourcePath, String endpoint,Integer isFace) throws Exception { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | Map<String, Object> context = new HashMap<>(); |
| | | CommonsMultipartResolver multipartResovler = new CommonsMultipartResolver(); |
| | | if (multipartResovler.isMultipart(request)) { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | Iterator<String> it = multipartRequest.getFileNames(); |
| | | while (it.hasNext()) { |
| | | MultipartFile file = multipartRequest.getFile((String) it.next());// file |
| | | // multipartRequest.getFile((String) |
| | | // it.next()); |
| | | if (file != null) { |
| | | // 1ãä¸ä¼ å°æå¡å¨ä¸´æ¶æä»¶å¤¹ |
| | | String uploadFileName = file.getOriginalFilename(); |
| | | String originname = uploadFileName; |
| | | if (originname.lastIndexOf("/") >= 0) { |
| | | originname = originname.substring(originname.lastIndexOf("/") + 1); |
| | | } |
| | | String nfix = "";// åç¼å |
| | | if (StringUtils.isNotBlank(uploadFileName)) { |
| | | nfix = uploadFileName.substring(uploadFileName.lastIndexOf(".")); |
| | | } |
| | | if (StringUtils.equalsIgnoreCase(nfix, ".exe")) { |
| | | context.put("code", 4000); |
| | | context.put("message", "对ä¸èµ·ï¼æä»¶æ ¼å¼\".exe\"ä¸ä¼ æè¯¯ï¼"); |
| | | return; |
| | | } |
| | | if (StringUtils.equalsIgnoreCase(nfix, ".dll")) { |
| | | context.put("code", 4000); |
| | | context.put("message", "对ä¸èµ·ï¼æä»¶æ ¼å¼\".dll\"ä¸ä¼ æè¯¯ï¼"); |
| | | return; |
| | | } |
| | | String nowDate = DateUtil.getNowShortDate();// å½åæ¶é´ï¼å¹´ææ¥ï¼ |
| | | String fileName = UUID.randomUUID().toString() + nfix; |
| | | String tempFileName = nowDate + "/" + fileName; |
| | | String key = folder + tempFileName;// æä»¶å |
| | | ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key); |
| | | if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,null)) { |
| | | // ç§»å¨æå,è¿åæä»¶å |
| | | if(Objects.nonNull(isFace) && Constants.equalsInteger(isFace,Constants.ZERO)){ |
| | | //éªè¯äººè¸è¯å |
| | | //人è¸è¯å |
| | | FacePictureCheckRequest param = new FacePictureCheckRequest(); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode(); |
| | | param.setFacePicUrl(prefixUrl + key); |
| | | BaseResponse<FacePictureCheckResponse> responseBaseResponse = HKService.facePictureCheck(param); |
| | | if(responseBaseResponse == null || !StringUtils.equals(responseBaseResponse.getCode(), HKConstants.RESPONSE_SUCCEE)){ |
| | | context.put("code", 0); |
| | | context.put("message", "对ä¸èµ·ï¼äººè¸è¯åè·åæ°æ®å¤±è´¥~"); |
| | | context.put("errno",0); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | FacePictureCheckResponse facePictureCheckResponse = responseBaseResponse.getData(); |
| | | if(Objects.isNull(facePictureCheckResponse) || Objects.isNull(facePictureCheckResponse.getCheckResult())){ |
| | | context.put("code", 0); |
| | | context.put("message", "对ä¸èµ·ï¼äººè¸è¯åè·åæ°æ®å¤±è´¥~"); |
| | | context.put("errno",0); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | if(!facePictureCheckResponse.getCheckResult()){ |
| | | context.put("code", 0); |
| | | context.put("message", facePictureCheckResponse.getStatusMessage()); |
| | | context.put("errno",0); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | |
| | | context.put("success", true); |
| | | context.put("code", 200); |
| | | context.put("errno",0); |
| | | JSONObject fileJSON = new JSONObject(); |
| | | fileJSON.put("url", resourcePath + key); |
| | | fileJSON.put("imgaddr", tempFileName); |
| | | fileJSON.put("imgname", fileName); |
| | | fileJSON.put("originname", originname); |
| | | context.put("data",fileJSON); |
| | | context.put("message","è¯·æ±æå"); |
| | | writerJson(response, context); |
| | | return; |
| | | } else { |
| | | // ç§»å¨å¤±è´¥ |
| | | context.put("code", 0); |
| | | context.put("message", "ä¸ä¼ 失败"); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | context.put("code", 0); |
| | | context.put("message", "ä¸ä¼ 失败"); |
| | | context.put("errno",0); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | |
| | | public static void writerJson(HttpServletResponse response, Object object) { |
| | | response.setContentType("application/json"); |
| | | writer(response, JSONObject.toJSONString(object)); |
| | | } |
| | | |
| | | private static void writer(HttpServletResponse response, String str) { |
| | | try { |
| | | StringBuffer result = new StringBuffer(); |
| | | //设置页é¢ä¸ç¼å |
| | | response.setHeader("Pragma", "No-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | response.setCharacterEncoding("UTF-8"); |
| | | PrintWriter out = null; |
| | | out = response.getWriter(); |
| | | out.print(str); |
| | | out.flush(); |
| | | out.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public void uploadFileLocal(HttpServletRequest request, String folder, HttpServletResponse response, String rootPath,String dir) throws Exception { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | CommonsMultipartResolver multipartResovler = new CommonsMultipartResolver(); |
| | | Map<String, Object> context = new HashMap<>(); |
| | | if (multipartResovler.isMultipart(request)) { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | Iterator<String> it = multipartRequest.getFileNames(); |
| | | while (it.hasNext()) { |
| | | MultipartFile file = multipartRequest.getFile((String) it.next());// file |
| | | // = |
| | | // (CommonsMultipartFile) |
| | | // multipartRequest.getFile((String) |
| | | // it.next()); |
| | | if (file != null) { |
| | | if (file.getSize() > 200 * 1024 * 1024L) { |
| | | context.put("code", 4000); |
| | | context.put("message", "ä¸ä¼ æä»¶è¿å¤§"); |
| | | return; |
| | | } |
| | | System.out.println(file.getOriginalFilename()); |
| | | if (file.getOriginalFilename() == null) { |
| | | context.put("code", 4000); |
| | | context.put("message", "æä»¶åä¸å¯ä¸ºç©º"); |
| | | return; |
| | | } |
| | | /* |
| | | * if(file.getOriginalFilename().contains(",")||file.getOriginalFilename(). |
| | | * contains(" ")){ sendFailureMessage(response,"æä»¶åç§°æè¯¯,ä¸å¯å«æéå·çç¹æ®å符"); } |
| | | */ |
| | | |
| | | String nowDate = DateUtil.getNowShortDate(); |
| | | folder += nowDate + "/"; |
| | | String strDirPath = rootPath + folder; |
| | | File dirPath = new File(strDirPath); |
| | | if (!dirPath.exists()) { |
| | | dirPath.mkdirs(); |
| | | } |
| | | String uploadFileName = file.getOriginalFilename(); |
| | | String x = UUID.randomUUID().toString().replace("-", "") |
| | | + uploadFileName.substring(uploadFileName.lastIndexOf(".")); |
| | | String fileName = folder + x; |
| | | String fileNames = nowDate + "/" + x; |
| | | uploadFileName = uploadFileName.replace(" ", ""); |
| | | uploadFileName = uploadFileName.replace("ï¼", ","); |
| | | uploadFileName = uploadFileName.replaceAll(",", "-"); |
| | | System.err.println("R:" + fileName); |
| | | String fileAndPath = dir + fileName; |
| | | System.err.println("A:" + fileAndPath); |
| | | // 夿妿䏴æ¶ç®å½ä¸åå¨ç¸ååç§°çæä»¶å
å é¤ï¼å¨ä¸ä¼ |
| | | File tempFile = new File(rootPath + fileName); |
| | | if (tempFile.isFile() && tempFile.exists()) { |
| | | tempFile.getAbsoluteFile().delete(); |
| | | } |
| | | // ä¸ä¼ å°æå¡å¨ä¸´æ¶æä»¶å¤¹ |
| | | file.transferTo(tempFile); |
| | | // 转移å°FTPæå¡å¨ |
| | | String nfix = ""; |
| | | if (null != uploadFileName) { |
| | | nfix = uploadFileName.substring(uploadFileName.lastIndexOf(".")); |
| | | } |
| | | |
| | | if (StringUtils.equalsIgnoreCase(nfix, ".exe")) { |
| | | context.put("code", 4000); |
| | | context.put("message", "对ä¸èµ·ï¼æä»¶æ ¼å¼\".exe\"ä¸ä¼ æè¯¯ï¼"); |
| | | return; |
| | | } |
| | | if (StringUtils.equalsIgnoreCase(nfix, ".dll")) { |
| | | context.put("code", 4000); |
| | | context.put("message", "对ä¸èµ·ï¼æä»¶æ ¼å¼\".dll\"ä¸ä¼ æè¯¯ï¼"); |
| | | return; |
| | | } |
| | | |
| | | String remoteName = fileName; |
| | | String remoteFileName = fileAndPath; |
| | | |
| | | /* Map map = new HashMap(); |
| | | map.put("url", remoteFileName); |
| | | map.put("alt", uploadFileName); |
| | | map.put("href", remoteFileName); |
| | | List maps = Arrays.asList(remoteFileName);*/ |
| | | |
| | | if (true) { |
| | | // å
³éFTPæµ |
| | | // ç§»å¨æå,è¿åæä»¶å |
| | | |
| | | /*context.put("error", 0); |
| | | context.put("url", remoteFileName); |
| | | context.put("fullurl", remoteFileName); |
| | | context.put("fname", uploadFileName); |
| | | context.put("data", maps); |
| | | context.put("halfurl", fileNames);*/ |
| | | |
| | | context.put("success", true); |
| | | context.put("code", 200); |
| | | context.put("errno",0); |
| | | JSONObject fileJSON = new JSONObject(); |
| | | fileJSON.put("url", remoteFileName); |
| | | fileJSON.put("imgaddr", fileNames); |
| | | fileJSON.put("imgname", uploadFileName); |
| | | fileJSON.put("originname", uploadFileName); |
| | | context.put("data",fileJSON); |
| | | context.put("message","è¯·æ±æå"); |
| | | |
| | | writerJson(response, context); |
| | | return; |
| | | } else { |
| | | // ç§»å¨å¤±è´¥ |
| | | context.put("code", 0); |
| | | context.put("message", "ä¸ä¼ 失败"); |
| | | writerJson(response, context); |
| | | } |
| | | } |
| | | context.put("code", 0); |
| | | context.put("message", "ä¸ä¼ 失败"); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | } |
| | | context.put("code", 0); |
| | | context.put("message", "ä¸ä¼ 失败"); |
| | | writerJson(response, context); |
| | | return; |
| | | } |
| | | } |