Explorar el Código

fix:修改母包应用配置的时候同步修改所有子包的默认配置

zack hace 1 mes
padre
commit
2ec16e63bf

+ 3 - 0
yt-ios-lemon/lemon-ios-feign/src/main/java/com/ytpm/lemonios/feign/LemonIosFeign.java

@@ -82,6 +82,9 @@ public interface LemonIosFeign {
     @PostMapping("/wx/saveAppConfig")
     Result<String> saveAppConfig(@RequestBody YtAppDefaultConfig defaultConfig);
 
+    @PostMapping("/wx/updateAppsConfig")
+    void updateAppsConfig(@RequestBody YtAppDefaultConfig defaultConfig, @RequestBody List<String> apps);
+
     @PostMapping("/wx/updateAppConfig")
     Result<String> updateAppConfig(@RequestBody YtAppDefaultConfig defaultConfig);
 

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

@@ -272,6 +272,16 @@ public class WxController {
         return Result.resultOk(RepMessage.SAVE_SUCCESS);
     }
 
+    @ApiOperation("修改应用默认配置")
+    @PostMapping("/updateAppsConfig")
+    public void updateAppsConfig(@RequestBody YtAppDefaultConfig defaultConfig, @RequestBody List<String> apps){
+        for (String appId : apps){
+            YtAppDefaultConfig oldConfig = appUserMapper.getConfigByAppId(appId);
+            defaultConfig.setConfigId(oldConfig.getConfigId());
+            appUserMapper.updateAppConfig(defaultConfig);
+        }
+    }
+
     @ApiOperation("根据APP_ID获取配置")
     @GetMapping("/getConfigs")
     public List<WxDefaultConfig> getConfigs(@RequestParam(name = "appIds")String appIds){

+ 5 - 0
yt-ios-lemon/lemon-ios-service/src/main/java/com/ytpm/lemonios/dao/AppUserMapper.java

@@ -107,6 +107,11 @@ public interface AppUserMapper {
      */
     WxDefaultConfig getDefaultConfig(@Param("appType") int appType);
 
+    /**
+     * 根据应用ID查询应用默认配置
+     */
+    YtAppDefaultConfig getConfigByAppId(@Param("appId") String appId);
+
     /**
      * 根据应用ID查询应用默认配置
      */

+ 38 - 0
yt-ios-lemon/lemon-ios-service/src/main/resources/mapper/AppUserMapper.xml

@@ -460,6 +460,44 @@
             #{item}
         </foreach>
     </select>
+    <select id="getConfigByAppId" resultType="com.ytpm.app.model.YtAppDefaultConfig">
+        select
+            config_id,
+            config_name,
+            open_id,
+            secret,
+            app_id,
+            app_key,
+            app_type,
+            user_path,
+            login_path,
+            ad_path,
+            answer_path,
+            power_path,
+            taku_app_id,
+            taku_key,
+            taku_banner_pid,
+            taku_native_pid,
+            taku_reward_pid,
+            taku_interstitial_pid,
+            can_use_root,
+            can_use_adb,
+            can_use_float,
+            can_accumulation,
+            can_simulator,
+            ditch_id,
+            power_wait_time,
+            interstitial_interval_time,
+            low_value_tip,
+            brush_tip,
+            flow_interval_time,
+            task_limit_tip,
+            start_wait_time,
+            can_cache_video,
+            can_allow_auto_refresh
+        from yt_app_default_config
+        where app_id = #{appId}
+    </select>
     <select id="getByAppId" resultType="com.ytpm.app.view.WxDefaultConfig">
         select
             config_id,

+ 7 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/dao/AppMapper.java

@@ -59,4 +59,11 @@ public interface AppMapper {
      * 查询企业用户的应用
      */
     List<YtPlatformUserApp> getAppListByUserIds(@Param("userIds")String userIds);
+
+    /**
+     * 根据母包ID获取所有子包ID
+     * @param appId
+     * @return
+     */
+    List<String> getAppListForSuperior(@Param("appId")String appId);
 }

+ 14 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/AppServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ytpm.agent.model.YtPlatformUserApp;
+import com.ytpm.app.model.YtAppDefaultConfig;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
@@ -16,6 +17,7 @@ import com.ytpm.middle.param.AppForm;
 import com.ytpm.middle.param.AppListParam;
 import com.ytpm.middle.param.GrantAppParam;
 import com.ytpm.middle.service.AppService;
+import com.ytpm.middle.util.FeignClientInvoker;
 import com.ytpm.middle.view.AppListVO;
 import com.ytpm.middle.view.DropDownVO;
 import com.ytpm.middle.view.FinancePaymentVO;
@@ -27,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.Date;
+import java.util.List;
 import java.util.Objects;
 
 @Service
@@ -38,6 +41,8 @@ public class AppServiceImpl implements AppService {
     private EnterpriseMapper enterpriseMapper;
     @Autowired
     private FinanceMapper financeMapper;
+    @Autowired
+    private FeignClientInvoker feignInvoker;
 
     /**
      *  应用列表
@@ -142,6 +147,15 @@ public class AppServiceImpl implements AppService {
         YtPlatformUserApp app = new YtPlatformUserApp();
         BeanUtils.copyProperties(form, app);
         appMapper.updateById(app);
+        YtAppDefaultConfig config = new YtAppDefaultConfig();
+        config.setTakuAppId(app.getTakuAppId());
+        config.setTakuKey(app.getTakuKey());
+        config.setTakuBannerPid(app.getTakuBannerPid());
+        config.setTakuNativePid(app.getTakuNativePid());
+        config.setTakuRewardPid(app.getTakuRewardPid());
+        config.setTakuInterstitialPid(app.getTakuInterstitialPid());
+        List<String> apps = appMapper.getAppListForSuperior(app.getAppId());
+        feignInvoker.invoke(app.getServiceName(), "updateAppsConfig", config, apps);
         return Result.resultOk(RepMessage.GRANT_SUCCESS);
     }
 

+ 6 - 0
yt-middle/middle-platform/src/main/resources/mapper/AppMapper.xml

@@ -218,6 +218,12 @@
         from yt_app
         where superior_id = #{appId}
     </select>
+    <select id="getAppListForSuperior" resultType="java.lang.String">
+        select
+            app_id
+        from yt_app
+        where superior_id = #{appId}
+    </select>
     <select id="getAppListByUserIds" resultType="com.ytpm.agent.model.YtPlatformUserApp">
         select
             app_id, app_name, user_id, app_type, detail_url, package_name, domain, issued_time, wx_app_id, wx_secret, sale_price, grant_type, charge_status, create_time, create_user_id, update_time, update_user_id, available