Prechádzať zdrojové kódy

Merge branch 'master' of https://gitee.com/hcst/adsp-boot

syh 5 rokov pred
rodič
commit
5ff1ec529b

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -9,6 +9,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -23,7 +24,7 @@ public class TestController {
     @Autowired
     private ICreateInternalService createInternalService;
 
-    @GetMapping(value = "/create")
+    @PostMapping(value = "/create")
     public void authorization() {
         JSONObject json = new JSONObject();
         System.err.println(json);

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/TestJob.java

@@ -25,7 +25,6 @@ public class TestJob implements Job {
         options.addArguments("--window-size=1290,1080");
         WebDriver driver = new FirefoxDriver(options);
         try {
-            service.start();
             driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
             driver.manage().timeouts().setScriptTimeout(5, TimeUnit.SECONDS);
             driver.get("http://b.e.kuaishou.com");

+ 8 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java

@@ -33,15 +33,16 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         String url = "https://ad.oceanengine.com/pages/login/index.html";
         System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
         ChromeOptions chromeOptions = new ChromeOptions();
+//        chromeOptions.addArguments("--headless");
+        chromeOptions.addArguments("--incognito");
+        chromeOptions.addArguments("--no-sandbox");
+//        chromeOptions.addArguments("--disable-gpu");
+        chromeOptions.addArguments("--window-size=1920,1080");
+        chromeOptions.addArguments("--user-agent=" + HttpUtils.USER_AGENT);
+        chromeOptions.setAcceptInsecureCerts(true);
         WebDriver webDriver = new ChromeDriver(chromeOptions);
         try {
-            chromeOptions.addArguments("--headless");
-            chromeOptions.addArguments("--incognito");
-            chromeOptions.addArguments("--no-sandbox");
-            chromeOptions.addArguments("--disable-gpu");
-            chromeOptions.addArguments("--window-size=1290,1080");
-            chromeOptions.addArguments("--user-agent=" + HttpUtils.USER_AGENT);
-            chromeOptions.setAcceptInsecureCerts(true);
+
             webDriver.get(url);  //获取登录页面
             for (Cookie cookie : webDriver.manage().getCookies()) {
                 BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());

+ 27 - 18
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouCreateServiceImpl.java

@@ -41,6 +41,8 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
     private KuaiShouGroupCreateLogMapper groupCreateLogMapper;
     @Autowired
     private ICTopOauthTokenService oauthTokenService;
+    @Autowired
+    private KuaiShouCampaignCreateMapper campaignCreateMapper;
 
     @Override
     public Map<String, Object> createGroups(KuaiShouGroupCreateLog groupCreateTemplate) {
@@ -75,27 +77,38 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                 returnMap.put("desc", "请选择广告计划模板");
                 return returnMap;
             }
+
             KuaiShouCampaignTemplate kuaiShouCampaignTemplate = campaignTemplateMapper.selectById(campaignTemplateId); // 广告计划信息
             if (Check.isNull(kuaiShouCampaignTemplate)) {
                 logger.error("查询广告计划为空:模板id:{}", campaignTemplateId);
                 throw new Exception("根据模板id查询创意模板信息为空");
             }
 
-            JSONObject campaignJson = new JSONObject();
-            campaignJson.put("campaign_name", kuaiShouCampaignTemplate.getCampaignName() + "_" + UUID.randomUUID().toString().substring(0, 6));
-            campaignJson.put("type", kuaiShouCampaignTemplate.getType());
-            campaignJson.put("day_budget", kuaiShouCampaignTemplate.getDayBudget());
-
-
-            Map<String, Object> campaignMap = kuaishouInterfaceService.campaignCreate(accessToken, accountId, campaignJson);
-            Integer code = (Integer) campaignMap.get("code");
-            if (code != 0) {
-                returnMap.put("code", -1);
-                returnMap.put("success", false);
-                returnMap.put("desc", "创建广告计划失败");
-                return returnMap;
+            QueryWrapper<KuaiShouCampaignCreate> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", accountId);
+            queryWrapper.eq("campaign_name", kuaiShouCampaignTemplate.getCampaignName());
+            queryWrapper.orderByDesc("create_time");
+            queryWrapper.last("limit 1");
+            KuaiShouCampaignCreate campaignCreate = campaignCreateMapper.selectOne(queryWrapper);
+            Long campaignId;
+            if (Check.isNull(campaignCreate) || Check.isNull(campaignCreate.getCampaignId())) {
+                JSONObject campaignJson = new JSONObject();
+                campaignJson.put("campaign_name", kuaiShouCampaignTemplate.getCampaignName());
+                campaignJson.put("type", kuaiShouCampaignTemplate.getType());
+                campaignJson.put("day_budget", kuaiShouCampaignTemplate.getDayBudget());
+                Map<String, Object> campaignMap = kuaishouInterfaceService.campaignCreate(accessToken, accountId, campaignJson);
+                Integer code = (Integer) campaignMap.get("code");
+                if (code != 0) {
+                    returnMap.put("code", -1);
+                    returnMap.put("success", false);
+                    returnMap.put("desc", "创建广告计划失败");
+                    return returnMap;
+                }
+                campaignId = (Long) campaignMap.get("campaign_id");
+            } else {
+                campaignId = campaignCreate.getCampaignId();
             }
-            Long campaignId = (Long) campaignMap.get("campaign_id");
+
             groupCreateTemplate.setCampaignId(campaignId);
 
             JSONObject groupJson = new JSONObject();
@@ -366,10 +379,6 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
      * @param loginId
      * @return
      */
-
-    @Autowired
-    private KuaiShouCampaignCreateMapper campaignCreateMapper;
-
     @Override
     public JSONArray getOptions(String loginId, Long accountId) {
         JSONArray result = new JSONArray();

+ 2 - 4
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -94,10 +94,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          #          url: jdbc:mysql://192.168.0.23:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          url: jdbc:mysql://192.168.1.200:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
-          password: 123456
+          password: hcst2019
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:
@@ -142,4 +141,3 @@ jeecg:
     video-upload: D://upFiles//video//
     image-upload: D://upFiles//image//
     chrome-driver: D://chromedriver.exe
-    csv-upload: D://upFiles//csv//

+ 21 - 15
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -13,6 +13,10 @@ management:
         include: metrics,httptrace
 
 spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
   mail:
     host: smtp.163.com
     username: jeecgos@163.com
@@ -57,7 +61,6 @@ spring:
   datasource:
     druid:
       stat-view-servlet:
-
         enabled: true
         loginUsername: admin
         loginPassword: 123456
@@ -67,6 +70,8 @@ spring:
       druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
         # 连接池的配置信息
         # 初始化大小,最小,最大
+        connection-init-sql: set names utf8mb4
+
         initial-size: 5
         min-idle: 5
         maxActive: 20
@@ -89,12 +94,13 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: root
-          password: root
+          #          url: jdbc:mysql://192.168.0.23:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: hcst
+          password: hcst2019
           driver-class-name: com.mysql.jdbc.Driver
-          # 多数据源配置   
-          #multi-datasource1: 
+          # 多数据源配置
+          #multi-datasource1:
           #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true
           #username: root
           #password: root
@@ -102,7 +108,7 @@ spring:
   #redis 配置
   redis:
     database: 0
-    host: 192.168.1.199
+    host: 127.0.0.1
     lettuce:
       pool:
         max-active: 8   #最大连接数据库连接数,设 0 为没有限制
@@ -114,8 +120,7 @@ spring:
     port: 6379
 #mybatis plus 设置
 mybatis-plus:
-  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
-
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/kuaishou/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/crawler/modules/**/xml/*Mapper.xml
   global-config:
     # 关闭MP3.0自带的banner
     banner: false
@@ -124,9 +129,9 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-    #configuration:
-    # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
-    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    configuration:
+      # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
+      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
   path:
@@ -134,6 +139,7 @@ jeecg:
     upload: D://upFiles
     #webapp文件路径
     webapp: D://webapp
-logging:
-  level:
-    org.jeecg.modules.system.mapper: debug
+    video-upload: D://upFiles//video//
+    image-upload: D://upFiles//image//
+    chrome-driver: D://chromedriver.exe
+    csv-upload: D://upFiles//csv//

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: prod
+    active: dev
 swagger:
   production: false
   basic:

+ 280 - 0
module-common/src/main/java/cn/com/ctop/common/utils/ImageUtils.java

@@ -0,0 +1,280 @@
+package cn.com.ctop.common.utils;
+
+import javax.imageio.IIOException;
+import javax.imageio.ImageIO;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.TextLayout;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.UUID;
+import java.util.List;
+
+public class ImageUtils {
+    public BufferedImage toBufferedImage(Image image) {
+        if (image instanceof BufferedImage) {
+            return (BufferedImage) image;
+        }
+
+        // This code ensures that all the pixels in the image are loaded
+        image = new ImageIcon(image).getImage();
+
+        // Determine if the image has transparent pixels; for this method's
+        // implementation, see e661 Determining If an Image Has Transparent Pixels
+        //boolean hasAlpha = hasAlpha(image);
+
+        // Create a buffered image with a format that's compatible with the screen
+        BufferedImage bimage = null;
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        try {
+            // Determine the type of transparency of the new buffered image
+            int transparency = Transparency.OPAQUE;
+       /* if (hasAlpha) {
+         transparency = Transparency.BITMASK;
+         }*/
+
+            // Create the buffered image
+            GraphicsDevice gs = ge.getDefaultScreenDevice();
+            GraphicsConfiguration gc = gs.getDefaultConfiguration();
+            bimage = gc.createCompatibleImage(
+                    image.getWidth(null), image.getHeight(null), transparency);
+        } catch (HeadlessException e) {
+            // The system does not have a screen
+        }
+
+        if (bimage == null) {
+            // Create a buffered image using the default color model
+            int type = BufferedImage.TYPE_INT_RGB;
+            //int type = BufferedImage.TYPE_3BYTE_BGR;//by wang
+        /*if (hasAlpha) {
+         type = BufferedImage.TYPE_INT_ARGB;
+         }*/
+            bimage = new BufferedImage(image.getWidth(null), image.getHeight(null), type);
+        }
+
+        // Copy image to buffered image
+        Graphics g = bimage.createGraphics();
+
+        // Paint the image onto the buffered image
+        g.drawImage(image, 0, 0, null);
+        g.dispose();
+
+        return bimage;
+    }
+
+    public void resize(int width, int height, String sourcePath, String targetPath) {
+        File inputFile = new File(sourcePath);
+        File outputFile = new File(targetPath);
+        try {
+            Image sourceImage = ImageIO.read(inputFile);
+            int sourceWidth = sourceImage.getWidth(null);
+            int sourceHeight = sourceImage.getHeight(null);
+            int newWidth = 0;
+            int newHeight = 0;
+            if (sourceWidth / sourceHeight >= width / height) {
+                //放大高度
+                newHeight = height;
+                newWidth = (int) (((float) height / (float) sourceHeight) * sourceWidth);
+            } else {
+                //放大宽度
+                newWidth = width;
+                newHeight = (int) (((float) width / (float) sourceWidth) * sourceHeight);
+            }
+            Image resizeImage = sourceImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH);
+            BufferedImage bufferedImage = toBufferedImage(resizeImage);
+            bufferedImage = bufferedImage.getSubimage((newWidth - width) / 2, (newHeight - height) / 2, width, height);
+            ImageIO.write(bufferedImage, "jpg", outputFile);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    public void addTextInImage(InputStream input, String content, Color color, Font font) throws IOException {
+        Image image = ImageIO.read(input);
+        int width = image.getWidth(null);
+        int height = image.getHeight(null);
+        BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+        Graphics2D graphics2D = bufferedImage.createGraphics();
+        graphics2D.drawImage(image, 0, 0, width, height, null);
+        graphics2D.setColor(color);
+        graphics2D.setFont(font);
+
+        Image borderImage = ImageIO.read(new File("D:/border/images/white01.png"));
+//        BufferedImage bufferedImage2 = new BufferedImage(borderImage.getWidth(null),borderImage.getHeight(null),BufferedImage.TYPE_INT_RGB);
+        graphics2D.drawImage(borderImage, 50, height / 2 + 100, null);
+
+//        graphics2D.setColor(Color.BLUE.darker().darker());
+//        graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+        graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+        graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+        graphics2D.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
+        graphics2D.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+//        graphics2D.setStroke(new BasicStroke(5.0f ,
+//                BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 15.0f, new float[] {10.0f,10.0f}, 5.0f));
+        FontRenderContext frc = graphics2D.getFontRenderContext();
+        int x = 150;
+        int y = height / 2 + 220;
+        if (content.length() < 9) {
+//            TextLayout tl = new TextLayout(content, font, frc);
+//            Shape sha = tl.getOutline(AffineTransform.getTranslateInstance(5,25));
+//            graphics2D.setStroke(new BasicStroke(3.0f));
+//            graphics2D.setColor(Color.black);
+//            graphics2D.draw(sha);
+//            graphics2D.setColor(Color.white);
+//            graphics2D.fill(sha);
+//            graphics2D.dispose();
+            graphics2D.drawString(content, x, y);
+        } else {
+            graphics2D.drawString(content.substring(0, 8), x, y);
+            graphics2D.drawString(content.substring(8), x, y + 60);
+//            TextLayout tl = new TextLayout(content.substring(0,8), font, frc);
+//            Shape sha = tl.getOutline(AffineTransform.getTranslateInstance(5,25));
+//            graphics2D.setStroke(new BasicStroke(3.0f));
+//            graphics2D.setColor(Color.WHITE);
+//            graphics2D.draw(sha);
+//            graphics2D.setColor(Color.BLACK);
+//            graphics2D.fill(sha);
+////            graphics2D.dispose();
+//
+//            TextLayout t2 = new TextLayout(content.substring(8), font, frc);
+//            Shape sha2 = t2.getOutline(AffineTransform.getTranslateInstance(5,25));
+//            graphics2D.setStroke(new BasicStroke(3.0f));
+//            graphics2D.setColor(Color.WHITE);
+//            graphics2D.draw(sha2);
+//            graphics2D.setColor(Color.BLACK);
+//            graphics2D.fill(sha);
+////            graphics2D.dispose();
+        }
+
+        graphics2D.dispose();
+        FileOutputStream fileOutputStream = new FileOutputStream("D:/image/cover/" + UUID.randomUUID() + ".jpg");
+        ImageIO.write(bufferedImage, "jpg", fileOutputStream);
+
+    }
+
+    public int getContentLength(String content, Graphics2D graphics2D) {
+        return graphics2D.getFontMetrics(graphics2D.getFont()).charsWidth(content.toCharArray(), 0, content.length());
+    }
+
+    public static void main(String[] args) {
+        ImageUtils i = new ImageUtils();
+        Font font = new Font("微软雅黑", Font.BOLD + Font.PLAIN, 35);
+
+//        String content = "测试封面文字内容\n最多可以十五字";
+        Color color = new Color(0, 0, 0, 255);
+        List<String> list = i.getContentList();
+//        File file = new File("D:/bg1.jpg");
+        File file = new File("D:/image/target");
+        String[] files = file.list();
+        for (String str : files) {
+            String imagePath = file.getAbsolutePath() + "/" + str;
+            try {
+                File imageFile = new File(imagePath);
+                for (String content : list) {
+                    InputStream inputStream = new FileInputStream(imageFile);
+                    i.addTextInImage(inputStream, content, color, font);
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+//            new ImageUtils().resize(720,1280,imageFile,"D:/image/target/"+ UUID.randomUUID()+".jpg");
+        }
+
+
+        System.out.println();
+//
+    }
+
+    public List<String> getContentList() {
+        List<String> list = new ArrayList<String>();
+        list.add("想尝试一下这种风格");
+        list.add("想看一下效果");
+        list.add("这是个狠人");
+        list.add("难得一见");
+        list.add("每一个都很饱满");
+        list.add("土豪吃法");
+        list.add("怕了怕了");
+        list.add("我反正不敢");
+        list.add("贪吃的后果");
+        list.add("求打败,在线等");
+        list.add("女人心海底针");
+        list.add("撕开赚钱的真相");
+        list.add("这是啥味儿");
+        list.add("爪子的妙用");
+        list.add("把聊天记录删除后..");
+        list.add("章鱼,太狠了");
+        list.add("先下手为强");
+        list.add("爪子的妙用");
+        list.add("听说这是村里的帅哥");
+        list.add("听说这是村里的美女");
+        list.add("没想到,饭还能这样吃");
+        list.add("没想到,水还能这样喝");
+        list.add("没想到,衣服还能这样穿");
+        list.add("没想到,车还能这样骑");
+        list.add("没想到,妆还能这样画");
+        list.add("她扒拉我");
+        list.add("三者必有一伤");
+        list.add("最新机械皮肤");
+        list.add("妹子,这吃的啥");
+        list.add("活下来,算我输");
+        list.add("不哭算我输");
+        list.add("不摔算我输");
+        list.add("送礼物吓傻女友");
+        list.add("是谁在唱歌");
+        list.add("表情包不够,大长腿来凑");
+        list.add("这场面真没见过");
+        list.add("这蔬菜得回家供着");
+        list.add("挖掘机哪家强");
+        list.add("高手过招");
+        list.add("还没怕过谁");
+        list.add("手有点干巴");
+        list.add("准备装箱");
+        list.add("手把手教学");
+        list.add("别怪我不客气");
+        list.add("放大招了!");
+        list.add("难怪我这么穷");
+        list.add("招招毙命");
+        list.add("随时准备辞职");
+        list.add("不秀的李白");
+        list.add("没大的黄忠");
+        list.add("总是碰见猴子的鲁班");
+        list.add("这样哄女友很管用");
+        list.add("三年的聊天记录");
+        list.add("用它不怕女神追不到");
+        list.add("就靠你了");
+        list.add("比谁快!");
+        list.add("城里人真会玩");
+        list.add("斗图我还没输过谁");
+        list.add("开局斗图,把它斗哭了");
+        list.add("敢和我来斗图");
+        list.add("一起斗图啊");
+        list.add("斗图你怕了吗");
+        list.add("斗图输了的结果");
+        list.add("斗图王者重出江湖");
+        list.add("斗图还是我最强");
+        list.add("打字就是表情包");
+        list.add("现在表白都靠斗图了");
+        list.add("斗图啊,王者在线等");
+        list.add("斗图吗,年轻人");
+        list.add("斗图能赚零花钱");
+        list.add("确认过眼神,是我斗不过的人");
+        list.add("年轻人爱的斗图软件");
+        list.add("教你一招,包情包用不完");
+        list.add("从此人生很有趣");
+        list.add("我不认输,我只斗图");
+        list.add("表情包不够用?");
+        list.add("斗图,你过来呀!");
+        list.add("斗图输了不开心");
+        list.add("斗图输了不要怕");
+        list.add("还怕表情包不够用?");
+        list.add("表情包太少的后果");
+        list.add("斗图秒赢!");
+        list.add("是谁还在盗图?");
+        return list;
+    }
+}

+ 20 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -20,6 +20,8 @@ import java.awt.Rectangle;
 import org.openqa.selenium.chrome.ChromeDriver;
 import org.openqa.selenium.chrome.ChromeDriverService;
 import org.openqa.selenium.chrome.ChromeOptions;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.firefox.FirefoxOptions;
 import org.openqa.selenium.html5.Location;
 import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.DesiredCapabilities;
@@ -495,9 +497,24 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
 
     public static void main(String[] args) {
         try {
-            KuaishouWebInterfaceServiceImpl i = new KuaishouWebInterfaceServiceImpl();
-            String result = ChaojiyingUtils.process(Base64Utils.ImageToBase64("D:/capter.png"));
-            System.out.println(result);
+//            KuaishouWebInterfaceServiceImpl i = new KuaishouWebInterfaceServiceImpl();
+//            String result = ChaojiyingUtils.process(Base64Utils.ImageToBase64("D:/capter.png"));
+//            System.out.println(result);
+//            System.getProperties().setProperty("webdriver.gecko.drive", "D:/geckodriver.exe");
+            System.setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
+            ChromeOptions options = new ChromeOptions();
+            options.addArguments("--headless");
+            options.addArguments("--incognito");
+            options.addArguments("--no-sandbox");
+            options.addArguments("--disable-gpu");
+            options.addArguments("--window-size=1290,1080");
+            WebDriver driver = new ChromeDriver(options);
+            driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
+            driver.manage().timeouts().setScriptTimeout(5, TimeUnit.SECONDS);
+            driver.get("http://b.e.kuaishou.com");
+            System.out.println(driver.getPageSource());
+            driver.quit();
+//            driver.quit();
 //            i.adkuaishouWebLogin("17611760019", "a123456");
 //            i.adkuaishouWebLogin("18822179577", "a123456");
 //            i.adkuaishouWebLogin("13552374039", "hcst2019");

+ 6 - 1
pom.xml

@@ -300,7 +300,12 @@
         <dependency>
             <groupId>org.seleniumhq.selenium</groupId>
             <artifactId>selenium-java</artifactId>
-            <version>3.14.0</version>
+            <version>3.141.59</version>
+        </dependency>
+        <dependency>
+            <groupId>org.seleniumhq.selenium</groupId>
+            <artifactId>selenium-firefox-driver</artifactId>
+            <version>3.141.59</version>
         </dependency>
         <dependency>
             <groupId>org.json</groupId>