Explorar o código

feat: arithmetic 同步修改

hidewnd hai 1 mes
pai
achega
ff072df7d4

+ 1 - 0
yt-arithmetic/arithmetic-service/pom.xml

@@ -44,6 +44,7 @@
         <dependency>
             <groupId>com.zaxxer</groupId>
             <artifactId>HikariCP</artifactId>
+            <version>${hikar-icp.version}</version>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 3 - 1
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/config/interceptor/HttpInterceptor.java

@@ -1,5 +1,6 @@
 package com.ytpm.arithmetic.config.interceptor;
 
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.web.servlet.HandlerInterceptor;
 import org.springframework.web.servlet.ModelAndView;
@@ -8,6 +9,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.Date;
 
+@Slf4j
 @Component
 public class HttpInterceptor implements HandlerInterceptor {
 
@@ -16,7 +18,7 @@ public class HttpInterceptor implements HandlerInterceptor {
                              HttpServletResponse response, Object obj) throws Exception {
         // 获取客户端IP地址
         String clientIp = getClientIp(request);
-        System.out.println("算术小达人接收客户端" + clientIp + "发起用户请求");
+        log.error("算术小达人接收客户端{}发起用户请求", clientIp);
         // 可以在这里添加更多的逻辑,比如记录日志等
         return true;
     }

+ 14 - 0
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/controller/UserController.java

@@ -2,6 +2,7 @@ package com.ytpm.arithmetic.controller;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.PageInfo;
 import com.ytpm.advertise.enums.AdSourceTypeEnum;
 import com.ytpm.agent.enums.UserStatusEnum;
@@ -23,9 +24,11 @@ import com.ytpm.arithmetic.dao.AppUserMapper;
 import com.ytpm.arithmetic.dao.LoginRecordMapper;
 import com.ytpm.arithmetic.dao.QuestionMapper;
 import com.ytpm.arithmetic.redis.RedisService;
+import com.ytpm.feign.RiskFeign;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
+import com.ytpm.general.StatusCode;
 import com.ytpm.risk.enums.BannedTypeEnum;
 import com.ytpm.risk.view.RiskConfigView;
 import com.ytpm.risk.view.RiskTemplateView;
@@ -66,6 +69,8 @@ public class UserController {
     @Autowired
     private RedisService redisService;
 
+    @Autowired
+    private RiskFeign riskFeign;
 
     /**
      * 根据应用ID查询当月注册用户
@@ -169,6 +174,15 @@ public class UserController {
         user.setTodayAnswerCount(questionMapper.getAnswerCount(userId,1));
         user.setHistoryAnswerCount(questionMapper.getAnswerCount(userId,2));
         user.setAnswerRecordList(questionMapper.getAnswerRecords(userId));
+        Result<?> result = riskFeign.checkAdRisk(user);
+        if (result != null) {
+            user.setIfPowerLimit(false);
+            if (result.getCode() != 200) {
+                if ("766".equals(result.getMessage()) || result.getCode() == StatusCode.ACCESS_RISK_ERROR && StrUtil.isNotEmpty(result.getMessage())) {
+                    user.setIfPowerLimit(true);
+                }
+            }
+        }
         return Result.resultObjOk(user);
     }
 

+ 2 - 0
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/controller/WxController.java

@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.ytpm.app.enums.AppTypeEnums;
+import com.ytpm.app.enums.LoginType;
 import com.ytpm.app.model.YtAppDefaultConfig;
 import com.ytpm.app.model.YtDyzPowerRecord;
 import com.ytpm.app.model.YtDyzUser;
@@ -72,6 +73,7 @@ public class WxController {
         }
         param.setLoginIp(getClientIp(request));
         YtDyzUser old = appUserService.crudForNewTrans(param,wxUserInfo,loginResult);
+        old.setLoginType(LoginType.WX);
         //调用风控服务校验默认风控配置
         old.setRiskCode("313");
         Result<?> result = riskFeign.checkRisk(old);

+ 13 - 2
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/dao/AdRecordMapper.java

@@ -15,10 +15,16 @@ public interface AdRecordMapper {
      * 新增广告记录
      */
     void addOne(YtDyzAdRecord adRecord);
+
+    /**
+     * 保存游客广告记录
+     */
+    void addOneVisitor(YtDyzAdRecord adRecord);
+
     /**
      * 查询用户的广告记录
      */
-    List<YtDyzAdRecord> getByUserId(@Param("userId") String userId,@Param("adsourceType") Integer adsourceType);
+    List<YtDyzAdRecord> getByUserId(@Param("userId") String userId, @Param("adsourceType") Integer adsourceType);
 
     /**
      * 查询激励视频记录
@@ -44,4 +50,9 @@ public interface AdRecordMapper {
      * 查询今日广告
      */
     List<YtDyzAdRecord> getTodayRecord(@Param("appIds")String appIds,@Param("firstDay")String firstDay,@Param("lastDay")String lastDay);
-}
+
+    /**
+     * 查询指定广告记录
+     */
+    List<YtDyzAdRecord> selectRecordByIds(@Param("loginStatus") Integer loginStatus, @Param("ids") List<String> adRecordIds);
+}

+ 2 - 0
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/dao/AppUserMapper.java

