|
|
@@ -84,13 +84,8 @@ public class DianzhongConfigServiceImpl implements IDianzhongConfigService {
|
|
|
|
|
|
@Override
|
|
|
public void pullMovie() throws IOException {
|
|
|
- pullMoviePage(0, 100);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void syncPromoteLinkInfo() {
|
|
|
try {
|
|
|
- String url = "https://api.deepthink.artlinkworld.cn/dianzhong/syncAll";
|
|
|
+ String url = "https://api.deepthink.artlinkworld.cn/dianzhong/syncMovie";
|
|
|
String s = HttpUtils.httpPostRequest(url, null, null);
|
|
|
}catch (Exception ignored){
|
|
|
|
|
|
@@ -98,132 +93,17 @@ public class DianzhongConfigServiceImpl implements IDianzhongConfigService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void movieImageToOss() {
|
|
|
- List<DianzhongMovieConfig> movieConfigs = dianzhongConfigMapper.toUploadImageList();
|
|
|
- for (DianzhongMovieConfig config : movieConfigs) {
|
|
|
- String coverImgUrl = config.getCoverImgUrl();
|
|
|
- if (StringUtils.isEmpty(coverImgUrl) || StringUtils.isEmpty(config.getMovieId())){
|
|
|
- continue;
|
|
|
- }
|
|
|
- String ossUrl = toOssUrl(coverImgUrl);
|
|
|
- if (StringUtils.isEmpty(ossUrl) || Objects.equals(ossUrl, coverImgUrl)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- config.setCoverImgUrl(ossUrl);
|
|
|
- log.info("点众剧目封面图片上传OSS成功,movieId: {}, url: {}", config.getMovieId(), ossUrl);
|
|
|
- dianzhongConfigMapper.updateMovieImage(config);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void pullMoviePage(int offset, int limit) throws IOException {
|
|
|
- log.info("拉取: 点众剧目,offset: {}, limit: {}", offset, limit);
|
|
|
- String url = "https://vip.wqxsw.com/admin/referral/book/index?sort=idx&order=desc&offset="+offset+"&limit="+limit+"&filter=%7B%7D&op=%7B%7D&_="+System.currentTimeMillis();
|
|
|
- //免费付费剧目ID相同,拉一次就可以
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("Cookie", "PHPSESSID=rugckd38052ap4nolfddg8hqb0; keeplogin=29581%7C604800%7C1756117312%7Cb3589600a14a145812da60e005c31943");
|
|
|
- headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
|
|
- headers.put("Accept", "application/json, text/javascript, */*; q=0.01");
|
|
|
- headers.put("x-requested-with", "XMLHttpRequest");
|
|
|
- headers.put("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0");
|
|
|
- String res = HttpUtils.httpGet(url, null, headers);
|
|
|
- if (StringUtils.isNotEmpty(res)){
|
|
|
- pullMovieInfo(res);
|
|
|
- if (offset < 200){ //每次只拉最近300个
|
|
|
- pullMoviePage(offset+limit, limit);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public void pullMovieInfo(String str) throws IOException {
|
|
|
- JSONObject res = JSON.parseObject(str);
|
|
|
- JSONArray rows = res.getJSONArray("rows");
|
|
|
- if (rows==null || rows.isEmpty()){
|
|
|
- return;
|
|
|
- }
|
|
|
- List<String> movieIds = dianzhongConfigMapper.getAllMovieIds();
|
|
|
- for (int i = 0; i < rows.size(); i++) {
|
|
|
- JSONObject minfo = rows.getJSONObject(i);
|
|
|
- String movieId = minfo.getString("bookId");
|
|
|
- if (movieIds.contains(movieId)){ //已经录入过的 跳过
|
|
|
- continue;
|
|
|
- }
|
|
|
- DianzhongMovieConfig config = new DianzhongMovieConfig();
|
|
|
- config.setMovieId(movieId);
|
|
|
- config.setMovieName(minfo.getString("bookName"));
|
|
|
- config.setCoverImgUrl(toOssUrl(minfo.getString("coverCutWap")));
|
|
|
- config.setChapterCount(minfo.getInteger("totalChapterNum"));
|
|
|
- config.setFreeChapterCount(minfo.getInteger("freeChapterNum"));
|
|
|
- config.setType1(minfo.getString("bookTypeOne"));
|
|
|
- config.setType2(minfo.getString("bookTypeTwo"));
|
|
|
- config.setType3(minfo.getString("bookTypeThree"));
|
|
|
- config.setFirstShelfTime(minfo.getString("firstShelfTime"));
|
|
|
- config.setInfoJson(minfo.toJSONString());
|
|
|
-
|
|
|
- dianzhongConfigMapper.insertConfigSelective(config);
|
|
|
- movieIds.add(movieId);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private String toOssUrl(String fileUrl){
|
|
|
+ public void syncPromoteLinkInfo() {
|
|
|
try {
|
|
|
- String url = "https://api.deepthink.artlinkworld.cn/ossUp/uploadFileByUrl";
|
|
|
- Map<String, Object> paramsMap = new HashMap<>();
|
|
|
- paramsMap.put("url", fileUrl);
|
|
|
- String s = HttpUtils.httpGet(url, paramsMap, null);
|
|
|
- if (StringUtils.isEmpty(s)){
|
|
|
- log.error("点众封面图片上传OSS失败,url: {}", fileUrl);
|
|
|
- return fileUrl;
|
|
|
- }
|
|
|
- JSONObject res = JSON.parseObject(s);
|
|
|
- if (res.getInteger("code") != 200 && res.getInteger("code")!= 0){
|
|
|
- log.error("点众封面图片上传OSS失败,url: {}, msg: {}", fileUrl, res.getString("msg"));
|
|
|
- return fileUrl;
|
|
|
- }
|
|
|
- return res.getString("result");
|
|
|
+ String url = "https://api.deepthink.artlinkworld.cn/dianzhong/syncAll";
|
|
|
+ String s = HttpUtils.httpPostRequest(url, null, null);
|
|
|
}catch (Exception ignored){
|
|
|
- return fileUrl;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- private void tt() throws Exception {
|
|
|
- String loginUrl = "https://vip.wqxsw.com/admin/index/login?url=%2Fadmin%2Findex%2Findex";
|
|
|
- //免费付费剧目ID相同,拉一次就可以
|
|
|
- HttpPost httpPost = new HttpPost(loginUrl);
|
|
|
- //PHPSESSID=a2t3dp59hn92sjm0a7spe82b2s; keeplogin=29581%7C604800%7C1755853777%7Cea024be2fbc5c0604c25514f216e178f
|
|
|
- httpPost.setHeader("Cookie", "PHPSESSID=n3620u5ck12dplrbqfmvslegt2");
|
|
|
- httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
|
|
- httpPost.setHeader("Accept", "application/json, text/javascript, */*; q=0.01");
|
|
|
- httpPost.setHeader("x-requested-with", "XMLHttpRequest");
|
|
|
- List<NameValuePair> params = new ArrayList<>();
|
|
|
- params.add(new BasicNameValuePair("username", "tjxldyvip1"));
|
|
|
- params.add(new BasicNameValuePair("password", "Aa112233"));
|
|
|
- params.add(new BasicNameValuePair("keeplogin", "1"));
|
|
|
- HttpEntity httpEntity = new UrlEncodedFormEntity(params);
|
|
|
- httpPost.setEntity(httpEntity);
|
|
|
-
|
|
|
- HttpClient httpclient = HttpUtils.getHttpclient();
|
|
|
- HttpResponse response = httpclient.execute(httpPost);
|
|
|
- int statusCode = response.getStatusLine().getStatusCode();
|
|
|
- if (statusCode != 200) {
|
|
|
- log.error("点众登录失败,状态码: {}", statusCode);
|
|
|
- return;
|
|
|
- }
|
|
|
- Header[] headers = response.getHeaders("Set-Cookie");
|
|
|
- //获取其中的keeplogin
|
|
|
- String cookie = null;
|
|
|
- for (Header header : headers) {
|
|
|
- String value = header.getValue();
|
|
|
- if (value.contains("keeplogin")) {
|
|
|
- cookie = value;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
|
|
|
|