shawenguan пре 1 година
родитељ
комит
eae3c9f0d5
2 измењених фајлова са 35 додато и 1 уклоњено
  1. 34 1
      Scripts/wubian/wubianFastGrab.js
  2. 1 0
      Scripts/wubian/wubianHelper.js

+ 34 - 1
Scripts/wubian/wubianFastGrab.js

@@ -10,13 +10,17 @@ const WuBianConstKey = {
     // 基础数据
     UserInfo: 'WubianUserInfo',
     Token: 'WubianProToken',
+    BrowserProxyUrl: 'WubianBrowserProxyUrl',
+    TenantId: 'WubianTenantId',
+    AllMarketGroupListData: 'WubianAllMarketGroupListData',
+
     ActivityListData: 'WubianActivityListData',
     ActivityGoodsList: 'WubianActivityGoodsList',
     ActivityTaskCaptureEnabled: 'WubianActivityTaskCaptureEnabled',
     ActivityTagName: 'WubianActivityActivityTagName',
     ActivityIndexName: 'WubianActivityIndexName',
     ActivityId: 'WubianActivityId',
-    TenantId: 'WubianTenantId',
+
     FirstOrderCaptureEnabled: 'WubianFirstOrderCaptureEnabled',
     FirstArtListData: 'WubianFirstArtListData',
     FirstGoodsId: 'WubianFirstGoodsId',
@@ -519,6 +523,35 @@ async function getUrlLocation(url) {
     return result;
 }
 
+
+async function openUrlByRemoteBrowser(url) {
+    let headers = gCommonHeaders;
+    let data = {
+        url: url,
+        headers: headers,
+    };
+    let proxyUrl = magicJS.data.read(WuBianConstKey.BrowserProxyUrl, 'http://127.0.0.1:5000/proxy');
+    let options = {
+        url: proxyUrl,
+        headers: headers,
+        body: JSON.stringify(data),
+    };
+    let result = await magicJS.http.post(options).then(response => {
+        try {
+            magicJS.logger.info(JSON.stringify(response));
+            const body = response.body;
+            magicJS.logger.info(body);
+            return body;
+        } catch (e) {
+            magicJS.logger.error(e);
+        }
+    }).catch(err => {
+        const msg = `请求代理浏览器异常\n${JSON.stringify(err)}`;
+        magicJS.logger.error(msg);
+    });
+    return result;
+}
+
 Main().catch((e) => magicJS.logger.log(`-\n ${e}`)).finally(() => magicJS.done());
 
 

+ 1 - 0
Scripts/wubian/wubianHelper.js

@@ -18,6 +18,7 @@ const WuBianConstKey = {
     // 基础数据
     UserInfo: 'WubianUserInfo',
     Token: 'WubianProToken',
+    BrowserProxyUrl: 'WubianBrowserProxyUrl',
     TenantId: 'WubianTenantId',
     AllMarketGroupListData: 'WubianAllMarketGroupListData',