|
@@ -64,7 +64,7 @@ public class WebController extends BaseController {
|
|
|
/** 每次浏览作品都需要调用次接口。 浏览量只统计预览跟正式发布的数据 */
|
|
|
@ApiOperation(value = "检查作品是否可用", notes = "true:可用, false:不可用, visit有值表示要添加浏览量")
|
|
|
@GetMapping("checkWork/{workId}")
|
|
|
- public Result checkWork(@PathVariable String workId, String visit) {
|
|
|
+ public Result checkWork(@PathVariable String workId, String visit,int val) {
|
|
|
log.info("作品id: {}", workId);
|
|
|
boolean flag = false;
|
|
|
|
|
@@ -88,9 +88,11 @@ public class WebController extends BaseController {
|
|
|
if (visit != null) {
|
|
|
workService.addVisit(workId);
|
|
|
}
|
|
|
- redisUtil.set(RedisConstant.WORK_ID+workId, entity, 30, TimeUnit.SECONDS);
|
|
|
- Result FAILURE_SYS_3011 = checkWkByUser(entity);
|
|
|
- if (FAILURE_SYS_3011 != null) return FAILURE_SYS_3011;
|
|
|
+ redisUtil.set(RedisConstant.WORK_ID + workId, entity, 30, TimeUnit.SECONDS);
|
|
|
+ if (val == 1) {
|
|
|
+ Result FAILURE_SYS_3011 = checkWkByUser(entity);
|
|
|
+ if (FAILURE_SYS_3011 != null) return FAILURE_SYS_3011;
|
|
|
+ }
|
|
|
} else {
|
|
|
log.warn("作品不存在");
|
|
|
}
|
|
@@ -99,7 +101,7 @@ public class WebController extends BaseController {
|
|
|
|
|
|
private Result checkWkByUser(WorkEntity entity) {
|
|
|
String userNameForToken = getUserNameForToken();
|
|
|
- if (!userNameForToken.equals(entity.getUserId())&&ObjectUtil.isEmpty(entity.getNum())) {
|
|
|
+ if (userNameForToken!=null && !userNameForToken.equals(entity.getUserId())&&ObjectUtil.isEmpty(entity.getNum())) {
|
|
|
return Result.failure(ErrorEnum.FAILURE_SYS_3011.code(), "当前无操作权限");
|
|
|
} else if (ObjectUtil.isNotEmpty(entity.getType())&& entity.getType().equalsIgnoreCase("pro")){
|
|
|
JSONObject cameraList =fdkkClient.getCameraListByToken(getToken(),"3,4,5");
|