|
@@ -10,6 +10,7 @@ import com.sun.javafx.collections.MappingChange;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -35,6 +36,14 @@ public class UserKnockRecordController extends BaseController {
|
|
|
@PostMapping("/add")
|
|
|
public Result add(@RequestBody UserKnockRecordEntity entity){
|
|
|
try {
|
|
|
+ //数据校验
|
|
|
+ String openId = entity.getOpenId();
|
|
|
+ if (StringUtils.isEmpty(openId)){
|
|
|
+ return fail(openId,"openId不能为空");
|
|
|
+ }
|
|
|
+ if (entity.getKnockNum() == 0){
|
|
|
+ return fail(entity,"功德为0");
|
|
|
+ }
|
|
|
return success(service.add(entity));
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|