diff --git a/README.md b/README.md
index efacb280..5f595df3 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,12 @@ docker-compose up -d
16. 网易云音乐歌单收藏
17. b站收藏获取,通知失效视频
+## 后台管理功能
+1. 签到
+2. 签到日志查询
+3. 随机music
+4. 歌单歌曲
+
## 启用所有功能
1. 添加配置文件(~/.api/目录下) application.yml
2. 下载application-template.yml 并修改文件名为application-default.yml
diff --git a/pom.xml b/pom.xml
index a3f11cff..b4ab3430 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,19 +5,19 @@
org.springframework.boot
spring-boot-starter-parent
- 3.3.3
+ 3.3.4
com.bingchunmoli
moliapi
- 3.15.8
+ 3.15.9
MoLiApi
MoLiApi
17
- 3.5.7
+ 3.5.8
1.4.13
5.8.32
3.5.3
@@ -25,10 +25,10 @@
2.3.232
2.2.0
4.5.0
- 3.1.1069
+ 3.1.1114
2.0.20
9.3.0
- 1.5.1
+ 1.5.2
@@ -120,24 +120,6 @@
tencentcloud-sdk-java-cdn
${tencent-cloud-api.version}
-
- com.fasterxml.jackson.module
- jackson-module-kotlin
-
-
- org.jetbrains.kotlin
- kotlin-reflect
-
-
- org.jetbrains.kotlin
- kotlin-stdlib-jdk8
-
-
- org.jetbrains.kotlin
- kotlin-test
- ${kotlin.version}
- test
-
org.springframework
spring-context-indexer
@@ -217,50 +199,6 @@
-
- org.jetbrains.kotlin
- kotlin-maven-plugin
- ${kotlin.version}
-
-
- compile
- process-sources
-
- compile
-
-
-
- test-compile
- test-compile
-
- test-compile
-
-
-
-
- 1.8
- -Xjsr305=strict
-
- lombok
- spring
-
-
-
-
-
-
-
- org.jetbrains.kotlin
- kotlin-maven-allopen
- ${kotlin.version}
-
-
- org.jetbrains.kotlin
- kotlin-maven-lombok
- ${kotlin.version}
-
-
-
diff --git a/src/main/java/com/bingchunmoli/api/down/init/DownloadCommandLineRunner.java b/src/main/java/com/bingchunmoli/api/down/init/DownloadCommandLineRunner.java
index e6a48fa8..94be89f9 100644
--- a/src/main/java/com/bingchunmoli/api/down/init/DownloadCommandLineRunner.java
+++ b/src/main/java/com/bingchunmoli/api/down/init/DownloadCommandLineRunner.java
@@ -6,6 +6,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
+import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import java.util.Locale;
@@ -20,6 +21,7 @@
*/
@Slf4j
@Component
+@Profile("prod")
@RequiredArgsConstructor
public class DownloadCommandLineRunner implements CommandLineRunner {
//备用
diff --git a/src/main/java/com/bingchunmoli/api/listener/MessageEvenListener.java b/src/main/java/com/bingchunmoli/api/listener/MessageEvenListener.java
index ab0e6c95..146e7471 100644
--- a/src/main/java/com/bingchunmoli/api/listener/MessageEvenListener.java
+++ b/src/main/java/com/bingchunmoli/api/listener/MessageEvenListener.java
@@ -9,6 +9,7 @@
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.context.ApplicationListener;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Collection;
@@ -25,6 +26,7 @@ public MessageEvenListener(Map map, PushLogService pushLogService)
this.pushLogService = pushLogService;
}
+ @Async
@Override
public void onApplicationEvent(@NotNull MessageEven event) {
Message message = event.getMessage();
diff --git a/src/main/java/com/bingchunmoli/api/netease/MusicController.java b/src/main/java/com/bingchunmoli/api/netease/MusicController.java
index 67e9fa70..22ec10b8 100644
--- a/src/main/java/com/bingchunmoli/api/netease/MusicController.java
+++ b/src/main/java/com/bingchunmoli/api/netease/MusicController.java
@@ -1,14 +1,21 @@
package com.bingchunmoli.api.netease;
import com.bingchunmoli.api.bean.ResultVO;
+import com.bingchunmoli.api.netease.bean.NeteaseMusicSongVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
+import org.springframework.http.CacheControl;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.net.URI;
+import java.util.List;
+
@RestController
@Tag(name = "音乐")
@RequestMapping("music")
@@ -22,8 +29,26 @@ public PlayListBO getPlayListInfo(String id, String cookie){
return musicService.getPlayListInfo(id, cookie);
}
+ /**
+ * 获取歌单中歌曲列表
+ * @param id 歌单id
+ * @return 该格党的music
+ */
@GetMapping("{id}")
- public ResultVO getMusicLink(@PathVariable String id){
- return ResultVO.ok("https://music.163.com/api/playlist/detail?id=" + id + "&offset=0&total=true&limit=1001");
+ public ResultVO> getMusicLink(@PathVariable String id){
+ return ResultVO.ok(musicService.getMusicSongList(id));
+ }
+
+ /**
+ * 获取随机歌曲
+ * @return
+ */
+ @GetMapping("random")
+ public ResponseEntity> getRandomMusicLink(){
+ String url = "https://music.163.com/song/media/outer/url?id=" + musicService.getRandomMusicId() + ".mp3";
+ return ResponseEntity.status(HttpStatus.FOUND)
+ .cacheControl(CacheControl.noStore())
+ .location(URI.create(url))
+ .body(ResultVO.ok(url));
}
}
diff --git a/src/main/java/com/bingchunmoli/api/netease/MusicService.java b/src/main/java/com/bingchunmoli/api/netease/MusicService.java
index 81590976..e4ebfb82 100644
--- a/src/main/java/com/bingchunmoli/api/netease/MusicService.java
+++ b/src/main/java/com/bingchunmoli/api/netease/MusicService.java
@@ -2,17 +2,14 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bingchunmoli.api.config.ApiConfig;
-import com.bingchunmoli.api.netease.bean.NeteaseMusicAlbum;
-import com.bingchunmoli.api.netease.bean.NeteaseMusicPlaylist;
-import com.bingchunmoli.api.netease.bean.NeteaseMusicSong;
-import com.bingchunmoli.api.netease.bean.NeteaseMusicUser;
+import com.bingchunmoli.api.netease.bean.*;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
-import org.apache.http.client.config.CookieSpecs;
-import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
@@ -48,18 +45,27 @@ public class MusicService {
* @param cookie cookie
* @return 歌单实体
*/
- public PlayListBO getPlayListInfo(String id, String cookie){
- Collection defaultHeader = List.of(new BasicHeader("cookie", cookie));
+ public PlayListBO getPlayListInfo(@Valid @NotBlank String id, String cookie){
+ Collection defaultHeader = List.of(new BasicHeader("cookie", cookie),
+ new BasicHeader("referer", "https://music.163.com/"),
+ new BasicHeader("accept", "*/*"),
+ new BasicHeader("accept-language", "zh,zh-US;q=0.9,zh-SG;q=0.8,en-SG;q=0.7,en;q=0.6,zh-CN;q=0.5"),
+ new BasicHeader("pragma", "no-cache"),
+ new BasicHeader("sec-fetch-dest", "script"),
+ new BasicHeader("sec-fetch-mode", "no-cors"),
+ new BasicHeader("sec-fetch-site", "same-site"),
+ new BasicHeader("sec-ch-ua", "\n" +
+ "\"Google Chrome\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\""),
+ new BasicHeader("sec-ch-ua-platform", "\"windows\""),
+ new BasicHeader("origin", "https://music.163.com/"),
+ new BasicHeader("sec-ch-ua-mobile", "?0"));
try (CloseableHttpClient httpClient = HttpClientBuilder.create()
.setDefaultHeaders(defaultHeader)
- .setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36")
- .setDefaultRequestConfig(RequestConfig.custom()
- .setCookieSpec(CookieSpecs.STANDARD).build())
+ .setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36")
.build()){
HttpRequest request = new HttpGet( "/api/playlist/detail?id=" + id);
return httpClient.execute(baseHost, request, res -> {
String string = EntityUtils.toString(res.getEntity());
- EntityUtils.consume(res.getEntity());
return om.readValue(string, PlayListBO.class);
});
} catch (Exception e) {
@@ -113,11 +119,15 @@ public void savePlayList() {
.name(album.getName())
.picUrl(album.getPicUrl())
.type(album.getType())
+ .userId(album.getArtist().getId())
.publishTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(album.getPublishTime()), ZoneId.systemDefault())).build();
NeteaseMusicAlbum dbAlbum = albumService.getOne(new LambdaQueryWrapper()
.eq(NeteaseMusicAlbum::getThirdId, musicAlbum.getThirdId()));
if (dbAlbum == null) {
albumService.save(musicAlbum);
+ }else {
+ musicAlbum.setId(dbAlbum.getId());
+ albumService.updateById(musicAlbum);
}
List artists = track.getArtists();
List musicUserList = new ArrayList<>(artists.size());
@@ -134,6 +144,7 @@ public void savePlayList() {
.thirdId(Long.valueOf(track.getId()))
.albumId(musicAlbum.getId())
.artists(musicUserList)
+ .playlistId(musicPlaylist.getId())
.build();
songs.add(song);
}
@@ -144,4 +155,12 @@ public void savePlayList() {
throw new RuntimeException(e);
}
}
+
+ public String getRandomMusicId() {
+ return String.valueOf(songService.getRandomSong().getThirdId());
+ }
+
+ public List getMusicSongList(String id) {
+ return songService.getMusicSongList(id);
+ }
}
diff --git a/src/main/java/com/bingchunmoli/api/netease/NeteaseMusicSongService.java b/src/main/java/com/bingchunmoli/api/netease/NeteaseMusicSongService.java
index 9b7e43ca..a15cc357 100644
--- a/src/main/java/com/bingchunmoli/api/netease/NeteaseMusicSongService.java
+++ b/src/main/java/com/bingchunmoli/api/netease/NeteaseMusicSongService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.bingchunmoli.api.netease.bean.NeteaseMusicSong;
+import com.bingchunmoli.api.netease.bean.NeteaseMusicSongVO;
import java.util.List;
@@ -11,4 +12,17 @@
public interface NeteaseMusicSongService extends IService {
void saveBatchAndChild(List songs);
+
+ /**
+ * 获取随机歌曲
+ * @return 一首歌曲
+ */
+ NeteaseMusicSong getRandomSong();
+
+ /**
+ * 获取歌曲和专辑图片
+ * @param id 歌单id
+ * @return
+ */
+ List getMusicSongList(String id);
}
diff --git a/src/main/java/com/bingchunmoli/api/netease/NeteaseMusicSongServiceImpl.java b/src/main/java/com/bingchunmoli/api/netease/NeteaseMusicSongServiceImpl.java
index 5235d377..0a49eff3 100644
--- a/src/main/java/com/bingchunmoli/api/netease/NeteaseMusicSongServiceImpl.java
+++ b/src/main/java/com/bingchunmoli/api/netease/NeteaseMusicSongServiceImpl.java
@@ -1,16 +1,17 @@
package com.bingchunmoli.api.netease;
+import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bingchunmoli.api.netease.bean.NeteaseMusicSong;
+import com.bingchunmoli.api.netease.bean.NeteaseMusicSongVO;
import com.bingchunmoli.api.netease.mapper.NeteaseMusicSongMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.aop.framework.AopContext;
import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
import java.util.List;
-import java.util.Objects;
+import java.util.stream.Collectors;
/**
* @author MoLi
@@ -21,7 +22,6 @@ public class NeteaseMusicSongServiceImpl extends ServiceImpl songs) {
if (songs == null || songs.isEmpty()) {
return;
@@ -35,23 +35,26 @@ public void saveBatchAndChild(List songs) {
getBaseMapper().saveSongUser(song.getId(), userIds);
}
}else {
- List list = songs.stream().filter(v -> {
- for (NeteaseMusicSong song : dbSongs) {
- if (Objects.equals(song.getId(), v.getId())) {
- return false;
- }
- }
- return true;
- }).toList();
- for (NeteaseMusicSong song : list) {
+ ((NeteaseMusicSongService) AopContext.currentProxy()).updateBatchById(songs.stream().filter(v -> v.getId() != null).collect(Collectors.toList()));
+ ((NeteaseMusicSongService) AopContext.currentProxy()).saveBatch(songs.stream().filter(v -> v.getId() == null).collect(Collectors.toList()));
+ for (NeteaseMusicSong song : songs) {
List userIds = neteaseMusicUserService.getIdBatch(song.getArtists());
- getBaseMapper().saveSongUser(song.getId(), userIds);
+ List alreadyExistsUserIds = getBaseMapper().getSongUser(song.getId());
+ List saveUserIds = alreadyExistsUserIds.stream().filter(v -> !userIds.contains(v)).toList();
+ if (CollUtil.isNotEmpty(saveUserIds)) {
+ getBaseMapper().saveSongUser(song.getId(), saveUserIds);
+ }
}
}
-
}
-}
-
-
+ @Override
+ public NeteaseMusicSong getRandomSong() {
+ return getBaseMapper().selectRandomSong();
+ }
+ @Override
+ public List getMusicSongList(String id) {
+ return getBaseMapper().getMusicSongList(id);
+ }
+}
diff --git a/src/main/java/com/bingchunmoli/api/netease/bean/NeteaseMusicSong.java b/src/main/java/com/bingchunmoli/api/netease/bean/NeteaseMusicSong.java
index 2e0f823f..2d11b07f 100644
--- a/src/main/java/com/bingchunmoli/api/netease/bean/NeteaseMusicSong.java
+++ b/src/main/java/com/bingchunmoli/api/netease/bean/NeteaseMusicSong.java
@@ -4,8 +4,10 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
+import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
@@ -17,6 +19,8 @@
@Data
@Builder
+@NoArgsConstructor
+@AllArgsConstructor
@TableName(value ="netease_music_song")
public class NeteaseMusicSong implements Serializable {
/**
@@ -43,6 +47,12 @@ public class NeteaseMusicSong implements Serializable {
@TableField(value = "album_id")
private Integer albumId;
+ /**
+ * 歌单id
+ */
+ @TableField("playlist_id")
+ private Integer playlistId;
+
@TableField(exist = false)
private List artists;
diff --git a/src/main/java/com/bingchunmoli/api/netease/bean/NeteaseMusicSongVO.java b/src/main/java/com/bingchunmoli/api/netease/bean/NeteaseMusicSongVO.java
new file mode 100644
index 00000000..493c79f3
--- /dev/null
+++ b/src/main/java/com/bingchunmoli/api/netease/bean/NeteaseMusicSongVO.java
@@ -0,0 +1,33 @@
+package com.bingchunmoli.api.netease.bean;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author moli
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class NeteaseMusicSongVO extends NeteaseMusicSong{
+ /**
+ * 专辑图片
+ */
+ private String picUrl;
+
+ /**
+ * 专辑发布时间
+ */
+ private LocalDateTime publishTime;
+
+ /**
+ * 类型
+ */
+ private String type;
+
+ /**
+ * 艺术家
+ */
+ private String nickname;
+}
diff --git a/src/main/java/com/bingchunmoli/api/netease/mapper/NeteaseMusicSongMapper.java b/src/main/java/com/bingchunmoli/api/netease/mapper/NeteaseMusicSongMapper.java
index b744e690..2d0cfb7c 100644
--- a/src/main/java/com/bingchunmoli/api/netease/mapper/NeteaseMusicSongMapper.java
+++ b/src/main/java/com/bingchunmoli/api/netease/mapper/NeteaseMusicSongMapper.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bingchunmoli.api.netease.bean.NeteaseMusicSong;
+import com.bingchunmoli.api.netease.bean.NeteaseMusicSongVO;
import java.util.List;
@@ -11,8 +12,21 @@
public interface NeteaseMusicSongMapper extends BaseMapper {
void saveSongUser(Integer songId, List userIds);
-}
+ /**
+ * 随机一首歌
+ * @return 歌曲信息
+ */
+ NeteaseMusicSong selectRandomSong();
+ /**
+ * 获取该歌单的用户
+ * @param id
+ * @return
+ */
+ List getSongUser(Integer id);
+ List getMusicSongList(String id);
+ String getNickname(String userId);
+}
diff --git a/src/main/java/com/bingchunmoli/api/weather/bean/WeatherSubscribeParam.java b/src/main/java/com/bingchunmoli/api/weather/bean/WeatherSubscribeParam.java
new file mode 100644
index 00000000..efbfdb73
--- /dev/null
+++ b/src/main/java/com/bingchunmoli/api/weather/bean/WeatherSubscribeParam.java
@@ -0,0 +1,12 @@
+package com.bingchunmoli.api.weather.bean;
+
+import jakarta.validation.constraints.Email;
+import lombok.Data;
+
+@Data
+public class WeatherSubscribeParam {
+ @Email
+ private String email;
+
+ private String location;
+}
diff --git a/src/main/java/com/bingchunmoli/api/weather/bean/WeatherSubscribeParam.kt b/src/main/java/com/bingchunmoli/api/weather/bean/WeatherSubscribeParam.kt
deleted file mode 100644
index 979df1f7..00000000
--- a/src/main/java/com/bingchunmoli/api/weather/bean/WeatherSubscribeParam.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.bingchunmoli.api.weather.bean
-
-import jakarta.validation.constraints.Email
-
-data class WeatherSubscribeParam (@Email val email: String, val location: String)
-
diff --git a/src/main/java/com/bingchunmoli/api/weather/bean/enums/Code.kt b/src/main/java/com/bingchunmoli/api/weather/bean/enums/Code.java
similarity index 79%
rename from src/main/java/com/bingchunmoli/api/weather/bean/enums/Code.kt
rename to src/main/java/com/bingchunmoli/api/weather/bean/enums/Code.java
index 65522870..d02b71ab 100644
--- a/src/main/java/com/bingchunmoli/api/weather/bean/enums/Code.kt
+++ b/src/main/java/com/bingchunmoli/api/weather/bean/enums/Code.java
@@ -1,9 +1,14 @@
-package com.bingchunmoli.api.weather.bean.enums
+package com.bingchunmoli.api.weather.bean.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
/**
* @author bingchunmoli
*/
-enum class Code (val code: String, val text: String){
+@Getter
+@AllArgsConstructor
+public enum Code {
/**
* 和风天气code枚举
*/
@@ -17,4 +22,6 @@ enum class Code (val code: String, val text: String){
TOO_FAST("429", "超过限定的QPM(每分钟访问次数)"),
INTERNET("500", "无响应或超时");
-}
\ No newline at end of file
+ private final String code;
+ private final String text;
+}
diff --git a/src/main/java/com/bingchunmoli/api/yiyan/mapper/YiYanMapper.java b/src/main/java/com/bingchunmoli/api/yiyan/mapper/YiYanMapper.java
index 2f0c02fe..5ab2cb4f 100644
--- a/src/main/java/com/bingchunmoli/api/yiyan/mapper/YiYanMapper.java
+++ b/src/main/java/com/bingchunmoli/api/yiyan/mapper/YiYanMapper.java
@@ -16,6 +16,6 @@ public interface YiYanMapper extends BaseMapper {
* randomYiYan
* @return yiyan
*/
- @Select("SELECT * FROM yi_yan as t1 WHERE t1.id>=(RAND()*(SELECT MAX(id) FROM yi_yan))LIMIT 1")
+ @Select("SELECT * FROM yi_yan as t1 WHERE t1.id>=(RAND()*(SELECT MAX(id) FROM yi_yan)) LIMIT 1")
YiYan findRandom();
}
diff --git a/src/main/kotlin/com/bingchunmoli/api/utils/LogUtil.kt b/src/main/kotlin/com/bingchunmoli/api/utils/LogUtil.kt
deleted file mode 100644
index 1d553e35..00000000
--- a/src/main/kotlin/com/bingchunmoli/api/utils/LogUtil.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.bingchunmoli.api.utils
-
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
-import java.util.concurrent.ConcurrentHashMap
-import java.util.concurrent.ConcurrentMap
-
-object LogUtil {
- private val logger: ConcurrentMap, Logger> = ConcurrentHashMap()
-
- val Any.log: Logger
- get() {
- return logger.getOrPut(this::class.java) {
- LoggerFactory.getLogger(this::class.java)
- }
- }
-
- fun trace(str: String, vararg arg: Any?){
- if (log.isTraceEnabled) {
- log.trace(str, arg)
- }
- }
-
- fun debug(str: String, vararg arg: Any?){
- if (log.isDebugEnabled) {
- log.debug(str, arg)
- }
- }
-
- fun info(str: String, vararg arg: Any?){
- if (log.isInfoEnabled) {
- log.info(str, arg)
- }
- }
-
- fun warn(str: String, vararg arg: Any?){
- if (log.isErrorEnabled) {
- log.warn(str, arg)
- }
- }
-
- fun error(str: String, vararg arg: Any?){
- if (log.isErrorEnabled) {
- log.error(str, arg)
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 6b41639e..980912db 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,9 +1,10 @@
moli:
version: @version@
- path: ${user.home}
+ path: ${user.home}/
init:
sql-path: classpath:/init/db/init.sql
- yi-yan-json-path: init/data/
+ yi-yan-json-path: classpath:/init/data/
+ yiYanJsonPath: classpath:/init/data/
apiConfig:
weather-key: #开发版和风天气的key(商业版需要更换weatherUri和weatherGeoUri到商业版域名)
weather-uri: devapi.qweather.com
diff --git a/src/main/resources/config/logback-spring.xml b/src/main/resources/config/logback-spring.xml
index ee6020ed..32465d33 100644
--- a/src/main/resources/config/logback-spring.xml
+++ b/src/main/resources/config/logback-spring.xml
@@ -141,9 +141,10 @@
-
-
+
+
+
diff --git a/src/main/resources/init/db/ddl.sql b/src/main/resources/init/db/ddl.sql
index 094ccc93..2462e84e 100644
--- a/src/main/resources/init/db/ddl.sql
+++ b/src/main/resources/init/db/ddl.sql
@@ -144,6 +144,7 @@ CREATE TABLE IF NOT EXISTS netease_music_song
third_id bigint null,
name varchar(50) NOT NULL,
album_id int null comment '专辑Id',
+ playlist_id int null comment '歌单id',
CONSTRAINT netease_music_music_PK PRIMARY KEY (id)
) COMMENT ='歌曲';
diff --git a/src/main/resources/init/db/init.sql b/src/main/resources/init/db/init.sql
index 7e06f12b..be8c7d76 100644
--- a/src/main/resources/init/db/init.sql
+++ b/src/main/resources/init/db/init.sql
@@ -146,6 +146,7 @@ CREATE TABLE IF NOT EXISTS netease_music_song
third_id bigint null,
name varchar(50) NOT NULL,
album_id int null comment '专辑Id',
+ playlist_id int null comment '歌单id',
CONSTRAINT netease_music_music_PK PRIMARY KEY (id)
) COMMENT ='歌曲';
diff --git a/src/main/resources/mapper/NeteaseMusicSongMapper.xml b/src/main/resources/mapper/NeteaseMusicSongMapper.xml
index 9934f5ae..90e8a985 100644
--- a/src/main/resources/mapper/NeteaseMusicSongMapper.xml
+++ b/src/main/resources/mapper/NeteaseMusicSongMapper.xml
@@ -5,12 +5,23 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
id,third_id,`name`,album_id
@@ -18,6 +29,30 @@
insert into netease_music_song_user(user_id, song_id) values
(${item}, ${songId})
-
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/static/pwa.js b/src/main/resources/static/pwa.js
index f1c39281..0787ca15 100644
--- a/src/main/resources/static/pwa.js
+++ b/src/main/resources/static/pwa.js
@@ -54,7 +54,7 @@ self.addEventListener('activate', event => {
*/
self.addEventListener('fetch', event => {
// Skip some of cross-origin requests, like those for Google Analytics.
- if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
+ if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1 && event.request.method.toUpperCase() === 'GET') {
// Stale-while-revalidate
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
diff --git a/src/main/vue/admin/index.html b/src/main/vue/admin/index.html
index d97d9ef5..ae4f7bd9 100644
--- a/src/main/vue/admin/index.html
+++ b/src/main/vue/admin/index.html
@@ -8,6 +8,7 @@
+