Преглед изворни кода

增加对接应用签名校验

xuchao пре 1 месец
родитељ
комит
b015f56f75

+ 13 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/openinterface/service/impl/BizOpenInterfaceServiceImpl.java

@@ -14,13 +14,16 @@ package vip.xiaonuo.biz.modular.openinterface.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollStreamUtil;
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import jakarta.annotation.Resource;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import vip.xiaonuo.common.cache.CommonCacheOperator;
 import vip.xiaonuo.common.enums.CommonSortOrderEnum;
 import vip.xiaonuo.common.exception.CommonException;
 import vip.xiaonuo.common.page.CommonPageRequest;
@@ -43,6 +46,10 @@ import java.util.List;
 @Service
 public class BizOpenInterfaceServiceImpl extends ServiceImpl<BizOpenInterfaceMapper, BizOpenInterface> implements BizOpenInterfaceService {
 
+    private static final String OpenInterfaceKey = "open-interface-";
+    @Resource
+    private CommonCacheOperator commonCacheOperator;
+
     @Override
     public Page<BizOpenInterface> page(BizOpenInterfacePageParam bizOpenInterfacePageParam) {
         QueryWrapper<BizOpenInterface> queryWrapper = new QueryWrapper<BizOpenInterface>().checkSqlInjection();
@@ -69,6 +76,12 @@ public class BizOpenInterfaceServiceImpl extends ServiceImpl<BizOpenInterfaceMap
         BizOpenInterface bizOpenInterface = this.queryEntity(bizOpenInterfaceEditParam.getId());
         BeanUtil.copyProperties(bizOpenInterfaceEditParam, bizOpenInterface);
         this.updateById(bizOpenInterface);
+
+        Object openInterfaceValue = commonCacheOperator.get(OpenInterfaceKey + bizOpenInterface.getAppKey());
+        if(ObjectUtil.isNotNull(openInterfaceValue)) {
+            commonCacheOperator.remove(OpenInterfaceKey + bizOpenInterface.getAppKey());
+        }
+
     }
 
     @Transactional(rollbackFor = Exception.class)