Jelajahi Sumber

fix:IOS限制母包修改子包配置信息字段

zack 1 bulan lalu
induk
melakukan
48bdf8239e

+ 28 - 4
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/controller/WxController.java

@@ -29,6 +29,7 @@ import com.ytpm.lemonios.service.AppUserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -276,10 +277,33 @@ public class WxController {
     @ApiOperation("修改应用默认配置")
     @PostMapping("/updateAppsConfig")
     public void updateAppsConfig(@RequestBody AppConfigUpdateParam param){
-        for (String appId : param.getApps()){
-            YtAppDefaultConfig oldConfig = appUserMapper.getConfigByAppId(appId);
-            param.getDefaultConfig().setConfigId(oldConfig.getConfigId());
-            appUserMapper.updateAppConfig(param.getDefaultConfig());
+        if (CollUtil.isNotEmpty(param.getApps()) && param.getDefaultConfig() != null) {
+            String appIds = String.join(",", param.getApps());
+            List<WxDefaultConfig> configs = appUserMapper.getConfigByIds(appIds);
+            YtAppDefaultConfig updateInfo = param.getDefaultConfig();
+            for (WxDefaultConfig config : configs) {
+                YtAppDefaultConfig appConfig = new YtAppDefaultConfig();
+                BeanUtils.copyProperties(config, appConfig);
+                if(StrUtil.isNotEmpty(updateInfo.getTakuAppId())) {
+                    appConfig.setTakuAppId(updateInfo.getTakuAppId());
+                }
+                if(StrUtil.isNotEmpty(updateInfo.getTakuKey())) {
+                    appConfig.setTakuKey(updateInfo.getTakuKey());
+                }
+                if(StrUtil.isNotEmpty(updateInfo.getTakuBannerPid())) {
+                    appConfig.setTakuBannerPid(updateInfo.getTakuBannerPid());
+                }
+                if(StrUtil.isNotEmpty(updateInfo.getTakuNativePid())) {
+                    appConfig.setTakuNativePid(updateInfo.getTakuNativePid());
+                }
+                if(StrUtil.isNotEmpty(updateInfo.getTakuRewardPid())) {
+                    appConfig.setTakuRewardPid(updateInfo.getTakuRewardPid());
+                }
+                if(StrUtil.isNotEmpty(updateInfo.getTakuInterstitialPid())) {
+                    appConfig.setTakuInterstitialPid(updateInfo.getTakuInterstitialPid());
+                }
+                appUserMapper.updateAppConfig(appConfig);
+            }
         }
     }