Ejemplo n.º 1
0
 /** 功能:修改图片 */
 @ResponseBody
 @RequestMapping(value = "/upLoadImages", method = RequestMethod.POST)
 public ResultMsg upLoadImages(String id2, @RequestParam MultipartFile[] images2, String gid)
     throws Exception {
   ResultMsg result = new ResultMsg();
   result.setResultMessage("errors");
   MusicBg music = new MusicBg();
   if (images2 != null && images2.length > 0) {
     for (MultipartFile $file : images2) {
       if (!$file.isEmpty()) {
         String name = $file.getOriginalFilename();
         String ext = name.substring(name.lastIndexOf("."), name.length());
         String sha1 = DigestUtils.shaHex($file.getInputStream());
         String fileName = sha1 + ext;
         String path =
             Constants.DEFAULT_UPLOADIMAGEPATH + File.separator + Constants.sha1ToPath(sha1);
         Constants.mkdirs(path);
         FileUtils.copyInputStreamToFile($file.getInputStream(), new File(path, fileName));
         music.setImageSha1(sha1);
         music.setImage(fileName);
       }
     }
   }
   music.setId(id2);
   if (this.musicBgService.addMusicBg(music, gid)) {
     result.setResultMessage("success");
   }
   return result;
 }
Ejemplo n.º 2
0
 /** 功能:删除 */
 @ResponseBody
 @RequestMapping(value = "/delete", method = RequestMethod.GET)
 public ResultMsg delete(String id, String gid) {
   ResultMsg result = new ResultMsg();
   result.setResultMessage("errors");
   if (this.musicBgService.deleteMusicBg(id)) {
     result.setResultMessage("success");
   }
   return result;
 }
Ejemplo n.º 3
0
 /** 功能:上下线 */
 @ResponseBody
 @RequestMapping(value = "/online", method = RequestMethod.GET)
 public ResultMsg online(String id) {
   ResultMsg result = new ResultMsg();
   result.setResultMessage("errors");
   if (this.musicBgService.onLineMusicBg(id)) {
     result.setResultStatus(200);
     result.setResultMessage("success");
   }
   return result;
 }