Administrator
2025-02-13 d248fcaf389ae5c763926955d7ba0cfa80fc002f
区域封禁
7个文件已修改
113 ■■■■ 已修改文件
src/main/java/com/taoke/autopay/controller/WebApiController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/entity/KeyOrder.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/utils/IPUtil.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/vo/SubmitKeyInfo.java 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/KeyOrderMapper.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/controller/WebApiController.java
@@ -49,7 +49,7 @@
    private SystemConfigService systemConfigService;
    private void addKey(SubmitKeyInfo keyInfo, Long wxUid, String ip, IPUtil.IPInfo ipInfo) throws KeyVerifyException, KeyOrderException, WxOrderCountException {
    private void addKey(SubmitKeyInfo keyInfo, Long wxUid) throws KeyVerifyException, KeyOrderException, WxOrderCountException {
        // 查询没有处理的数量
        long notProcessCount = keyOrderService.countUserNotDoOrder(wxUid, new Date(System.currentTimeMillis() - 1000*60*30));
@@ -65,7 +65,7 @@
        if (verifyAlipayKey != null && verifyAlipayKey.trim().equalsIgnoreCase("1")) {
            try {
                // 需要验证支付宝口令
                if (urllist.size() < 1) {
                if (urllist.isEmpty()) {
                    throw new Exception("口令中不包含链接");
                }
                AlipayOrderUtil.AlipayOrderTradeInfo tradeInfo = AlipayOrderUtil.getTradeInfo(urllist.get(0));
@@ -140,6 +140,7 @@
                throw new RuntimeException(e);
            }
        }
        keyInfo.setIpInfo(ipInfoMap.get(ip));
        String citys =  systemConfigService.getValueCache(SystemConfigKeyEnum.FORBIDDEN_SUBMIT_CITYS);
        if(citys!=null&&ipInfoMap.get(ip)!=null){
@@ -185,7 +186,7 @@
        wxLogger.info("微信有授权:" + session.getId());
        LogUtil.loggerDebug.warn("GEO信息:{}-{}-{}", user.getId(),ip, new Gson().toJson(ipInfoMap.get(ip)));
        try {
            addKey(keyInfo, user.getId(),ip, ipInfoMap.get(ip));
            addKey(keyInfo, user.getId());
            return JsonUtil.loadTrueResult("");
        } catch (KeyOrderException e) {
            e.printStackTrace();
@@ -253,7 +254,7 @@
                            throw new RuntimeException(e);
                        }
                    }
                    addKey(alipayKeyInfo, user.getId(),alipayKeyInfo.getIp(),ipInfoMap.get(alipayKeyInfo.getIp()));
                    addKey(alipayKeyInfo, user.getId());
                }
                response.sendRedirect(successLink);
                return;
src/main/java/com/taoke/autopay/entity/KeyOrder.java
@@ -71,5 +71,11 @@
    @Column(name = "pay_merchant")
    private String payMerchant;
    @Column(name = "ip")
    private String ip;
    @Column(name = "ip_info")
    private String ipInfo;
    private WxUserInfo user;
}
src/main/java/com/taoke/autopay/service/impl/KeyOrderServiceImpl.java
@@ -1,5 +1,6 @@
package com.taoke.autopay.service.impl;
import com.google.gson.Gson;
import com.taoke.autopay.dao.KeyOrderMapper;
import com.taoke.autopay.dao.WxUserSettingsMapper;
import com.taoke.autopay.dto.ChannelOrderStatistic;
@@ -138,9 +139,11 @@
            order.setOrderNo(orderDto.getOrder_id());
        }
        order.setIp(keyInfo.getIp());
        if(keyInfo.getIpInfo()!=null) {
            order.setIpInfo(new Gson().toJson(keyInfo.getIpInfo()));
        }
        keyOrderMapper.insertSelective(order);
        return order;
    }
