Procházet zdrojové kódy

fix: 风控缺陷处理

hidewnd před 2 měsíci
rodič
revize
8b831aae9d

+ 6 - 1
yt-common/src/main/java/com/ytpm/app/model/YtAppDefaultConfig.java

@@ -64,7 +64,12 @@ public class YtAppDefaultConfig {
     private String ditchId;
     @ApiModelProperty("原生信息流间隔时间(秒)")
     private String flowIntervalTime;
-
+    @ApiModelProperty("体力不足提示语")
+    private String taskLimitTip;
+    @ApiModelProperty("用户低收益提示语")
+    private String lowValueTip;
+    @ApiModelProperty("刷子提示语")
+    private String brushTip;
 
     public YtAppDefaultConfig(Object o, String appName, String wxAppId, String wxSecret, String appId, String appKey, int appType,String ditchId) {
         this.configId = Objects.isNull(o)?null: Integer.parseInt(o.toString());

+ 2 - 0
yt-common/src/main/java/com/ytpm/general/StatusCode.java

@@ -12,6 +12,8 @@ public class StatusCode {
 
     /** 访问错误 */
     public static final int ACCESS_ERR = 301;
+    /** 风控校验失败 */
+    public static final int ACCESS_RISK_ERROR = 3012;
     /** 参数缺失 */
     public static final int MISSING_PARAMETER = 302;
     /** 参数校验错误 */

+ 2 - 14
yt-common/src/main/java/com/ytpm/handle/AbstractLoginService.java

@@ -1,7 +1,5 @@
 package com.ytpm.handle;
 
-
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
@@ -125,22 +123,12 @@ public abstract class AbstractLoginService {
      */
     private YtDyzUser visitorLoginHandle(LoginParam loginParam, Map<String, Object> paramMap) {
         // 唯一性判断
-        // 1.查询设备ID不存在记录 则根据设备id+渠道id注册用户
-        // 2.查询设备ID存在记录 则根据渠道ID控制唯一性,同步出路风控记录
-        YtDyzUser ytDyzUser = null;
-        List<YtDyzUser> ytDyzUsers = queryDyzUserByParam(loginParam, paramMap);
-        if(CollUtil.isEmpty(ytDyzUsers)) {
-            //注册后回调
+        YtDyzUser ytDyzUser = queryUserByDeviceAndDitch(loginParam.getDeviceId(), loginParam.getDitchId());
+        if(ytDyzUser == null) {
             beforeRegistryUser(loginParam, paramMap);
             ytDyzUser = new YtDyzUser();
             registryUser(loginParam, ytDyzUser, paramMap);
         } else {
-            // 查询当前设备当前渠道是否存在该用户
-            ytDyzUser = queryUserByDeviceAndDitch(loginParam.getDeviceId(), loginParam.getDitchId());
-            if(ytDyzUser == null) {
-                ytDyzUser = new YtDyzUser();
-                registryUser(loginParam, ytDyzUser, paramMap);
-            }
             //当前渠道已有用户,校验用户是否处于风控中 & 更新用户信息
             beforeDeadWithUserCrud(loginParam, ytDyzUser, paramMap);
             //如果当前登录是本日第一次登录则登录天数+1

+ 9 - 0
yt-nofeeds/nofeeds-service/src/main/java/com/ytpm/nofeeds/service/impl/AdServiceImpl.java

@@ -29,6 +29,7 @@ import com.ytpm.middle.view.UserRankingListVO;
 import com.ytpm.nofeeds.dao.AdRecordMapper;
 import com.ytpm.nofeeds.dao.AppUserMapper;
 import com.ytpm.nofeeds.service.AdService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -51,6 +52,7 @@ import java.util.Objects;
 import java.util.concurrent.CountDownLatch;
 import java.util.stream.Collectors;
 
+@Slf4j
 @Service
 @RefreshScope
 public class AdServiceImpl implements AdService {
@@ -72,6 +74,7 @@ public class AdServiceImpl implements AdService {
     @Transactional(rollbackFor = Exception.class)
     public Result<?> saveRecord(DyzAdRecordParam param) {
         YtDyzUser user = appUserMapper.selectPrimaryKey(param.getUserId());
+        log.error(StrUtil.format("[saveRecord]:{} ", param.getBeginTime()));
         if(Objects.isNull(user)){
             return Result.resultOk(RepMessage.SAVE_SUCCESS);
         }
@@ -87,9 +90,15 @@ public class AdServiceImpl implements AdService {
             Result<?> result = riskFeign.checkAdRisk(user);
             if (result.getCode() != 200) {
                 Result<Object> resultObj = new Result<>(StatusCode.ACCESS_ERR, getTipsMsg());
+                // 766处理
                 if("766".contains(result.getMessage())){
                     resultObj.setData(result.getMessage());
                 }
+                else if (result.getCode() == StatusCode.ACCESS_RISK_ERROR && StrUtil.isNotBlank(result.getMessage())) {
+                    // 体力不再获取处理
+                    resultObj.setMessage(result.getMessage());
+                    resultObj.setData("767");
+                }
                 return resultObj;
             }
         }

+ 13 - 3
yt-nofeeds/nofeeds-service/src/main/resources/mapper/AppUserMapper.xml

@@ -152,6 +152,15 @@
             <if test="flowIntervalTime != null">
                 flow_interval_time = #{flowIntervalTime}
             </if>
+            <if test="taskLimitTip != null">
+                task_limit_tip = #{taskLimitTip}
+            </if>
+            <if test="taskLimitTip != null">
+                low_value_tip = #{lowValueTip}
+            </if>
+            <if test="taskLimitTip != null">
+                brush_tip = #{brushTip}
+            </if>
         </set>
         where app_id = #{appId}
     </update>
@@ -431,9 +440,10 @@
     </select>
     <select id="getDefaultConfig" 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_native_pid,
-            taku_reward_pid, taku_interstitial_pid, can_use_root, can_use_adb, can_use_float, can_accumulation,
+            config_id, config_name, open_id as app_id, secret, app_id as platformAppId, app_key as platformAppSecret,
+            app_type,user_path, login_path,ad_path,answer_path,power_path,can_simulator,
+            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,
             ditch_id, power_wait_time, interstitial_interval_time,
             low_value_tip, brush_tip,flow_interval_time,task_limit_tip
         from yt_app_default_config