예제 #1
0
  /**
   * 2.4 头像上传
   *
   * @return 上传结果
   */
  @RequestMapping(
      value = "/avatar/upload",
      method = RequestMethod.POST,
      headers = "Content-Type=multipart/form-data")
  public ResponseDo uploadUserPhoto(@RequestParam("attach") MultipartFile attach) {
    LOG.info("uploadAvatarPhoto attach size: {}", attach.getSize());

    try {
      return service.uploadUserPhoto(attach);
    } catch (ApiException e) {
      LOG.warn(e.getMessage(), e);
      return ResponseDo.buildFailureResponse("上传文件失败");
    }
  }