master
chaiyapeng 2024-08-30 09:55:56 +08:00
parent 3417b5a39e
commit 2bc6d35edf
2 changed files with 10 additions and 9 deletions

View File

@ -16,10 +16,9 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class Birthday { public class Birthday {
private String year; private String years;
private String month; private String months;
private String day; private String days;
private String hour;
private String animal; private String animal;
private String imonthcn; private String imonthcn;
private String idaycn; private String idaycn;

View File

@ -39,6 +39,7 @@ public class BirthdayHelper {
map.put("day", birthdayRes.getDay()); map.put("day", birthdayRes.getDay());
map.put("hour", birthdayRes.getHour()); map.put("hour", birthdayRes.getHour());
String urlencode = urlencode(map); String urlencode = urlencode(map);
Birthday birthday1 = new Birthday(); Birthday birthday1 = new Birthday();
String s = doGet(API_URL, urlencode); String s = doGet(API_URL, urlencode);
try { try {
@ -47,9 +48,10 @@ public class BirthdayHelper {
if (error_code == 0){ if (error_code == 0){
System.out.println("调用接口成功"); System.out.println("调用接口成功");
JSONObject result = jsonObject.getJSONObject("result"); JSONObject result = jsonObject.getJSONObject("result");
birthday1.setYear(result.getString("year"));
birthday1.setMonth(result.getString("month")); birthday1.setYears(result.getString("year"));
birthday1.setDay(result.getString("day")); birthday1.setMonths(result.getString("month"));
birthday1.setDays(result.getString("day"));
birthday1.setAnimal(result.getString("Animal")); birthday1.setAnimal(result.getString("Animal"));
birthday1.setImonthcn(result.getString("ImonthCn")); birthday1.setImonthcn(result.getString("ImonthCn"));
birthday1.setIdaycn(result.getString("IDayCn")); birthday1.setIdaycn(result.getString("IDayCn"));