Compare commits
7 Commits
v3.0.2-nat
...
v3.0.6-nat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2929e0d1c0 | ||
|
|
02f9c7afdf | ||
|
|
89ebf65b7d | ||
|
|
693939af54 | ||
| 2b9ec9e2be | |||
|
|
3352d7efc1 | ||
|
|
1118fa6b26 |
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
1
.idea/.gitignore
generated
vendored
1
.idea/.gitignore
generated
vendored
@@ -8,3 +8,4 @@
|
|||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
# 基于编辑器的 HTTP 客户端请求
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
/httpRequests/
|
/httpRequests/
|
||||||
|
/.idea/
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ metadata:
|
|||||||
app: $APP_NAME
|
app: $APP_NAME
|
||||||
version: $APP_TAG
|
version: $APP_TAG
|
||||||
name: $APP_NAME
|
name: $APP_NAME
|
||||||
namespace: dl-proj #一定要写名称空间
|
namespace: default #一定要写名称空间
|
||||||
spec:
|
spec:
|
||||||
progressDeadlineSeconds: 600
|
progressDeadlineSeconds: 600
|
||||||
replicas: 1
|
replicas: 1
|
||||||
@@ -33,7 +33,7 @@ spec:
|
|||||||
livenessProbe: # 存活探针:失败意味着应用彻底挂了,需要重启来恢复
|
livenessProbe: # 存活探针:失败意味着应用彻底挂了,需要重启来恢复
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /test
|
path: /test
|
||||||
port: 9090
|
port: 13145
|
||||||
initialDelaySeconds: 10 # 延迟xx秒开始执行
|
initialDelaySeconds: 10 # 延迟xx秒开始执行
|
||||||
periodSeconds: 15 # 每隔15秒执行一次
|
periodSeconds: 15 # 每隔15秒执行一次
|
||||||
timeoutSeconds: 10 # 10秒未返回结果则超时
|
timeoutSeconds: 10 # 10秒未返回结果则超时
|
||||||
@@ -57,7 +57,7 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: $APP_NAME
|
app: $APP_NAME
|
||||||
name: $APP_NAME
|
name: $APP_NAME
|
||||||
namespace: dl-proj
|
namespace: default
|
||||||
spec:
|
spec:
|
||||||
type: NodePort
|
type: NodePort
|
||||||
externalTrafficPolicy: Local
|
externalTrafficPolicy: Local
|
||||||
@@ -65,6 +65,6 @@ spec:
|
|||||||
- name: http
|
- name: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
port: 13145
|
port: 13145
|
||||||
nodePort: 13145
|
nodePort: 30045
|
||||||
selector:
|
selector:
|
||||||
app: $APP_NAME
|
app: $APP_NAME
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.bamanker.dailylove.service.DataRemoteClient;
|
|||||||
import com.bamanker.dailylove.service.WechatRequestClient;
|
import com.bamanker.dailylove.service.WechatRequestClient;
|
||||||
import com.bamanker.dailylove.utils.DataUtils;
|
import com.bamanker.dailylove.utils.DataUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.aot.hint.annotation.RegisterReflectionForBinding;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ public class PushDailyController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pushNight")
|
@GetMapping("/pushNight")
|
||||||
|
@RegisterReflectionForBinding(Weather.class)
|
||||||
public String pushNight() {
|
public String pushNight() {
|
||||||
|
|
||||||
ResultVo resultVo = ResultVo.initializeResultVo(DailyLoveConfigure.Open_ID,
|
ResultVo resultVo = ResultVo.initializeResultVo(DailyLoveConfigure.Open_ID,
|
||||||
@@ -54,8 +56,8 @@ public class PushDailyController {
|
|||||||
param1.setCity(DailyLoveConfigure.City_ID);
|
param1.setCity(DailyLoveConfigure.City_ID);
|
||||||
param1.setType("7");
|
param1.setType("7");
|
||||||
String weatherResp = dataRemoteClient.getWeather(param1);
|
String weatherResp = dataRemoteClient.getWeather(param1);
|
||||||
JsonNode weatherJson = mapper.readTree(weatherResp).get("result").get(0).get("list").get(1);
|
JsonNode weatherJson = mapper.readTree(weatherResp).get("result").get("list").get(1);
|
||||||
String city = mapper.readTree(weatherResp).get("result").get(0).get("area").asString();
|
String city = mapper.readTree(weatherResp).get("result").get("area").asString();
|
||||||
// JSONObject weatherJson1 = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).getJSONArray("list").getJSONObject(1);
|
// JSONObject weatherJson1 = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).getJSONArray("list").getJSONObject(1);
|
||||||
// String city1 = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).getString("area");
|
// String city1 = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).getString("area");
|
||||||
Weather weather = mapper.treeToValue(weatherJson, Weather.class);
|
Weather weather = mapper.treeToValue(weatherJson, Weather.class);
|
||||||
@@ -72,17 +74,17 @@ public class PushDailyController {
|
|||||||
param2.setKey(DailyLoveConfigure.TianXin_Key);
|
param2.setKey(DailyLoveConfigure.TianXin_Key);
|
||||||
|
|
||||||
String tipsResp = dataRemoteClient.getTips(param2);
|
String tipsResp = dataRemoteClient.getTips(param2);
|
||||||
String tips = mapper.readTree(tipsResp).get("result").get(0).get("content").asString();
|
String tips = mapper.readTree(tipsResp).get("result").get("content").asString();
|
||||||
// String tips1 = JSONObject.parseObject(tipsResp).getJSONArray("result").getJSONObject(0).getString("content");
|
// String tips1 = JSONObject.parseObject(tipsResp).getJSONArray("result").getJSONObject(0).getString("content");
|
||||||
resultVo.setAttribute("tips", new DataItem(tips, DailyLoveConfigure.Color_tips));
|
resultVo.setAttribute("tips", new DataItem(tips, DailyLoveConfigure.Color_tips));
|
||||||
|
|
||||||
String nightResp = dataRemoteClient.getNight(param2);
|
String nightResp = dataRemoteClient.getNight(param2);
|
||||||
String night = mapper.readTree(nightResp).get("result").get(0).get("content").asString();
|
String night = mapper.readTree(nightResp).get("result").get("content").asString();
|
||||||
// String night1 = JSONObject.parseObject(nightResp).getJSONArray("result").getJSONObject(0).getString("content");
|
// String night1 = JSONObject.parseObject(nightResp).getJSONArray("result").getJSONObject(0).getString("content");
|
||||||
resultVo.setAttribute("night", new DataItem(night, DailyLoveConfigure.Color_night));
|
resultVo.setAttribute("night", new DataItem(night, DailyLoveConfigure.Color_night));
|
||||||
|
|
||||||
String rainbowResp = dataRemoteClient.getRainbow(param2);
|
String rainbowResp = dataRemoteClient.getRainbow(param2);
|
||||||
String rainbow = mapper.readTree(rainbowResp).get("result").get(0).get("content").asString();
|
String rainbow = mapper.readTree(rainbowResp).get("result").get("content").asString();
|
||||||
// String rainbow1 = JSONObject.parseObject(rainbowResp).getJSONArray("result").getJSONObject(0).getString("content");
|
// String rainbow1 = JSONObject.parseObject(rainbowResp).getJSONArray("result").getJSONObject(0).getString("content");
|
||||||
resultVo.setAttribute("rainbow", new DataItem(rainbow, DailyLoveConfigure.Color_dailyCn));
|
resultVo.setAttribute("rainbow", new DataItem(rainbow, DailyLoveConfigure.Color_dailyCn));
|
||||||
|
|
||||||
@@ -147,6 +149,7 @@ public class PushDailyController {
|
|||||||
* 推送早安
|
* 推送早安
|
||||||
*/
|
*/
|
||||||
@GetMapping("/pushMorning")
|
@GetMapping("/pushMorning")
|
||||||
|
@RegisterReflectionForBinding(Weather.class)
|
||||||
public String pushMorning() {
|
public String pushMorning() {
|
||||||
|
|
||||||
TianXinReqParam param1 = new TianXinReqParam();
|
TianXinReqParam param1 = new TianXinReqParam();
|
||||||
@@ -154,7 +157,7 @@ public class PushDailyController {
|
|||||||
param1.setCity(DailyLoveConfigure.City_ID);
|
param1.setCity(DailyLoveConfigure.City_ID);
|
||||||
param1.setType("1");
|
param1.setType("1");
|
||||||
String weatherResp = dataRemoteClient.getWeather(param1);
|
String weatherResp = dataRemoteClient.getWeather(param1);
|
||||||
JsonNode weatherJson = mapper.readTree(weatherResp).get("result").get(0);
|
JsonNode weatherJson = mapper.readTree(weatherResp).get("result");
|
||||||
Weather weather = mapper.treeToValue(weatherJson, Weather.class);
|
Weather weather = mapper.treeToValue(weatherJson, Weather.class);
|
||||||
|
|
||||||
// Weather weather1 = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).toJavaObject(Weather.class);
|
// Weather weather1 = JSONObject.parseObject(weatherResp).getJSONArray("result").getJSONObject(0).toJavaObject(Weather.class);
|
||||||
@@ -179,12 +182,12 @@ public class PushDailyController {
|
|||||||
// resultVo.setAttribute("tips", new DataItem(tips, DailyLoveConfigure.Color_tips));
|
// resultVo.setAttribute("tips", new DataItem(tips, DailyLoveConfigure.Color_tips));
|
||||||
|
|
||||||
String morningResp = dataRemoteClient.getMorning(param2);
|
String morningResp = dataRemoteClient.getMorning(param2);
|
||||||
String morning = mapper.readTree(morningResp).get("result").get(0).get("content").asString();
|
String morning = mapper.readTree(morningResp).get("result").get("content").asString();
|
||||||
// String morning1 = JSONObject.parseObject(morningResp).getJSONArray("result").getJSONObject(0).getString("content");
|
// String morning1 = JSONObject.parseObject(morningResp).getJSONArray("result").getJSONObject(0).getString("content");
|
||||||
resultVo.setAttribute("morning", new DataItem(morning, DailyLoveConfigure.Color_morning));
|
resultVo.setAttribute("morning", new DataItem(morning, DailyLoveConfigure.Color_morning));
|
||||||
|
|
||||||
String rainbowResp = dataRemoteClient.getRainbow(param2);
|
String rainbowResp = dataRemoteClient.getRainbow(param2);
|
||||||
String rainbow = mapper.readTree(rainbowResp).get("result").get(0).get("content").asString();
|
String rainbow = mapper.readTree(rainbowResp).get("result").get("content").asString();
|
||||||
// String rainbow1 = JSONObject.parseObject(rainbowResp).getJSONArray("result").getJSONObject(0).getString("content");
|
// String rainbow1 = JSONObject.parseObject(rainbowResp).getJSONArray("result").getJSONObject(0).getString("content");
|
||||||
resultVo.setAttribute("rainbow", new DataItem(rainbow, DailyLoveConfigure.Color_dailyCn));
|
resultVo.setAttribute("rainbow", new DataItem(rainbow, DailyLoveConfigure.Color_dailyCn));
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ DL:
|
|||||||
wechat:
|
wechat:
|
||||||
app-id: wxba68702957f8b93e
|
app-id: wxba68702957f8b93e
|
||||||
app-secret: 834078bb149409bfca4fe693ea7c4c1c
|
app-secret: 834078bb149409bfca4fe693ea7c4c1c
|
||||||
#ME: oo5bL6bK_4TC0tb-Wa5oiugTPVeQ
|
# ME: oo5bL6bK_4TC0tb-Wa5oiugTPVeQ
|
||||||
#LILI: oo5bL6QafHJa9zQNYKS0fIhFC0zM
|
#LILI: oo5bL6QafHJa9zQNYKS0fIhFC0zM
|
||||||
open-id: oo5bL6QafHJa9zQNYKS0fIhFC0zM
|
open-id: oo5bL6QafHJa9zQNYKS0fIhFC0zM
|
||||||
template-id-morning: 1yx1fahCs923nOmMh0_KLWN0nXGKd8_pHQrfpdMblrQ
|
template-id-morning: E7eBkU0uzBFDwC9MiqPtHNlSlByDafw4BIqZvfOtTOs
|
||||||
template-id-night: QG-5NBX-jip46ulGVsaE3Uhl30GUxvNmtKOxwMHFkx0
|
template-id-night: 5ExwX0ID1ccueXNb7v-dqTcDH-lYtHatg0Mqt4FDIaY
|
||||||
|
|
||||||
color:
|
color:
|
||||||
now: '#99CCCC'
|
now: '#99CCCC'
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
package com.bamanker.dailylove;
|
package com.bamanker.dailylove;
|
||||||
|
|
||||||
|
import com.bamanker.dailylove.config.DailyLoveConfigure;
|
||||||
|
import com.bamanker.dailylove.domain.DataItem;
|
||||||
|
import com.bamanker.dailylove.domain.TianXinReqParam;
|
||||||
|
import com.bamanker.dailylove.domain.Weather;
|
||||||
|
import com.bamanker.dailylove.service.DataRemoteClient;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import tools.jackson.databind.JsonNode;
|
||||||
|
import tools.jackson.databind.ObjectMapper;
|
||||||
|
import com.bamanker.dailylove.domain.*;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -10,6 +21,10 @@ class DailyLoveApplicationTests {
|
|||||||
// @Resource
|
// @Resource
|
||||||
// DataRemoteClient dataRemoteClient;
|
// DataRemoteClient dataRemoteClient;
|
||||||
//
|
//
|
||||||
|
// @Autowired
|
||||||
|
// ObjectMapper mapper;
|
||||||
|
|
||||||
|
//
|
||||||
// String remark = "❤";
|
// String remark = "❤";
|
||||||
//
|
//
|
||||||
// @Test
|
// @Test
|
||||||
@@ -88,24 +103,61 @@ class DailyLoveApplicationTests {
|
|||||||
//
|
//
|
||||||
// @Test
|
// @Test
|
||||||
// void test2() {
|
// void test2() {
|
||||||
|
|
||||||
|
// ResultVo resultVo = ResultVo.initializeResultVo(DailyLoveConfigure.Open_ID,
|
||||||
|
// DailyLoveConfigure.Template_ID_Night,
|
||||||
|
// DailyLoveConfigure.Color_Top);
|
||||||
//
|
//
|
||||||
// TianXinReqParam param1 = new TianXinReqParam();
|
// TianXinReqParam param1 = new TianXinReqParam();
|
||||||
// param1.setKey(DailyLoveConfigure.TianXin_Key);
|
// param1.setKey(DailyLoveConfigure.TianXin_Key);
|
||||||
// param1.setCity(DailyLoveConfigure.City_ID);
|
// param1.setCity(DailyLoveConfigure.City_ID);
|
||||||
// param1.setType("7");
|
// param1.setType("7");
|
||||||
// String weatherJson = dataRemoteClient.getWeather(param1);
|
// String weatherResp = dataRemoteClient.getWeather(param1);
|
||||||
// log.info("weather:{}", weatherJson);
|
//// log.info("weather:{}", weatherResp);
|
||||||
// JSONObject resWeather = JSONObject.parseObject(weatherJson);
|
// JsonNode weatherJson = mapper.readTree(weatherResp).get("result").get("list").get(1);
|
||||||
// JSONObject result = resWeather.getJSONArray("result").getJSONObject(0).getJSONArray("list").getJSONObject(2);
|
// System.out.println("-----------------------------");
|
||||||
|
// System.out.println(weatherJson);
|
||||||
|
// String city = mapper.readTree(weatherResp).get("result").get("area").asString();
|
||||||
|
// System.out.println("-----------------------------");
|
||||||
|
// System.out.println(city);
|
||||||
|
// Weather weather = mapper.treeToValue(weatherJson, Weather.class);
|
||||||
|
// System.out.println("-----------------------------");
|
||||||
|
// System.out.println(weather);
|
||||||
|
//
|
||||||
|
// resultVo.setAttribute("tomorrow", new DataItem(weather.getDate() + " " + weather.getWeek(), DailyLoveConfigure.Color_tomorrow));
|
||||||
|
// resultVo.setAttribute("city", new DataItem(city, DailyLoveConfigure.Color_city));
|
||||||
|
// resultVo.setAttribute("weather", new DataItem(weather.getWeather(), DailyLoveConfigure.Color_weather));
|
||||||
|
// resultVo.setAttribute("min_temperature", new DataItem(weather.getLowest(), DailyLoveConfigure.Color_minTem));
|
||||||
|
// resultVo.setAttribute("max_temperature", new DataItem(weather.getHighest(), DailyLoveConfigure.Color_maxTem));
|
||||||
|
// resultVo.setAttribute("quality", new DataItem(weather.getVis(), DailyLoveConfigure.Color_quality));
|
||||||
|
//
|
||||||
|
// System.out.println("-----------------------------");
|
||||||
|
// System.out.println(resultVo);
|
||||||
|
|
||||||
|
// TianXinReqParam param2 = new TianXinReqParam();
|
||||||
|
// param2.setKey(DailyLoveConfigure.TianXin_Key);
|
||||||
|
//
|
||||||
|
// String tipsResp = dataRemoteClient.getTips(param2);
|
||||||
|
// String tips = mapper.readTree(tipsResp).get("result").get("content").asString();
|
||||||
|
//
|
||||||
|
// System.out.println("-----------------------------");
|
||||||
|
// System.out.println(tips);
|
||||||
|
//
|
||||||
|
// TianXinReqParam param1 = new TianXinReqParam();
|
||||||
|
// param1.setKey(DailyLoveConfigure.TianXin_Key);
|
||||||
|
// param1.setCity(DailyLoveConfigure.City_ID);
|
||||||
|
// param1.setType("1");
|
||||||
|
// String weatherResp = dataRemoteClient.getWeather(param1);
|
||||||
|
// JsonNode weatherJson = mapper.readTree(weatherResp).get("result");
|
||||||
|
// Weather weather = mapper.treeToValue(weatherJson, Weather.class);
|
||||||
|
//
|
||||||
|
// System.out.println("-----------------------------");
|
||||||
|
// System.out.println(weather);
|
||||||
|
|
||||||
// log.info("----result----:{}", result);
|
// log.info("----result----:{}", result);
|
||||||
// Weather weather = result.toJavaObject(Weather.class);
|
|
||||||
// log.info("weather:{}", weather);
|
|
||||||
// ChineseDate chineseDate = new ChineseDate(DateUtil.parseDate(weather.getDate()));
|
//}
|
||||||
// System.out.println("--------------55555----------"+weather.getDate());
|
|
||||||
// System.out.println("------------------------"+chineseDate);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// @Test
|
// @Test
|
||||||
|
|||||||
Reference in New Issue
Block a user