补充前端需要的接口。以及对于isLock属性的类型的转换。

This commit is contained in:
many2many 2024-05-31 09:22:10 +08:00
parent 63042d44e4
commit 45a3065210
3 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,43 @@
package com.lk.paopao.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/${app.version}/site")
public class SiteController {
@GetMapping("/profile")
public Map<String,Object> profile() {
Map<String,Object> map1 = Map.of(
"use_friendship",true,
"enable_trends_bar", true,
"enable_wallet", false,
"allow_tweet_attachment", true,
"allow_tweet_attachment_price",true,
"allow_tweet_video", true,
"allow_user_register", true,
"allow_phone_bind",true,
"default_tweet_max_length",2000);
Map<String,Object> map2 = Map.of(
"tweet_web_ellipsis_size", 400,
"tweet_mobile_ellipsis_size", 300,
"default_tweet_visibility", "friend",
"default_msg_loop_interval", 5000,
"copyright_top", "2023 paopao.info",
"copyright_left", "Roc's Me",
"copyright_left_link", "",
"copyright_right", "泡泡(PaoPao)开源社区",
"copyright_right_link", "https://www.paopao.info");
Map<String,Object> map = new HashMap<>();
map.putAll(map1);
map.putAll(map2);
return map;
}
}

View File

@ -0,0 +1,17 @@
package com.lk.paopao.dto;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
public class BooleanToIntSerializer extends JsonSerializer<Boolean> {
@Override
public void serialize(Boolean value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
if (value != null) {
gen.writeNumber(value ? 1 : 0);
} else {
gen.writeNull();
}
}
}

View File

@ -20,6 +20,7 @@ public class PostDto implements Serializable {
Byte visibility;
Boolean isTop;
Boolean isEssence;
@JsonSerialize(using = BooleanToIntSerializer.class)
Boolean isLock;
Long latestRepliedOn;
String tags;