Ver Fonte

add:青柠檬IOS代理商新增渠道时新增默认配置信息

zack há 2 meses atrás
pai
commit
8260d87d4c

+ 6 - 1
yt-agent/agent-service/src/main/java/com/ytpm/controller/AgentDitchController.java

@@ -5,6 +5,7 @@ import com.ytpm.agent.param.AgentDitchParam;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
 import com.ytpm.agent.view.AgentUserInfo;
+import com.ytpm.app.model.YtAppDefaultConfig;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
 import com.ytpm.service.AgentDitchService;
@@ -45,7 +46,11 @@ public class AgentDitchController {
         ytDitch.setDitchName(param.getDitchName());
         ytDitch.setCreateTime(new Date());
         ytDitch.setUserId(userInfo.getUserId());
-        return agentDitchService.addOne(ytDitch);
+        if (!param.getDitchType().isEmpty() && param.getDitchType().equals("2")){
+            return agentDitchService.addDefaultConfig(ytDitch);
+        } else {
+            return agentDitchService.addOne(ytDitch);
+        }
     }
 
     /**

+ 1 - 1
yt-agent/agent-service/src/main/java/com/ytpm/dao/AgentDitchMapper.java

@@ -12,7 +12,7 @@ public interface AgentDitchMapper{
 
     void update(YtDitch ytDitch);
 
-    void insertOne(YtDitch ytDitch);
+    Integer insertOne(YtDitch ytDitch);
 
     YtDitch selectById(@Param("ditchId") Long ditchId);
 }

+ 8 - 0
yt-agent/agent-service/src/main/java/com/ytpm/service/AgentDitchService.java

@@ -1,6 +1,7 @@
 package com.ytpm.service;
 
 import com.ytpm.agent.model.YtDitch;
+import com.ytpm.agent.param.AgentDitchParam;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
 import com.ytpm.general.Result;
@@ -35,4 +36,11 @@ public interface AgentDitchService {
      * @return
      */
     Result<?> deleteOne(Long ditchId);
+
+    /**
+     * IOS增加渠道时同时新增默认配置
+     * @param param
+     * @return
+     */
+    Result<?> addDefaultConfig(YtDitch param);
 }

+ 31 - 0
yt-agent/agent-service/src/main/java/com/ytpm/service/impl/AgentDitchServiceImpl.java

@@ -6,11 +6,14 @@ import com.ytpm.agent.model.YtApp;
 import com.ytpm.agent.model.YtDitch;
 import com.ytpm.agent.param.DitchListParam;
 import com.ytpm.agent.view.AgentDitchView;
+import com.ytpm.app.model.YtAppDefaultConfig;
+import com.ytpm.app.view.WxDefaultConfig;
 import com.ytpm.dao.AgentDitchMapper;
 import com.ytpm.dao.AppMapper;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