src/main/java/com/taoke/autopay/utils/IPUtil.java
@@ -1,10 +1,12 @@
package com.taoke.autopay.utils;
import com.google.gson.Gson;
import lombok.Data;
import net.sf.json.JSONObject;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.net.URLEncoder;
public class IPUtil {
@@ -63,7 +65,8 @@
        }
    }
    public static class IPInfo {
    @Data
    public static class IPInfo implements Serializable {
        private String province;
        private String city;
        private String country;
@@ -71,30 +74,6 @@
        public IPInfo(String country, String province, String city) {
            this.province = province;
            this.city = city;
            this.country = country;
        }
        public String getProvince() {
            return province;
        }
        public void setProvince(String province) {
            this.province = province;
        }
        public String getCity() {
            return city;
        }
        public void setCity(String city) {
            this.city = city;
        }
        public String getCountry() {
            return country;
        }
        public void setCountry(String country) {
            this.country = country;
        }
    }
src/main/java/com/taoke/autopay/vo/SubmitKeyInfo.java
@@ -1,5 +1,8 @@
package com.taoke.autopay.vo;
import com.taoke.autopay.utils.IPUtil;
import lombok.Data;
import java.io.Serializable;
/**
@@ -8,6 +11,7 @@
 * @description: TODO
 * @date 2024/7/9 0:03
 */
@Data
public class SubmitKeyInfo implements Serializable {
    private String key;
@@ -15,6 +19,7 @@
    private String referer;
    private String a;
    private String ip;
    private IPUtil.IPInfo ipInfo;
    public SubmitKeyInfo() {
    }
@@ -26,50 +31,5 @@
    public SubmitKeyInfo(String key, String money) {
        this.key = key;
        this.money = money;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getMoney() {
        return money;
    }
    public void setMoney(String money) {
        this.money = money;
    }
    @Override
    public String toString() {
        return key+"-"+money;
    }
    public String getReferer() {
        return referer;
    }
    public void setReferer(String referer) {
        this.referer = referer;
    }
    public String getA() {
        return a;
    }
    public void setA(String a) {
        this.a = a;
    }
    public String getIp() {
        return ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
}
src/main/resources/application.yml
@@ -1,3 +1,3 @@
spring:
  profiles:
    active: dev
    active: pro
src/main/resources/mapper/KeyOrderMapper.xml
@@ -22,6 +22,8 @@
        <result column="pay_type" property="payType" jdbcType="INTEGER"/>
        <result column="agent_id" property="agentId" jdbcType="BIGINT"/>
        <result column="pay_merchant" property="payMerchant" jdbcType="VARCHAR"/>
        <result column="ip" property="ip" jdbcType="VARCHAR"/>
        <result column="ip_info" property="ipInfo" jdbcType="VARCHAR"/>
        <association property="user" javaType="com.taoke.autopay.entity.WxUserInfo">
            <id column="uid" property="id" jdbcType="BIGINT"/>
            <result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
@@ -38,7 +40,7 @@
        <result column="money" property="money" jdbcType="DECIMAL"/>
    </resultMap>
    <sql id="Base_Column_List">id
    ,uid,`key`,order_type,order_no,order_state,state,state_desc,distribute_client_uid,distribute_time,create_time,update_time,excute_pay_time,pay_time,order_money,order_channel,pay_type,agent_id,pay_merchant</sql>
    ,uid,`key`,order_type,order_no,order_state,state,state_desc,distribute_client_uid,distribute_time,create_time,update_time,excute_pay_time,pay_time,order_money,order_channel,pay_type,agent_id,pay_merchant,ip,ip_info</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>
        from table_order where id = #{id,jdbcType=BIGINT}
@@ -185,6 +187,8 @@
            <if test="payType != null">pay_type,</if>
            <if test="agentId != null">agent_id,</if>
            <if test="payMerchant!=null">pay_merchant,</if>
            <if test="ip!=null">ip,</if>
            <if test="ipInfo!=null">ip_info,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -207,8 +211,8 @@
            <if test="payType != null">#{payType,jdbcType=INTEGER},</if>
            <if test="agentId != null">#{agentId,jdbcType=BIGINT},</if>
            <if test="payMerchant != null">#{payMerchant,jdbcType=VARCHAR},</if>
            <if test="ip != null">#{ip,jdbcType=VARCHAR},</if>
            <if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.taoke.autopay.entity.KeyOrder">update table_order