diff --git a/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java b/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java index 42bfc5d..19e79df 100644 --- a/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java +++ b/src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java @@ -33,7 +33,7 @@ public class CmsEssayController { * @return */ @PostMapping("/add") - public BaseResponse addEssay(@RequestBody CmsEssay cmsEssay){ + public BaseResponse addEssay(CmsEssay cmsEssay){ return cmsEssayService.addEssay(cmsEssay); } @@ -74,7 +74,7 @@ public class CmsEssayController { * @return */ @PutMapping("/edit/status") - public BaseResponse editStatus(CmsEssay cmsEssay){ + public BaseResponse editStatus(@RequestBody CmsEssay cmsEssay){ return cmsEssayService.editStatus(cmsEssay); } } diff --git a/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java index 5e091fc..61420bf 100644 --- a/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/cms/CmsEssayServiceImpl.java @@ -9,6 +9,7 @@ import com.teaching.backend.model.entity.cms.CmsEssay; import com.teaching.backend.service.cms.ICmsEssayService; import org.springframework.stereotype.Service; +import java.time.LocalDate; import java.util.List; /** @@ -24,6 +25,7 @@ public class CmsEssayServiceImpl extends ServiceImpl i @Override public BaseResponse addEssay(CmsEssay cmsEssay) { + cmsEssay.setPublishTime(LocalDate.now()); save(cmsEssay); return ResultUtils.success("添加成功"); }