+import com.ytpm.lemonios.feign.LemonIosFeign;
 import com.ytpm.service.AgentDitchService;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -28,6 +31,9 @@ public class AgentDitchServiceImpl implements AgentDitchService {
     @Resource
     private AppMapper appMapper;
 
+    @Resource
+    private LemonIosFeign lemonIosFeign;
+
 
     @Override
     public ResultTable<AgentDitchView> ditchList(DitchListParam param) {
@@ -69,4 +75,29 @@ public class AgentDitchServiceImpl implements AgentDitchService {
         agentDitchMapper.update(ytDitch);
         return Result.resultOk(RepMessage.DELETE_SUCCESS);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<?> addDefaultConfig(YtDitch param) {
+        param.setIsDelete(0);
+        agentDitchMapper.insertOne(param);
+
+        WxDefaultConfig lastOne = lemonIosFeign.getLastOne();
+        YtAppDefaultConfig appDefaultConfig = new YtAppDefaultConfig();
+        appDefaultConfig.setConfigName(param.getDitchName());
+        appDefaultConfig.setDitchId(param.getDitchId().toString());
+        appDefaultConfig.setOpenId("");
+        appDefaultConfig.setSecret(lastOne.getSecret());
+        appDefaultConfig.setAppKey("");
+        appDefaultConfig.setAppType(lastOne.getAppType());
+        appDefaultConfig.setAppId(lastOne.getAppId());
+        appDefaultConfig.setCanUseRoot(lastOne.getCanUseRoot());
+        appDefaultConfig.setCanUseAdb(lastOne.getCanUseAdb());
+        appDefaultConfig.setCanAccumulation(lastOne.getCanAccumulation());
+        appDefaultConfig.setCanSimulator(lastOne.getCanSimulator());
+        appDefaultConfig.setPowerWaitTime(lastOne.getPowerWaitTime());
+        appDefaultConfig.setInterstitialIntervalTime(lastOne.getInterstitialIntervalTime());
+        lemonIosFeign.saveAppConfig(appDefaultConfig);
+        return Result.resultOk(RepMessage.SAVE_SUCCESS);
+    }
 }

+ 1 - 1
yt-agent/agent-service/src/main/resources/mapper/AgentDitchMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ytpm.dao.AgentDitchMapper">
-    <insert id="insertOne">
+    <insert id="insertOne" keyProperty="ditchId" useGeneratedKeys="true">
         insert into yt_ditch
         (
             ditch_id,

+ 2 - 0
yt-common/src/main/java/com/ytpm/agent/param/AgentDitchParam.java

@@ -9,4 +9,6 @@ public class AgentDitchParam {
     private String ditchName;
     @ApiModelProperty("id")
     private Long ditchId;
+    @ApiModelProperty("渠道类型")
+    private String ditchType;
 }

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

@@ -71,6 +71,9 @@ public interface LemonIosFeign {
     @GetMapping("/wx/getConfigs")
     List<WxDefaultConfig> getConfigs(@RequestParam(name = "appIds")String appIds);
 
+    @GetMapping("/wx/getLastOne")
+    WxDefaultConfig getLastOne();
+
     @PostMapping("/user/queryTodayBanned")
     List<YtDyzUser> queryTodayBanned(@RequestBody AppUserTodayBannedParam appUserTodayBannedParam);
 

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

@@ -111,6 +111,13 @@ public class WxController {
         return Result.resultOk(RepMessage.QUERY_SUCCESS, defaultConfig);
     }
 
+    @GetMapping("/getLastOne")
+    @ApiOperation("获取最近一条默认配置")
+    @Transactional
+    public WxDefaultConfig getLastOne(){
+        return appUserMapper.getLastOne();
+    }
+
     private String getClientIp(HttpServletRequest request) {
         String xfHeader = request.getHeader("X-Forwarded-For");
         if (xfHeader == null) {

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

@@ -110,6 +110,11 @@ public interface AppUserMapper {
      */
     WxDefaultConfig getDefaultConfigByDitchId(@Param("ditchId") Long ditchId);
 
+    /**
+     * 获取最近一条默认配置
+     */
+    WxDefaultConfig getLastOne();
+
     /**
      * 根据微信openid查询用户
      */

+ 11 - 2
yt-ios-lemon/lemon-ios-service/src/main/resources/mapper/AppUserMapper.xml

@@ -79,7 +79,8 @@
          secret,
          app_id,
          app_key,
-         app_type
+         app_type,
+         ditch_id
         )
         values
         (
@@ -88,7 +89,8 @@
          #{secret},
          #{appId},
          #{appKey},
-         #{appType}
+         #{appType},
+         #{ditchId}
         )
     </insert>
     <update id="updateAppConfig">
@@ -465,6 +467,13 @@
         from yt_app_default_config
         where ditch_id = #{ditchId}
     </select>
+    <select id="getLastOne" resultType="com.ytpm.app.view.WxDefaultConfig">
+        select
+            config_id, config_name, open_id, secret, app_id, app_key, app_type,user_path,login_path,ad_path,answer_path,power_path
+             ,can_simulator,taku_app_id,taku_key,taku_banner_pid,taku_interstitial_pid,taku_reward_pid,taku_native_pid,can_use_adb,can_accumulation,can_use_float,can_use_root,ditch_id,power_wait_time,interstitial_interval_time
+        from yt_app_default_config
+        LIMIT 1
+    </select>
     <select id="getSecretByAppId" resultType="java.lang.String">
         select
            secret