feat: 默认返回位置信息
This commit is contained in:
@@ -27,7 +27,7 @@ public class VisitorController {
|
||||
@GetMapping("/admin/visitor/page")
|
||||
public Response page(@RequestParam(value = "count", required = false, defaultValue = "10") int count,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
|
||||
@RequestParam(value = "showLocation", required = false, defaultValue = "false") boolean showLocation) {
|
||||
@RequestParam(value = "showLocation", required = false, defaultValue = "true") boolean showLocation) {
|
||||
return Response.success(visitorService.visitorPage(page, count, showLocation));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ public class VisitorControllerTest extends BaseTest {
|
||||
public void page() throws Exception {
|
||||
int count = 10;
|
||||
int page = 1;
|
||||
// 默认显示location
|
||||
getMockData(get("/admin/visitor/page?count=" + count + "&page=" + page), adminLogin()).andDo(result -> {
|
||||
Response<PageData<VisitorModel>> response = getResponse(result, VISITOR_PAGE_TYPE);
|
||||
assertEquals(SUCCESS.getCode(), response.getCode());
|
||||
@@ -41,6 +42,7 @@ public class VisitorControllerTest extends BaseTest {
|
||||
for (VisitorModel v : pageData.getList()) {
|
||||
assertNotEquals(0, v.getId());
|
||||
assertNotNull(v.getDate());
|
||||
assertNotNull(v.getLocation());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package cn.celess.blog.service.serviceimpl;
|
||||
package cn.celess.blog.service;
|
||||
|
||||
import cn.celess.blog.BaseTest;
|
||||
import cn.celess.blog.entity.model.PageData;
|
||||
import cn.celess.blog.entity.model.VisitorModel;
|
||||
import cn.celess.blog.service.VisitorService;
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class VisitorServiceImplTest extends BaseTest {
|
||||
public class VisitorServiceTest extends BaseTest {
|
||||
|
||||
@Autowired
|
||||
VisitorService visitorService;
|
||||
Reference in New Issue
Block a user