syh 5 lat temu
rodzic
commit
6a7b46a4e0

+ 7 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CrawlerController.java

@@ -1,8 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
 import org.jeecg.modules.ctop.service.ICrawlerService;
+import org.jeecg.modules.ctop.vo.KuaishouAppiumJobVO;
 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;
 
@@ -18,8 +20,9 @@ public class CrawlerController {
         return crawlerService.loadInspiration();
     }
 
-//    @PostMapping("startJob")
-//    public Map<String, Object> runTask(Long jobId, Long num, String creativeName, String accountId, String publishName) {
-//        return crawlerService.startJob(jobId, num, creativeName, accountId, publishName);
-//    }
+    @PostMapping("startJob")
+    public Map<String, Object> runTask(Long jobId, Long num, String creativeName, String accountId, String publishName) {
+        KuaishouAppiumJobVO vo = new KuaishouAppiumJobVO(jobId, num, creativeName, accountId, publishName);
+        return crawlerService.startJob(vo);
+    }
 }

+ 11 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vo/KuaishouAppiumJobVO.java

@@ -11,4 +11,15 @@ public class KuaishouAppiumJobVO implements Serializable {
     private String creativeName;
     private String accountId;
     private String publishName;
+
+    public KuaishouAppiumJobVO(Long jobId, Long num, String creativeName, String accountId, String publishName) {
+        this.jobId = jobId;
+        this.num = num;
+        this.creativeName = creativeName;
+        this.accountId = accountId;
+        this.publishName = publishName;
+    }
+
+    public KuaishouAppiumJobVO() {
+    }
 }

+ 24 - 0
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -6,6 +6,9 @@ import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.crawler.modules.appium.entity.AppiumDevice;
+import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
+import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
@@ -19,6 +22,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -226,6 +230,26 @@ public class SampleTest {
 
         }
     }
+
+    @Test
+    public void testCrawler() {
+        String account = "";
+        String password = "";
+        String creativeName = "";
+        //1:获取快手账号id
+        String ksId = jobService.loginTask(2L,new AppiumDevice());
+        //2:绑定体验账号
+        boolean isbind = jobService.bindCreative(account, password, creativeName, ksId);
+        //3:转化
+//        appiumTaskService.runTask(1, 1);
+    }
+
+    @Autowired
+    private IAppiumJobService jobService;
+    @Autowired
+    private ICreateInternalService createInternalService;
+    @Autowired
+    private IAppiumTaskService appiumTaskService;
 }
 
 

+ 5 - 9
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/AppiumUtil.java

@@ -30,7 +30,7 @@ public class AppiumUtil {
     public static final String APP_SWIPE_TYPE_LEFT = "left";
     public static final String APP_SWIPE_TYPE_RIGHT = "right";
 
-    public void swipeToUp(AndroidDriver driver) {
+    private void swipeToUp(AndroidDriver driver) {
         int width = driver.manage().window().getSize().width;
         int height = driver.manage().window().getSize().height;
         TouchAction action1 = new TouchAction(driver).press(PointOption.point(width / 2, height * 3 / 4)).waitAction(WaitOptions.waitOptions(duration))
@@ -38,7 +38,7 @@ public class AppiumUtil {
         action1.perform();
     }
 
-    public void swipeToDown(AndroidDriver driver) {
+    private void swipeToDown(AndroidDriver driver) {
         int width = driver.manage().window().getSize().width;
         int height = driver.manage().window().getSize().height;
         TouchAction action2 = new TouchAction(driver).press(PointOption.point(width / 2, height / 4)).waitAction(WaitOptions.waitOptions(duration))
@@ -46,7 +46,7 @@ public class AppiumUtil {
         action2.perform();
     }
 
-    public void swipeToLeft(AndroidDriver driver) {
+    private void swipeToLeft(AndroidDriver driver) {
         int width = driver.manage().window().getSize().width;
         int height = driver.manage().window().getSize().height;
         TouchAction action3 = new TouchAction(driver).press(PointOption.point(width * 3 / 4, height / 2)).waitAction(WaitOptions.waitOptions(duration))
@@ -54,7 +54,7 @@ public class AppiumUtil {
         action3.perform();
     }
 
-    public void tapPoint(AndroidDriver driver, Integer x, Integer y) {
+    private void tapPoint(AndroidDriver driver, Integer x, Integer y) {
         TouchAction action = new TouchAction(driver).tap(PointOption.point(x, y)).release();
         action.perform();
     }
@@ -232,11 +232,8 @@ public class AppiumUtil {
                         nextView.click();
                     }
                     break;
-                //TODO ---- 重置密码
                 case "com.yxcorp.login.userlogin.RetrievePasswordActivity":
-
                     break;
-                //TODO
                 case "com.yxcorp.login.userlogin.ResetSelectedAccountPasswordActivity":
                     WebElement confirmBtn = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/confirm_btn");
                     WebElement loginPsdEt = getElementByType(androidDriver, FIND_ELEMENT_TYPE_ID, "com.smile.gifmaker:id/login_psd_et");
@@ -725,8 +722,7 @@ public class AppiumUtil {
             }
             tapPoint(androidDriver, x, y);
         } else if ("send".equals(clickType)) {
-            String text = taskItem.getTextEqualKey();
-            element.sendKeys(text);
+            element.sendKeys(taskItem.getTextEqualKey());
         } else if ("text".equals(clickType)) {
             getText = element.getText();
         }