syh 5 rokov pred
rodič
commit
d0b8f0b834

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

@@ -27,6 +27,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
 
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
+
     @Override
     public Map<String, Object> createInternal(JSONObject requestJson) {
         String url = "https://ad.oceanengine.com/pages/login/index.html";
@@ -57,15 +58,17 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
             header.put("Content-Type", "application/x-www-form-urlencoded");
             header.put("Origin", "https://ad.oceanengine.com");
             header.put("Referer", "https://ad.oceanengine.com/pages/login/index.html");
-            Map<String, Object> param = new HashMap<String, Object>();
+            Map<String, Object> param = new HashMap<>();
             param.put("mobile", "");
             param.put("code", "");
             param.put("account", "dcd_ad@bytedance.com");
-            param.put("password", "typdDCD@20181");
+            param.put("password", "typdDCD@2018");
             param.put("captcha", "hqde");
             param.put("is_30_days_no_login", "true");
             param.put("service", "https://ad.oceanengine.com");
             String res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
+            System.out.println("res:" + new String(res.getBytes("GBK"), "UTF8"));
+
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             JsonNode jsonNode = mapper.readTree(res);
@@ -83,7 +86,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 param.put("captcha", resp.pred_resl);
                 orderId = resp.req_id;
                 res = HttpUtils.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-                System.out.println(res);
+                System.out.println("res:" + res);
                 jsonNode = mapper.readTree(res);
                 errorCode = jsonNode.get("error_code").asInt();
             }

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

@@ -8,6 +8,7 @@ import java.util.Map;
 import javax.annotation.Resource;
 
 import cn.com.ctop.common.utils.OSSUtils;
+import com.alibaba.fastjson.JSONObject;
 import org.apache.ibatis.annotations.Param;
 import org.apache.poi.hssf.usermodel.HSSFDataFormat;
 import org.apache.poi.ss.usermodel.Cell;
@@ -20,6 +21,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.util.ResultMapUtils;
 import org.jeecg.common.util.StatusCode;
 import org.jeecg.modules.ctop.mapper.PlatformCampaignStatisticInfoMapper;
+import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.jeecg.modules.ctop.service.IReportService;
 import org.jeecg.modules.ctop.vo.StatisticCampaignVo;
 import org.jeecg.modules.demo.mock.MockController;
@@ -391,5 +393,14 @@ public class SampleTest {
 
     @Autowired
     private PlatformCampaignStatisticInfoMapper statisticInfoMapper;
+    @Autowired
+    private ICreateInternalService createInternalService;
+
+    @Test
+    public void testNg() {
+        JSONObject json = new JSONObject();
+        System.err.println(json);
+        createInternalService.createInternal(json);
+    }
 
 }

+ 2 - 2
module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils.java

@@ -149,8 +149,8 @@ public class HttpUtils {
             // 第一步:通过setEntity 将我们的entity对象传递过去
             httppost.setEntity(formEntity);
 
-            //httppost.setHeader("Content-Type", "application/json");
-//            httppost.setEntity(new StringEntity(new Gson().toJson(param), Charset.forName("UTF-8")));
+            httppost.setHeader("Content-Type", "application/json");
+            httppost.setEntity(new StringEntity(new Gson().toJson(param), Charset.forName("UTF-8")));
             HttpEntity respentity;
 
             HttpResponse response = httpClient.execute(httppost);