@@ -90,6 +90,8 @@ public interface AppUserMapper {
      */
     WxDefaultConfig getDefaultConfig(@Param("appType") int appType);
 
+    WxDefaultConfig getDefaultConfigByAppId(@Param("appId") String appId);
+
     /**
      * 根据微信openid查询用户
      */

+ 8 - 3
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/monitor/RedisKeyExpirationListener.java

@@ -6,6 +6,7 @@ import com.ytpm.arithmetic.dao.AppUserMapper;
 import com.ytpm.feign.RiskFeign;
 import com.ytpm.risk.enums.BannedTypeEnum;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.data.redis.connection.Message;
 import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
@@ -28,7 +29,8 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
     private AppUserMapper appUserMapper;
     @Resource
     private RiskFeign riskFeign;
-
+    @Value("${spring.application.name:}")
+    private String applicationName;
     /**
      * Creates new {@link } for {@code __keyevent@*__:expired} messages.
      *
@@ -43,8 +45,11 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
      */
     @Override
     public void onMessage(Message message, byte[] pattern) {
-        String key = String.valueOf(message);
-        log.error("App-Service 发现预定风控用户:{}",key);
+       String key = String.valueOf(message);
+//        log.error("App-Service 发现预定风控用户:{}",key);
+        //        if (!key.endsWith(applicationName)) {
+//            return;
+//        }
         if(key.startsWith("lock_")){
             String[] arr = key.split("_");
             lockUser(arr[1], UserStatusEnum.RISK.getCode());

+ 6 - 0
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/service/AdService.java

@@ -2,6 +2,8 @@ package com.ytpm.arithmetic.service;
 
 import com.ytpm.agent.view.AgentAdGroupStaticsVO;
 import com.ytpm.agent.view.AgentTopCountView;
+import com.ytpm.app.model.YtDyzAdRecord;
+import com.ytpm.app.model.YtDyzUser;
 import com.ytpm.app.param.DyzAdRecordParam;
 import com.ytpm.general.Result;
 import com.ytpm.middle.view.DashboardRankingListVO;
@@ -46,4 +48,8 @@ public interface AdService {
      * 查询代理商首页广告数据统计
      */
     List<AgentAdGroupStaticsVO> getAgentProfit(String appIds);
+
+    String saveRecordAndChangeUser(DyzAdRecordParam param, YtDyzUser user);
+
+    List<YtDyzAdRecord> queryRecordByIds(List<String> adRecordIds);
 }

+ 41 - 19
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/service/impl/AdServiceImpl.java

@@ -4,29 +4,26 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
 import com.ytpm.advertise.enums.AdPlatformTypeEnum;
 import com.ytpm.advertise.enums.AdSourceTypeEnum;
+import com.ytpm.agent.enums.AdRecordEnum;
 import com.ytpm.agent.enums.UserStatusEnum;
 import com.ytpm.agent.view.AgentAdGroupStaticsVO;
 import com.ytpm.agent.view.AgentTopCountView;
 import com.ytpm.app.model.YtDyzAdRecord;
 import com.ytpm.app.model.YtDyzUser;
 import com.ytpm.app.param.DyzAdRecordParam;
-import com.ytpm.arithmetic.dao.AdRecordMapper;
-import com.ytpm.arithmetic.dao.AppUserMapper;
-import com.ytpm.arithmetic.service.AdService;
+import com.ytpm.app.view.WxDefaultConfig;
 import com.ytpm.feign.RiskFeign;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.StatusCode;
-import com.ytpm.middle.view.AppRankingListVO;
-import com.ytpm.middle.view.AppRevenueHourVO;
-import com.ytpm.middle.view.AppUserHourVO;
-import com.ytpm.middle.view.DashboardAppRevenueVO;
-import com.ytpm.middle.view.DashboardRankingListVO;
-import com.ytpm.middle.view.DashboardRevenueVO;
-import com.ytpm.middle.view.DashboardRiskVO;
-import com.ytpm.middle.view.UserRankingListVO;
+import com.ytpm.arithmetic.dao.AdRecordMapper;
+import com.ytpm.arithmetic.dao.AppUserMapper;
+import com.ytpm.arithmetic.service.AdService;
+import com.ytpm.middle.view.*;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -49,6 +46,7 @@ import java.util.Objects;
 import java.util.concurrent.CountDownLatch;
 import java.util.stream.Collectors;
 
+@Slf4j
 @Service
 @RefreshScope
 public class AdServiceImpl implements AdService {
@@ -60,9 +58,9 @@ public class AdServiceImpl implements AdService {
 
     @Value(" ${risk.config.banned.tips}")
     private String tips;
-
     @Autowired
     private RiskFeign riskFeign;
+
     /**
      * 保存广告记录
      */
@@ -70,6 +68,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);
         }
@@ -79,9 +78,22 @@ public class AdServiceImpl implements AdService {
         saveRecordAndChangeUser(param, user);
         //调用风控广告校验
         if(AdSourceTypeEnum.rewarded_video.getAdSourceType() == param.getAdSourceType()){
+            WxDefaultConfig config = appUserMapper.getDefaultConfigByAppId(user.getAppId());
+            String format = StrUtil.emptyToDefault(config.getTaskLimitTip(), "当前设备完成任务次数过多,请{}后重试!");
+            user.setPowerLimitTip(format);
             Result<?> result = riskFeign.checkAdRisk(user);
-            if(result.getCode()!=200){
-                return new Result<>(StatusCode.ACCESS_ERR, getTipsMsg());
+            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;
             }
         }
         return Result.resultOk(RepMessage.SAVE_SUCCESS);
@@ -233,17 +245,15 @@ public class AdServiceImpl implements AdService {
         cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),actualMaximum,23,59,59);
         String lastDay = sdf.format(cal.getTime());
         List<YtDyzAdRecord> dyzMonthRecords = adRecordMapper.getTodayRecord(appIds,firstDay,lastDay);
-
         if(CollUtil.isNotEmpty(dyzMonthRecords)){monthRecords.addAll(dyzMonthRecords);}
         records = monthRecords.stream().filter(
                 s->DateUtil.isSameDay(DateUtil.parse(s.getFinishTime()),new Date())).collect(Collectors.toList());
 
-        cal = Calendar.getInstance();
+        cal = Calendar.getInstance(); // 获取当前日期时间
         cal.add(Calendar.DATE, -1); // 昨天的日期时间
         Date yest = cal.getTime();
         yestRecords = monthRecords.stream().filter(
                 s->DateUtil.isSameDay(DateUtil.parse(s.getFinishTime()),yest)).collect(Collectors.toList());
-
         //广告平台分组
         Map<String, List<YtDyzAdRecord>> networkMap = records.stream().collect(
                 Collectors.groupingBy(YtDyzAdRecord::getNetworkFormId));
@@ -288,7 +298,8 @@ public class AdServiceImpl implements AdService {
      *  始终创建新的事务以保障子方法的独立事务
      */
 //    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
-    public void saveRecordAndChangeUser(DyzAdRecordParam param,YtDyzUser user) {
+    @Override
+    public String saveRecordAndChangeUser(DyzAdRecordParam param, YtDyzUser user) {
         //增加广告记录
         YtDyzAdRecord adRecord = new YtDyzAdRecord();
         if(Objects.isNull(param.getBeginTime())){
@@ -297,12 +308,23 @@ public class AdServiceImpl implements AdService {
         BeanUtils.copyProperties(param, adRecord);
         adRecord.setRecordId(IdUtil.fastSimpleUUID());
         adRecord.setNetworkName(AdPlatformTypeEnum.getDesc(Integer.parseInt(param.getNetworkFormId())));
-        adRecordMapper.addOne(adRecord);
+        if (param.getLoginStatus() != null && AdRecordEnum.LOGIN_BEFORE.getCode().equals(param.getLoginStatus())) {
+            adRecordMapper.addOneVisitor(adRecord);
+        } else {
+            adRecordMapper.addOne(adRecord);
+        }
         //修改用户信息, 广告次数+1  总收益 + revenue
         YtDyzUser dyzUser = new YtDyzUser();
         dyzUser.setUserId(user.getUserId());
         dyzUser.setTotalVideo(Objects.isNull(user.getTotalVideo())?1:(user.getTotalVideo()+1));
         dyzUser.setTotalIncome(user.getTotalIncome().add(param.getRevenue()));
         appUserMapper.updateUser(dyzUser);
+        return adRecord.getRecordId();
     }
+
+    @Override
+    public List<YtDyzAdRecord> queryRecordByIds(List<String> adRecordIds) {
+        return adRecordMapper.selectRecordByIds(AdRecordEnum.LOGIN_BEFORE.getCode(), adRecordIds);
+    }
+
 }

+ 49 - 4
yt-arithmetic/arithmetic-service/src/main/java/com/ytpm/arithmetic/service/impl/VisitorLoginServiceImpl.java

@@ -1,30 +1,38 @@
 package com.ytpm.arithmetic.service.impl;
 
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
+import com.ytpm.agent.enums.AdRecordEnum;
 import com.ytpm.agent.enums.UserStatusEnum;
 import com.ytpm.app.enums.LoginType;
 import com.ytpm.app.model.YtDyzLoginRecord;
 import com.ytpm.app.model.YtDyzUser;
+import com.ytpm.app.param.DyzAdRecordParam;
 import com.ytpm.app.param.LoginParam;
+import com.ytpm.app.param.VisitorLoginParam;
 import com.ytpm.app.view.WxDefaultConfig;
 import com.ytpm.arithmetic.dao.AppUserMapper;
 import com.ytpm.arithmetic.dao.LoginRecordMapper;
 import com.ytpm.arithmetic.dao.QuestionMapper;
 import com.ytpm.arithmetic.redis.RedisService;
+import com.ytpm.arithmetic.service.AdService;
 import com.ytpm.constant.StrConstant;
 import com.ytpm.feign.RiskFeign;
+import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.handle.AbstractLoginService;
 import com.ytpm.handle.CommonException;
+import com.ytpm.handle.CustomerException;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -48,6 +56,8 @@ public class VisitorLoginServiceImpl extends AbstractLoginService  {
     private RiskFeign riskFeign;
     @Autowired
     private RedisService redisService;
+    @Autowired
+    private AdService adService;
 
     @Override
     protected WxDefaultConfig getLoginConfig(Integer appType) {
@@ -67,6 +77,20 @@ public class VisitorLoginServiceImpl extends AbstractLoginService  {
         return LoginType.VISITOR;
     }
 
+    @Override
+    protected void updateUserStatus(YtDyzUser ytDyzUser, UserStatusEnum statusEnum, String reason) {
+        if (ytDyzUser != null) {
+            YtDyzUser newUser = new YtDyzUser();
+            newUser.setUserId(ytDyzUser.getUserId());
+            newUser.setUserStatus(statusEnum.getCode());
+            newUser.setRiskReason(reason);
+            if(UserStatusEnum.NORMAL == statusEnum){
+                newUser.setRiskReason("");
+            }
+            appUserMapper.updateUser(newUser);
+        }
+    }
+
     @Override
     protected void validateParams(LoginParam loginParam, HttpServletRequest request) {
 
@@ -142,6 +166,7 @@ public class VisitorLoginServiceImpl extends AbstractLoginService  {
      */
     @Override
     protected void setExtInfo(YtDyzUser old, Map<String, Object> paramMap) {
+        super.setExtInfo(old, paramMap);
         old.setLastQuestionId(questionMapper.getLastQuestionId(old.getUserId()));
         old.setTodayAnswerCount(questionMapper.getAnswerCount(old.getUserId(), 1));
         old.setHistoryAnswerCount(questionMapper.getAnswerCount(old.getUserId(), 2));
@@ -149,10 +174,30 @@ public class VisitorLoginServiceImpl extends AbstractLoginService  {
         old.setLoginRecordList(loginRecordMapper.getLoginRecords(old.getUserId()));
     }
 
-    @Override
-    protected void beforeDeadWithUserCrud(LoginParam loginParam, YtDyzUser ytDyzUser, Map<String, Object> paramMap) {
-        super.beforeDeadWithUserCrud(loginParam, ytDyzUser, paramMap);
-        // 新增风控 相关广告源记录 ecpm  和预估收益 小于 各自 阈值,登陆返回 301
 
+    // 仅保存登陆时的三条广告信息 并传入登陆实体用于后续 risk风控校验
+    protected void saveVisitorAdRecord(YtDyzUser ytDyzUser, LoginParam loginParam, WxDefaultConfig defaultConfig) {
+        super.saveVisitorAdRecord(ytDyzUser, loginParam, defaultConfig);
+        VisitorLoginParam visitorLoginParam = (VisitorLoginParam) loginParam;
+        List<DyzAdRecordParam> preAdList = visitorLoginParam.getPreAdList();
+        List<String> adRecordIds = new ArrayList<>();
+        if (CollUtil.isNotEmpty(preAdList)) {
+            for (DyzAdRecordParam adRecordParam : preAdList) {
+                if (adRecordParam == null) {
+                    continue;
+                }
+                adRecordParam.setUserId(ytDyzUser.getUserId());
+                adRecordParam.setNickName(ytDyzUser.getNickName());
+                adRecordParam.setAppId(ytDyzUser.getAppId());
+                adRecordParam.setLoginStatus(AdRecordEnum.LOGIN_BEFORE.getCode());
+                String recordId = adService.saveRecordAndChangeUser(adRecordParam, ytDyzUser);
+                adRecordIds.add(recordId);
+            }
+        }
+        if(CollUtil.isEmpty(adRecordIds)) {
+            throw new CustomerException(StrUtil.emptyToDefault(defaultConfig.getLowValueTip(), RepMessage.RISK_VISITOR_LOWER_VALUE));
+        }
+        ytDyzUser.setPreAdRecordList(adService.queryRecordByIds(adRecordIds));
     }
+
 }

+ 112 - 60
yt-arithmetic/arithmetic-service/src/main/resources/mapper/AdRecordMapper.xml

@@ -5,46 +5,86 @@
     <insert id="addOne">
         insert into yt_dyz_ad_record
         (
-         record_id,
-         user_id,
-         nick_name,
-         placement_id,
-         ad_source_id,
-         revenue,
-         network_form_id,
-         network_name,
-         network_placement_id,
-         begin_time,
-         finish_time,
-         result_json,
-         ad_source_index,
-         ad_source_type,
-         ecpm,
-         app_id
+            record_id,
+            user_id,
+            nick_name,
+            placement_id,
+            ad_source_id,
+            revenue,
+            network_form_id,
+            network_name,
+            network_placement_id,
+            begin_time,
+            finish_time,
+            result_json,
+            ad_source_index,
+            ad_source_type,
+            ecpm,
+            app_id
         )
         values
+            (
+                #{recordId},
+                #{userId},
+                #{nickName},
+                #{placementId},
+                #{adSourceId},
+                #{revenue},
+                #{networkFormId},
+                #{networkName},
+                #{networkPlacementId},
+                ifnull(#{beginTime}, now()),
+                ifnull(#{finishTime}, now()),
+                #{resultJson},
+                #{adSourceIndex},
+                #{adSourceType},
+                #{ecpm},
+                #{appId}
+            )
+    </insert>
+    <insert id="addOneVisitor">
+        insert into yt_dyz_ad_record_visitor
         (
-         #{recordId},
-         #{userId},
-         #{nickName},
-         #{placementId},
-         #{adSourceId},
-         #{revenue},
-         #{networkFormId},
-         #{networkName},
-         #{networkPlacementId},
-         ifnull(#{beginTime}, now()),
-         ifnull(#{finishTime}, now()),
-         #{resultJson},
-         #{adSourceIndex},
-         #{adSourceType},
-         #{ecpm},
-         #{appId}
+            record_id,
+            user_id,
+            nick_name,
+            placement_id,
+            ad_source_id,
+            revenue,
+            network_form_id,
+            network_name,
+            network_placement_id,
+            begin_time,
+            finish_time,
+            result_json,
+            ad_source_index,
+            ad_source_type,
+            ecpm,
+            app_id
         )
+        values
+            (
+                #{recordId},
+                #{userId},
+                #{nickName},
+                #{placementId},
+                #{adSourceId},
+                #{revenue},
+                #{networkFormId},
+                #{networkName},
+                #{networkPlacementId},
+                ifnull(#{beginTime}, now()),
+                ifnull(#{finishTime}, now()),
+                #{resultJson},
+                #{adSourceIndex},
+                #{adSourceType},
+                #{ecpm},
+                #{appId}
+            )
     </insert>
     <select id="countByAppIds" resultType="java.lang.Integer">
         select
-            count(record_id)
+        count(record_id)
         from yt_dyz_ad_record
         where ad_source_type = 1 and app_id in
         <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
@@ -53,48 +93,48 @@
     </select>
     <select id="getByUserId" resultType="com.ytpm.app.model.YtDyzAdRecord">
         select
-            record_id, user_id,app_id, nick_name, placement_id, ad_source_id, revenue, network_form_id, network_name, network_placement_id, finish_time, begin_time,result_json,ad_source_type,ad_source_index,ecpm
+        record_id, user_id,app_id, nick_name, placement_id, ad_source_id, revenue, network_form_id, network_name, network_placement_id, finish_time, begin_time,result_json,ad_source_type,ad_source_index,ecpm
         from yt_dyz_ad_record
         where user_id = #{userId}
-          <if test="adsourceType != null and adsourceType!=888">
-              and ad_source_type = #{adsourceType}
-          </if>
+        <if test="adsourceType != null and adsourceType!=888">
+            and ad_source_type = #{adsourceType}
+        </if>
         order by finish_time desc
     </select>
     <select id="getByUserIds" resultType="com.ytpm.app.model.YtDyzAdRecord">
         select
-            record_id, user_id,app_id, nick_name, placement_id, ad_source_id, revenue, network_form_id, network_name, network_placement_id, finish_time, begin_time,result_json,ad_source_type,ad_source_index,ecpm
+        record_id, user_id,app_id, nick_name, placement_id, ad_source_id, revenue, network_form_id, network_name, network_placement_id, finish_time, begin_time,result_json,ad_source_type,ad_source_index,ecpm
         from yt_dyz_ad_record
         where user_id in
-              <foreach collection="userIds.split(',')" open="(" close=")" separator="," item="item">
-                  #{item}
-              </foreach>
+        <foreach collection="userIds.split(',')" open="(" close=")" separator="," item="item">
+            #{item}
+        </foreach>
         order by finish_time
     </select>
     <select id="getHourRevenue" resultType="com.ytpm.middle.view.AppRevenueHourVO">
         SELECT
-            HOUR(finish_time) `hour`,
-            DATE_FORMAT(finish_time,'%Y-%m-%d %H:00:00') as `time`,
-            sum( revenue ) revenue
+        HOUR(finish_time) `hour`,
+        DATE_FORMAT(finish_time,'%Y-%m-%d %H:00:00') as `time`,
+        sum( revenue ) revenue
         FROM
-            yt_dyz_ad_record
+        yt_dyz_ad_record
         WHERE
-            app_id = #{appId}
-            <if test="type != null and type ==1">
-                and DATE(finish_time) = DATE(now())
-            </if>
-            <if test="type != null and type ==2">
-                and DATE(finish_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
-            </if>
-            <if test="type != null and type ==3">
-                and DATE_FORMAT(finish_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
-            </if>
+        app_id = #{appId}
+        <if test="type != null and type ==1">
+            and DATE(finish_time) = DATE(now())
+        </if>
+        <if test="type != null and type ==2">
+            and DATE(finish_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
+        </if>
+        <if test="type != null and type ==3">
+            and DATE_FORMAT(finish_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
+        </if>
         GROUP BY
-            `hour`
+        `hour`
     </select>
     <select id="getRevenueByTime" resultType="java.math.BigDecimal">
         select
-            sum(ar.revenue)
+        sum(ar.revenue)
         from yt_dyz_ad_record ar
         join yt_dyz_user au on ar.user_id = au.user_id
         <where>
@@ -117,16 +157,16 @@
                 </foreach>
             </if>
             <if test="registryTimeBegin != null ">
-                and DATE_FORMAT(au.registry_time,'%Y-%m-%d') <![CDATA[>=]]> #{registryTimeBegin}
+                and au.registry_time <![CDATA[>=]]> #{registryTimeBegin}
             </if>
             <if test="registryTimeEnd != null ">
-                and DATE_FORMAT(au.registry_time,'%Y-%m-%d') <![CDATA[<=]]> #{registryTimeEnd}
+                and au.registry_time <![CDATA[<=]]> #{registryTimeEnd}
             </if>
         </where>
     </select>
     <select id="getTodayRecord" resultType="com.ytpm.app.model.YtDyzAdRecord">
         select
-            record_id, user_id, app_id, nick_name, placement_id, ad_source_id, ad_source_type, ad_source_index, revenue, ecpm, network_form_id, network_name, network_placement_id, finish_time, begin_time, result_json
+        record_id, user_id, app_id, nick_name, placement_id, ad_source_id, ad_source_type, ad_source_index, revenue, ecpm, network_form_id, network_name, network_placement_id, finish_time, begin_time, result_json
         from yt_dyz_ad_record
         where app_id in
         <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
@@ -139,4 +179,16 @@
             and finish_time <![CDATA[<=]]> #{lastDay}
         </if>
     </select>
+    <select id="selectRecordByIds" resultType="com.ytpm.app.model.YtDyzAdRecord">
+        select
+        record_id, user_id, app_id, nick_name, placement_id, ad_source_id, ad_source_type, ad_source_index,
+        revenue, ecpm, network_form_id, network_name, network_placement_id, finish_time, begin_time, result_json
+        <if test="loginStatus != null and loginStatus == 1">
+            from yt_dyz_ad_record_visitor
+        </if>
+        <if test="loginStatus == null or loginStatus != 1">
+            from yt_dyz_ad_record
+        </if>
+        where record_id in <foreach collection="ids" item="id" open="(" close=")" separator=",">#{id}</foreach>
+    </select>
 </mapper>

+ 188 - 149
yt-arithmetic/arithmetic-service/src/main/resources/mapper/AppUserMapper.xml

@@ -4,90 +4,90 @@
     <insert id="addOne" parameterType="com.ytpm.app.model.YtDyzUser">
         insert into yt_dyz_user
         (
-         user_id,
-         nick_name,
-         head_img,
-         registry_time,
-         last_login_time,
-         last_login_ip,
-         login_days,
-         total_video,
-         total_income,
-         red_packet_balance,
-         red_packet_amount,
-         points_balance,
-         points_total,
-         withdraw_total,
-         sign_days,
-         user_status,
-         risk_reason,
-         wx_open_id,
-         ditch_id,
-         platform_id,
-         app_id,
-         power,
-         phone,
-         phone_json,
-         device_id
+            user_id,
+            nick_name,
+            head_img,
+            registry_time,
+            last_login_time,
+            last_login_ip,
+            login_days,
+            total_video,
+            total_income,
+            red_packet_balance,
+            red_packet_amount,
+            points_balance,
+            points_total,
+            withdraw_total,
+            sign_days,
+            user_status,
+            risk_reason,
+            wx_open_id,
+            ditch_id,
+            platform_id,
+            app_id,
+            power,
+            phone,
+            phone_json,
+            device_id
         )
         values
-        (
-         #{userId},
-         #{nickName},
-         #{headImg},
-         #{registryTime},
-         #{lastLoginTime},
-         #{lastLoginIp},
-         #{loginDays},
-         #{totalVideo},
-         #{totalIncome},
-         #{redPacketBalance},
-         #{redPacketAmount},
-         #{pointsBalance},
-         #{pointsTotal},
-         #{withdrawTotal},
-         #{signDays},
-         #{userStatus},
-         #{riskReason},
-         #{wxOpenId},
-         #{ditchId},
-         #{platformId},
-         #{appId},
-         #{power},
-         #{phone},
-         #{phoneJson},
-         #{deviceId}
-        )
+            (
+                #{userId},
+                #{nickName},
+                #{headImg},
+                #{registryTime},
+                #{lastLoginTime},
+                #{lastLoginIp},
+                #{loginDays},
+                #{totalVideo},
+                #{totalIncome},
+                #{redPacketBalance},
+                #{redPacketAmount},
+                #{pointsBalance},
+                #{pointsTotal},
+                #{withdrawTotal},
+                #{signDays},
+                #{userStatus},
+                #{riskReason},
+                #{wxOpenId},
+                #{ditchId},
+                #{platformId},
+                #{appId},
+                #{power},
+                #{phone},
+                #{phoneJson},
+                #{deviceId}
+            )
     </insert>
     <insert id="addPowerRecord">
         insert into yt_dyz_power_record
         (
-         record_id, user_id, type, remark, add_time
+            record_id, user_id, type, remark, add_time
         )
         values
-        (
-         #{recordId},#{userId},#{type},#{remark},#{addTime}
-        )
+            (
+                #{recordId},#{userId},#{type},#{remark},#{addTime}
+            )
     </insert>
     <insert id="saveAppConfig">
         insert into yt_app_default_config
         (
-         config_name,
-         open_id,
-         secret,
-         app_id,
-         app_key,
-         app_type
+            config_name,
+            open_id,
+            secret,
+            app_id,
+            app_key,
+            app_type
         )
         values
-        (
-         #{configName},
-         #{openId},
-         #{secret},
-         #{appId},
-         #{appKey},
-         #{appType}
-        )
+            (
+                #{configName},
+                #{openId},
+                #{secret},
+                #{appId},
+                #{appKey},
+                #{appType}
+            )
     </insert>
     <update id="updateAppConfig">
         update yt_app_default_config
@@ -149,6 +149,24 @@
             <if test="interstitialIntervalTime != null">
                 interstitial_interval_time = #{interstitialIntervalTime}
             </if>
+            <if test="flowIntervalTime != null">
+                flow_interval_time = #{flowIntervalTime}
+            </if>
+            <if test="taskLimitTip != null">
+                task_limit_tip = #{taskLimitTip}
+            </if>
+            <if test="lowValueTip != null">
+                low_value_tip = #{lowValueTip}
+            </if>
+            <if test="brushTip != null">
+                brush_tip = #{brushTip}
+            </if>
+            <if test="startWaitTime != null">
+                start_wait_time = #{startWaitTime}
+            </if>
+            <if test="canCacheVideo != null">
+                can_cache_video = #{canCacheVideo}
+            </if>
         </set>
         where app_id = #{appId}
     </update>
@@ -232,14 +250,14 @@
     </delete>
     <select id="getYtAppUser" resultType="com.ytpm.app.model.YtDyzUser">
         select
-           user_id, app_id,phone,device_id, ditch_id, nick_name,head_img, power, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, platform_id
+            user_id, app_id,phone,device_id, ditch_id, nick_name,head_img, power, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, platform_id
         from yt_dyz_user
         where wx_open_id = #{openid}
-        and ditch_id = #{ditchId}
+          and ditch_id = #{ditchId}
     </select>
     <select id="queryAll" resultType="com.ytpm.app.view.YtAppUserListView">
         select
-            user_id,app_id,phone,device_id, ditch_id, nick_name,head_img, power, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, platform_id
+        user_id,app_id,phone,device_id, ditch_id, nick_name,head_img, power, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, platform_id
         from yt_dyz_user
         where 1 = 1
         <if test="userId != null and userId !=''">
@@ -268,9 +286,9 @@
         </if>
         <if test="appIds != null and appIds != ''">
             and app_id in
-                <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
-                    #{item}
-                </foreach>
+            <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
+                #{item}
+            </foreach>
         </if>
         order by user_id desc
     </select>
@@ -318,37 +336,37 @@
     </resultMap>
     <select id="getUserList" resultMap="UserMap">
         select
-            du.user_id,
-            du.head_img,
-            du.nick_name,
-            du.phone,
-            du.device_id,
-            du.registry_time,
-            du.last_login_time,
-            du.last_login_ip,
-            du.login_days,
-            du.total_video,
-            du.total_income,
-            du.red_packet_balance,
-            du.red_packet_amount,
-            du.points_balance,
-            du.points_total,
-            du.withdraw_total,
-            du.sign_days,
-            du.user_status,
-            du.risk_reason,
-            du.wx_open_id,
-            du.ditch_id,
-            du.app_id,
-            du.platform_id,
-            du.power,
-            lr.record_id,
-            lr.login_time,
-            lr.device_brand,
-            lr. device_model,
-            lr.login_ip,
-            lr.operator,
-            lr.ip_addr
+        du.user_id,
+        du.head_img,
+        du.nick_name,
+        du.phone,
+        du.device_id,
+        du.registry_time,
+        du.last_login_time,
+        du.last_login_ip,
+        du.login_days,
+        du.total_video,
+        du.total_income,
+        du.red_packet_balance,
+        du.red_packet_amount,
+        du.points_balance,
+        du.points_total,
+        du.withdraw_total,
+        du.sign_days,
+        du.user_status,
+        du.risk_reason,
+        du.wx_open_id,
+        du.ditch_id,
+        du.app_id,
+        du.platform_id,
+        du.power,
+        lr.record_id,
+        lr.login_time,
+        lr.device_brand,
+        lr. device_model,
+        lr.login_ip,
+        lr.operator,
+        lr.ip_addr
         from yt_dyz_user du
         left join yt_dyz_login_record lr on du.user_id = lr.user_id
         <where>
@@ -428,14 +446,32 @@
     </select>
     <select id="getDefaultConfig" resultType="com.ytpm.app.view.WxDefaultConfig">
         select
-            config_id, config_name, open_id appId, secret, app_id platformAppId, app_key platformAppSecret, 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
+            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,start_wait_time,can_cache_video
         from yt_app_default_config
         where app_type = #{appType}
     </select>
+    <select id="getDefaultConfigByAppId" 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,
+            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
+        from yt_app_default_config
+        where app_id = #{appId}
+    </select>
     <select id="getSecretByAppId" resultType="java.lang.String">
         select
-           secret
+            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,
+            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
         from yt_app_default_config
         where app_id = #{appId}
     </select>
@@ -450,13 +486,16 @@
             platform_id
         from yt_dyz_user
         where device_id = #{deviceId}
-        and wx_open_id = #{openid}
+          and wx_open_id = #{openid}
         limit 1
     </select>
     <select id="getConfigByIds" 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, ditch_id, power_wait_time, interstitial_interval_time
+        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
         from yt_app_default_config
         where app_id in
         <foreach collection="appIds.split(',')" item="item" separator="," open="(" close=")">
@@ -465,7 +504,7 @@
     </select>
     <select id="getAdCount" resultType="java.lang.Integer">
         select
-            sum(total_video)
+        sum(total_video)
         from yt_dyz_user
         where app_id in
         <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
@@ -483,11 +522,11 @@
     </select>
     <select id="getAppRanking" resultType="com.ytpm.middle.view.AppRankingListVO">
         SELECT
-            u.app_id,
-            sum( ar.revenue ) totalRevenue
+        u.app_id,
+        sum( ar.revenue ) totalRevenue
         FROM
-            yt_dyz_ad_record ar
-            JOIN yt_dyz_user u ON ar.user_id = u.user_id
+        yt_dyz_ad_record ar
+        JOIN yt_dyz_user u ON ar.user_id = u.user_id
         <where>
             <if test="sortBy != null">
                 <choose>
@@ -504,21 +543,21 @@
             </if>
         </where>
         GROUP BY
-            u.app_id
+        u.app_id
         ORDER BY
-            sum( ar.revenue ) DESC
+        sum( ar.revenue ) DESC
         LIMIT #{limit}
     </select>
     <select id="getUserRanking" resultType="com.ytpm.middle.view.UserRankingListVO">
         SELECT
-            u.user_id,
-            u.nick_name,
-            u.head_img,
-            u.total_video,
-            sum( ar.revenue ) totalIncome
+        u.user_id,
+        u.nick_name,
+        u.head_img,
+        u.total_video,
+        sum( ar.revenue ) totalIncome
         FROM
-            yt_dyz_ad_record ar
-                JOIN yt_dyz_user u ON ar.user_id = u.user_id
+        yt_dyz_ad_record ar
+        JOIN yt_dyz_user u ON ar.user_id = u.user_id
         <where>
             <if test="sortBy != null">
                 <choose>
@@ -536,12 +575,12 @@
         </where>
         GROUP BY ar.user_id
         ORDER BY
-            sum( ar.revenue ) DESC
+        sum( ar.revenue ) DESC
         limit #{limit}
     </select>
     <select id="countUserByAppIds" resultType="java.lang.Integer">
         select
-            count(user_id)
+        count(user_id)
         from yt_dyz_user
         where app_id in
         <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
@@ -550,7 +589,7 @@
     </select>
     <select id="countRevenueByAppIds" resultType="java.math.BigDecimal">
         select
-            sum(total_income)
+        sum(total_income)
         from yt_dyz_user
         where app_id in
         <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
@@ -559,7 +598,7 @@
     </select>
     <select id="countBannedByAppIds" resultType="java.lang.Integer">
         select
-            count(user_id)
+        count(user_id)
         from yt_dyz_user
         where user_status > 1 and app_id in
         <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
@@ -598,8 +637,8 @@
     </select>
     <select id="countRegistryHour" resultType="com.ytpm.middle.view.AppUserHourVO">
         select
-            DATE_FORMAT(registry_time,'%Y-%m-%d %H:00:00') as `time`,
-            count(user_id) `count`
+        DATE_FORMAT(registry_time,'%Y-%m-%d %H:00:00') as `time`,
+        count(user_id) `count`
         from yt_dyz_user
         where app_id = #{appId}
         <if test="type != null and type ==1">
@@ -632,7 +671,7 @@
     </select>
     <select id="queryByUserIds" resultType="com.ytpm.app.model.YtDyzUser">
         select
-            user_id, head_img, nick_name, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, ditch_id, app_id, platform_id, power, phone, device_id
+        user_id, head_img, nick_name, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, ditch_id, app_id, platform_id, power, phone, device_id
         from yt_dyz_user
         where user_id in
         <foreach collection="userIds.split(',')" separator="," item="item"  open="(" close=")">
@@ -660,21 +699,21 @@
     </resultMap>
     <select id="queryTodayUserAd" resultMap="UserAdMap">
         select
-            u.user_id,
-            u.app_id,
-            u.nick_name,
-            ar.record_id,
-            ar.placement_id,
-            ar.ad_source_id,
-            ar.ad_source_type,
-            ar.ad_source_index,
-            ar.revenue,
-            ar.ecpm,
-            ar.network_form_id,
-            ar.network_name,
-            ar.network_placement_id,
-            ar.finish_time,
-            ar.begin_time
+        u.user_id,
+        u.app_id,
+        u.nick_name,
+        ar.record_id,
+        ar.placement_id,
+        ar.ad_source_id,
+        ar.ad_source_type,
+        ar.ad_source_index,
+        ar.revenue,
+        ar.ecpm,
+        ar.network_form_id,
+        ar.network_name,
+        ar.network_placement_id,
+        ar.finish_time,
+        ar.begin_time
         from yt_dyz_ad_record ar
         join yt_dyz_user u on ar.user_id = u.user_id
         where ar.ad_source_type = #{adSourceType} and ar.app_id = #{appId} and ar.user_id in

+ 22 - 20
yt-arithmetic/arithmetic-service/src/main/resources/mapper/LoginRecordMapper.xml

@@ -5,28 +5,30 @@
     <insert id="insertOne" parameterType="com.ytpm.app.model.YtDyzLoginRecord">
         insert into yt_dyz_login_record
         (
-         record_id,
-         user_id,
-         login_time,
-         device_brand,
-         device_model,
-         login_ip,
-         operator,
-         ip_addr,
-         phone_json
+            record_id,
+            user_id,
+            login_time,
+            device_brand,
+            device_model,
+            login_ip,
+            operator,
+            ip_addr,
+            phone_json,
+            login_type
         )
         values
-        (
-         #{recordId},
-         #{userId},
-         #{loginTime},
-         #{deviceBrand},
-         #{deviceModel},
-         #{loginIp},
-         #{operator},
-         #{ipAddr},
-         #{phoneJson}
-         );
+            (
+                #{recordId},
+                #{userId},
+                #{loginTime},
+                #{deviceBrand},
+                #{deviceModel},
+                #{loginIp},
+                #{operator},
+                #{ipAddr},
+                #{phoneJson},
+                #{loginType}
+            );
     </insert>
     <select id="getLoginRecords" resultType="com.ytpm.app.model.YtDyzLoginRecord">
         select