Commit 07b8a5c8 by admin

添加了点赞阅读的获取

parent 153a78c3
...@@ -8,7 +8,6 @@ import java.io.IOException; ...@@ -8,7 +8,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.Socket; import java.net.Socket;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
...@@ -318,6 +317,7 @@ public class ExcelReadAndWrite { ...@@ -318,6 +317,7 @@ public class ExcelReadAndWrite {
log.error("错误信息{}", e); log.error("错误信息{}", e);
} }
} }
public static byte[] readStream(InputStream inStream) throws Exception { public static byte[] readStream(InputStream inStream) throws Exception {
ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
...@@ -363,6 +363,7 @@ public class ExcelReadAndWrite { ...@@ -363,6 +363,7 @@ public class ExcelReadAndWrite {
if (now == 0) { if (now == 0) {
b = false; b = false;
} }
s.close();
} catch (Exception e) { } catch (Exception e) {
log.error("错误信息{}", e); log.error("错误信息{}", e);
} }
...@@ -430,6 +431,7 @@ public class ExcelReadAndWrite { ...@@ -430,6 +431,7 @@ public class ExcelReadAndWrite {
ex.setStartDate(sdf.format(new Date())); ex.setStartDate(sdf.format(new Date()));
MainController.excel = ex; MainController.excel = ex;
Thread t = new Thread() { Thread t = new Thread() {
@Override
public void run() { public void run() {
try { try {
save(); save();
...@@ -537,7 +539,7 @@ public class ExcelReadAndWrite { ...@@ -537,7 +539,7 @@ public class ExcelReadAndWrite {
if (null != l.getUrl()) { if (null != l.getUrl()) {
if (l.getUrl().startsWith("https://mp.weixin.qq.com/s?src") if (l.getUrl().startsWith("https://mp.weixin.qq.com/s?src")
|| l.getUrl().startsWith("http://mp.weixin.qq.com/s?src")) { || l.getUrl().startsWith("http://mp.weixin.qq.com/s?src")) {
String demoUrl=l.getUrl().replaceAll("&key=[\\s\\S]+", ""); String demoUrl = l.getUrl().replaceAll("&key=[\\s\\S]+", "");
l.setUrl(demoUrl); l.setUrl(demoUrl);
urls.add(demoUrl); urls.add(demoUrl);
log.info(l); log.info(l);
...@@ -546,21 +548,19 @@ public class ExcelReadAndWrite { ...@@ -546,21 +548,19 @@ public class ExcelReadAndWrite {
continue; continue;
} }
} }
System.out.println("list:" + list.size());
System.out.println(urls.size());
m.insert(urls);// 存储 m.insert(urls);// 存储
Thread.sleep(1000 * 80); Thread.sleep(1000 * 80);// 通信前休眠80s
while (so()) { while (so()) {
Thread.sleep(1000 * 10); Thread.sleep(1000 * 10);// 10s交互一次
} }
Thread.sleep(1000 * 50); Thread.sleep(1000 * 30);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
for (Map<String, Object> ma : m.find()) { for (Map<String, Object> ma : m.find()) {
try { try {
if (ma != null && ma.get("url") != null) if (ma != null && ma.get("url") != null)
map.put(ma.get("_id").toString(), ma.get("url").toString()); map.put(ma.get("_id").toString(), ma.get("url").toString());
} catch (Exception e) { } catch (Exception e) {
log.info("错误信息+560{}" + e.getMessage()); log.info("错误信息{}" + e.getMessage());
} }
} }
for (Weixin w : list) { for (Weixin w : list) {
...@@ -662,10 +662,10 @@ public class ExcelReadAndWrite { ...@@ -662,10 +662,10 @@ public class ExcelReadAndWrite {
con.setRequestProperty("Host", "mp.weixin.qq.com"); con.setRequestProperty("Host", "mp.weixin.qq.com");
con.setRequestProperty("User-Agent", con.setRequestProperty("User-Agent",
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 MicroMessenger/6.5.2.501 NetType/WIFI WindowsWechat QBCore/3.43.691.400 QQBrowser/9.0.2524.400"); "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 MicroMessenger/6.5.2.501 NetType/WIFI WindowsWechat QBCore/3.43.691.400 QQBrowser/9.0.2524.400");
result=con.getHeaderField("Location"); result = con.getHeaderField("Location");
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
return (result == null||result.equals("")) ? url : result; return (result == null || result.equals("")) ? url : result;
} }
} }
...@@ -19,10 +19,8 @@ import com.mongodb.MongoClient; ...@@ -19,10 +19,8 @@ import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions; import com.mongodb.MongoClientOptions;
import com.mongodb.MongoCredential; import com.mongodb.MongoCredential;
import com.mongodb.ServerAddress; import com.mongodb.ServerAddress;
import com.zhiwei.servlet.MainController;
import com.zhiwei.util.Config; import com.zhiwei.util.Config;
import com.zw.entity.ExcelFile; import com.zw.entity.ExcelFile;
import com.zw.entity.Excels;
public class MongoForChenDong { public class MongoForChenDong {
...@@ -46,11 +44,12 @@ public class MongoForChenDong { ...@@ -46,11 +44,12 @@ public class MongoForChenDong {
optionsBuilder.socketKeepAlive(true); optionsBuilder.socketKeepAlive(true);
optionsBuilder.socketTimeout(1000 * 20); optionsBuilder.socketTimeout(1000 * 20);
MongoClientOptions options = optionsBuilder.build(); MongoClientOptions options = optionsBuilder.build();
// char[] passwords = Config.getVal("password").toCharArray(); // char[] passwords = Config.getVal("password").toCharArray();
List<MongoCredential> credentials = new ArrayList<>(); List<MongoCredential> credentials = new ArrayList<>();
// MongoCredential credential = MongoCredential.createCredential(Config.getVal("user"), // MongoCredential credential =
// Config.getVal("dbName"), passwords); // MongoCredential.createCredential(Config.getVal("user"),
// credentials.add(credential); // Config.getVal("dbName"), passwords);
// credentials.add(credential);
List<ServerAddress> serverAddresses = new ArrayList<>(); List<ServerAddress> serverAddresses = new ArrayList<>();
serverAddresses.add(new ServerAddress(Config.getVal("host"), Integer.valueOf(Config.getVal("port")))); serverAddresses.add(new ServerAddress(Config.getVal("host"), Integer.valueOf(Config.getVal("port"))));
mongoClient = new MongoClient(serverAddresses, credentials, options); mongoClient = new MongoClient(serverAddresses, credentials, options);
...@@ -85,6 +84,11 @@ public class MongoForChenDong { ...@@ -85,6 +84,11 @@ public class MongoForChenDong {
return list; return list;
} }
/**
* 微信转链接的插入
*
* @param list
*/
public void insert(List<String> list) { public void insert(List<String> list) {
DB db = mongoClient.getDB(Config.getVal("dbName")); DB db = mongoClient.getDB(Config.getVal("dbName"));
DBCollection dbCollection = db.getCollection("RawUrl"); DBCollection dbCollection = db.getCollection("RawUrl");
...@@ -116,12 +120,12 @@ public class MongoForChenDong { ...@@ -116,12 +120,12 @@ public class MongoForChenDong {
DBCollection dbCollection = db.getCollection("Result"); DBCollection dbCollection = db.getCollection("Result");
dbCollection.drop(); dbCollection.drop();
} }
/** /**
* 微信转链接的文件地址入库 * 微信转链接的文件地址入库
*/ */
public void insertFile(ExcelFile excel) { public void insertFile(ExcelFile excel) {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DB db = mongoClient.getDB(Config.getVal("dbName")); DB db = mongoClient.getDB(Config.getVal("dbName"));
DBCollection dbCollection = db.getCollection("changeUrlFile"); DBCollection dbCollection = db.getCollection("changeUrlFile");
DBObject obj = new BasicDBObject(); DBObject obj = new BasicDBObject();
...@@ -130,16 +134,18 @@ public class MongoForChenDong { ...@@ -130,16 +134,18 @@ public class MongoForChenDong {
obj.put("date", sdf.format(new Date())); obj.put("date", sdf.format(new Date()));
dbCollection.insert(obj); dbCollection.insert(obj);
} }
/** /**
* 获取信息 * 获取信息
*
* @return * @return
*/ */
public List<ExcelFile> findFile() { public List<ExcelFile> findFile() {
List<ExcelFile> list = new ArrayList<ExcelFile>(); List<ExcelFile> list = new ArrayList<ExcelFile>();
DB db = mongoClient.getDB(Config.getVal("dbName")); DB db = mongoClient.getDB(Config.getVal("dbName"));
DBCollection dbCollection = db.getCollection("changeUrlFile"); DBCollection dbCollection = db.getCollection("changeUrlFile");
DBCursor dbCursor = dbCollection.find().sort(new BasicDBObject("date",-1)); DBCursor dbCursor = dbCollection.find().sort(new BasicDBObject("date", -1));
System.out.println("size"+dbCursor.size()); System.out.println("size" + dbCursor.size());
while (dbCursor.hasNext()) { while (dbCursor.hasNext()) {
Map<String, Object> map = (Map<String, Object>) dbCursor.next(); Map<String, Object> map = (Map<String, Object>) dbCursor.next();
ExcelFile ef = new ExcelFile(); ExcelFile ef = new ExcelFile();
...@@ -152,17 +158,17 @@ public class MongoForChenDong { ...@@ -152,17 +158,17 @@ public class MongoForChenDong {
System.out.println(list.size()); System.out.println(list.size());
return list; return list;
} }
public void delete(String id){ public void delete(String id) {
DB db = mongoClient.getDB(Config.getVal("dbName")); DB db = mongoClient.getDB(Config.getVal("dbName"));
DBCollection dbCollection = db.getCollection("changeUrlFile"); DBCollection dbCollection = db.getCollection("changeUrlFile");
dbCollection.remove(new BasicDBObject("_id",new ObjectId(id))); dbCollection.remove(new BasicDBObject("_id", new ObjectId(id)));
} }
public String findByid(String id){ public String findByid(String id) {
DB db = mongoClient.getDB(Config.getVal("dbName")); DB db = mongoClient.getDB(Config.getVal("dbName"));
DBCollection dbCollection = db.getCollection("changeUrlFile"); DBCollection dbCollection = db.getCollection("changeUrlFile");
DBObject obj=dbCollection.findOne(new BasicDBObject("_id",new ObjectId(id))); DBObject obj = dbCollection.findOne(new BasicDBObject("_id", new ObjectId(id)));
return String.valueOf(obj.get("url")); return String.valueOf(obj.get("url"));
} }
} }
...@@ -5,8 +5,6 @@ import java.io.FileInputStream; ...@@ -5,8 +5,6 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
...@@ -22,9 +20,6 @@ public class ReaderExcel { ...@@ -22,9 +20,6 @@ public class ReaderExcel {
private final static Log log = LogFactory.getLog(ReaderExcel.class); private final static Log log = LogFactory.getLog(ReaderExcel.class);
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
System.out.println(
"https://mp.weixin.qq.com/s?src=11&timestamp=1525385592&ver=855&signature=t61muuTJKorCLU9B6F9khlfr3ezct6GGh-Moxq*9b4RZxgQnHSpElHV9CYCi2YnSA3nOz2*a04k6R9iHOGzctg1KS9Bgx3jelhxEi5NzmXHmhglHbp8Tjf5*rKEFilpi&new=1&key=95dc4253938e3c7ba33e1ff6f7363608ab00e37f99c7f7ff7e7cb4e5b1a6ce70df92e7de80d56d237ffe33cd15ffcb0a80bc0d064ece8d169c6e38960f0d44e359a01cd7bcb987a08b3de1a19e94eb06&uin=NTk1NjM2Nzg3&key=b97b0a94956e0cb2b01167441267dc09f5e79cb852c323792d0040c1988b0c39913e23a2e43b0bccef725d2843e0da0d81c5164338260e6b932f25085936eec21b0e71ca66cd78582d2411b4737cb644&uin=MzM3MTk2NzAxNA%3D%3D"
.replaceAll("&key=[\\s\\S]+", ""));
} }
......
package com.zhiwei.chendong;
public class SocketD {
}
package com.zhiwei.chendong;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class WechatMsgServer {
public static void main(String[] args) throws Exception {
ServerSocket server = new ServerSocket(22222);
Socket socket = server.accept();
InputStream in = socket.getInputStream();
byte[] bytes = new byte[1024];
int len;
StringBuilder sb = new StringBuilder();
while ((len = in.read(bytes)) != -1) {
sb.append(new String(bytes, 0, len, "utf-8"));
}
OutputStream outputStream = socket.getOutputStream();
in.close();
outputStream.close();
socket.close();
server.close();
}
}
...@@ -10,13 +10,10 @@ import org.apache.commons.logging.LogFactory; ...@@ -10,13 +10,10 @@ import org.apache.commons.logging.LogFactory;
import org.bson.Document; import org.bson.Document;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.zhiwei.orm.BeanFactory;
import com.zhiwei.service.Services;
import com.zhiwei.util.Config; import com.zhiwei.util.Config;
import com.zhiwei.util.ExcelUtil; import com.zhiwei.util.ExcelUtil;
import com.zhiwei.util.MongoConnection; import com.zhiwei.util.MongoConnection;
import com.zhiwei.util.ReadExcel; import com.zhiwei.util.ReadExcel;
import com.zhiwei.util.StringUtil;
import com.zw.entity.NewsResult; import com.zw.entity.NewsResult;
import sendmail.SendMailUtil; import sendmail.SendMailUtil;
...@@ -31,6 +28,7 @@ public class PushFinanceByTime extends Thread { ...@@ -31,6 +28,7 @@ public class PushFinanceByTime extends Thread {
this.start(); this.start();
} }
@Override
public void run() { public void run() {
while (true) { while (true) {
List<String> sources = new ArrayList<String>(); List<String> sources = new ArrayList<String>();
...@@ -92,7 +90,7 @@ public class PushFinanceByTime extends Thread { ...@@ -92,7 +90,7 @@ public class PushFinanceByTime extends Thread {
String url = PushFinanceByTime.class.getClassLoader().getResource("/").getPath() + "/" String url = PushFinanceByTime.class.getClassLoader().getResource("/").getPath() + "/"
+ (int) (Math.random() * 5000) + "sends.xls"; + (int) (Math.random() * 5000) + "sends.xls";
cal.add(Calendar.HOUR_OF_DAY, 5); cal.add(Calendar.HOUR_OF_DAY, 5);
sendsEmail(cal, list, url); sendsEmail(cal, list, url);
sleep(1000 * 60 * 60); sleep(1000 * 60 * 60);
} }
} }
...@@ -108,11 +106,10 @@ public class PushFinanceByTime extends Thread { ...@@ -108,11 +106,10 @@ public class PushFinanceByTime extends Thread {
} }
} }
private void sendsEmail(Calendar cal, List<NewsResult> list, private void sendsEmail(Calendar cal, List<NewsResult> list, String url) {
String url) {
try { try {
new ExcelUtil().pushDataWithFinanceLong(list,cal.getTime(), url); new ExcelUtil().pushDataWithFinanceLong(list, cal.getTime(), url);
for(String mail:Config.getVal("pushMail").split(",")) { for (String mail : Config.getVal("pushMail").split(",")) {
SendMailUtil.sendMessage(mail, url, "金融"); SendMailUtil.sendMessage(mail, url, "金融");
} }
ExcelUtil.delete(url); ExcelUtil.delete(url);
...@@ -120,7 +117,7 @@ public class PushFinanceByTime extends Thread { ...@@ -120,7 +117,7 @@ public class PushFinanceByTime extends Thread {
log.error("一号邮箱发送失败,尝试二号邮箱{}", e); log.error("一号邮箱发送失败,尝试二号邮箱{}", e);
try { try {
new ExcelUtil().pushDataWithFinanceLong(list, cal.getTime(), url); new ExcelUtil().pushDataWithFinanceLong(list, cal.getTime(), url);
for(String mail:Config.getVal("pushMail").split(",")) { for (String mail : Config.getVal("pushMail").split(",")) {
SendMailUtil.sendMessage2(mail, url, "金融"); SendMailUtil.sendMessage2(mail, url, "金融");
} }
ExcelUtil.delete(url); ExcelUtil.delete(url);
......
package com.zhiwei.finance;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.bson.Document;
import org.springframework.stereotype.Component;
import com.zhiwei.util.ExcelUtil;
import com.zhiwei.util.MongoConnection;
import com.zhiwei.util.ReadExcel;
import com.zw.entity.NewsResult;
import sendmail.SendMailUtil;
//@Component
public class PushFinanceByTimeLess extends Thread {
private static final Log log = LogFactory.getLog(PushFinanceByTimeLess.class);
private static final MongoConnection con = new MongoConnection();
public PushFinanceByTimeLess() {
this.start();
}
public void run() {
while (true) {
List<String> sources = new ArrayList<String>();
String path = PushFinanceByTime.class.getClassLoader().getResource("pushFiles/pushFinanceless.xls").getPath();
Document doc = con.find("financePush", "excelPath", new Document().append("name", "lessSource"));
if (doc != null) {
if (doc.getString("url") != null) {
path = doc.getString("url");
}
}
log.info("推送检测");
System.out.println(path);
sources = new ReadExcel().getExcel(path);
Calendar cal = Calendar.getInstance();
try {
if (cal.get(Calendar.HOUR_OF_DAY) == 8 && cal.get(Calendar.MINUTE) >= 30) {
cal.add(Calendar.HOUR_OF_DAY, -16);
cal.set(Calendar.MINUTE, 0);
List<NewsResult> list = new ESUtil().pushByKey(cal.getTime(), new Date(), sources,"media");
String url = PushFinanceByTimeLess.class.getClassLoader().getResource("/").getPath() + "/"
+ (int) (Math.random() * 5000) + "sends.xls";
cal.add(Calendar.HOUR_OF_DAY, 16);
sendsEmail(cal, list, url);
sleep(1000 * 60 * 60);
} else if (cal.get(Calendar.HOUR_OF_DAY) == 11) {
cal.add(Calendar.HOUR_OF_DAY, -3);
List<NewsResult> list = new ESUtil().pushByKey(cal.getTime(), new Date(), sources,"media");
String url = PushFinanceByTimeLess.class.getClassLoader().getResource("/").getPath() + "/"
+ (int) (Math.random() * 5000) + "sends.xls";
cal.add(Calendar.HOUR_OF_DAY, 3);
sendsEmail(cal, list, url);
sleep(1000 * 60 * 60);
}
if (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7) {
if (cal.get(Calendar.HOUR_OF_DAY) == 16 && cal.get(Calendar.MINUTE) >= 30) {
cal.add(Calendar.HOUR_OF_DAY, -5);
cal.set(Calendar.MINUTE, 0);
List<NewsResult> list = new ESUtil().pushByKey(cal.getTime(), new Date(), sources,"media");
String url = PushFinanceByTimeLess.class.getClassLoader().getResource("/").getPath() + "/"
+ (int) (Math.random() * 5000) + "sends.xls";
cal.add(Calendar.HOUR_OF_DAY, 5);
sendsEmail(cal, list, url);
sleep(1000 * 60 * 60);
}
}
sleep(1000 * 60 * 5);
} catch (Exception e) {
log.error("推送错误信息", e);
}
}
}
private void sendsEmail(Calendar cal, List<NewsResult> list, String url) throws Exception {
new ExcelUtil().pushDataWithFinance(list, cal.getTime(), url);
SendMailUtil.sendMessage("949131080@qq.com", url, "金融");
SendMailUtil.sendMessage("yuhualong@zhiweidata.com", url, "金融");
SendMailUtil.sendMessage("ligaodie@zhiweidata.com", url, "金融");
ExcelUtil.delete(url);
}
}
package com.zhiwei.readWechat;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
public class Client {
public static void main(String[] args) throws IOException {
try {
Socket socket = new Socket("192.168.0.245", 22222);
System.out.println("客户端启动成功");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter write = new PrintWriter(socket.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String readline = "", getLine = "";
// while (!readline.equals("get:end")) {
readline = br.readLine();
write.println(readline);
write.flush();
if ((getLine = in.readLine()).equals("end:dataSend")) {
System.out.println("Server:" + getLine);
// break;
}
System.out.println("Server:" + getLine);
// }
write.close();
in.close();
socket.close();
} catch (Exception e) {
System.out.println("can not listen to:" + e);// 出错,打印出错信息
}
}
}
package com.zhiwei.readWechat;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import com.zw.entity.ReadWechat;
/**
* 获取地址输入
*
* @author Administrator
*
*/
public class ReadExcel {
/**
* 获取一组
*
* @param url
* @return
*/
public static List<ReadWechat> getExcel(String url) {
InputStream in = null;
try {
in = new FileInputStream(new File(url));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
List<ReadWechat> list = new ArrayList<>();
Workbook book = null;
try {
book = getExcelWorkbook(in);
} catch (IOException e) {
e.printStackTrace();
}
Sheet sheet = getSheetByNum(book, 0);
int lastRowNum = sheet.getLastRowNum();
for (int i = 1; i <= lastRowNum; i++) {
Row row = null;
row = sheet.getRow(i);
if (row != null) {
int lastCellNum = row.getLastCellNum();
Cell cell = null;
try {
ReadWechat rw = new ReadWechat();
for (int j = 0; j < lastCellNum; j++) {
cell = row.getCell(j);
if (cell != null) {
// String str = cell.getStringCellValue();
if (sheet.getRow(0).getCell(j).getStringCellValue().equals("地址")) {
rw.setUrl(cell.getStringCellValue());
}
if (sheet.getRow(0).getCell(j).getStringCellValue().equals("标题")) {
rw.setTitle(cell.getStringCellValue());
}
if (sheet.getRow(0).getCell(j).getStringCellValue().equals("来源")) {
rw.setSource(cell.getStringCellValue());
}
}
}
list.add(rw);
} catch (Exception e) {
e.printStackTrace();
}
}
}
return list;
}
public static Sheet getSheetByNum(Workbook book, int number) {
Sheet sheet = null;
try {
sheet = book.getSheetAt(number);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return sheet;
}
public static Workbook getExcelWorkbook(InputStream in) throws IOException {
Workbook book = null;
try {
book = WorkbookFactory.create(in);
} catch (InvalidFormatException e) {
e.printStackTrace();
}
return book;
}
}
package com.zhiwei.readWechat;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import org.springframework.stereotype.Component;
@Component
public class ServerClient extends Thread {
public static boolean needSend = false;
public ServerClient() {
this.start();
}
public static void main(String[] args) {
new ServerClient();
}
@Override
public void run() {
ServerSocket server = null;
try {
server = new ServerSocket(22222);
System.out.println("服务启动");
Socket socket = server.accept();
String line = "";
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter writer = new PrintWriter(socket.getOutputStream());
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// System.out.println("Client:" + in.readLine());
line = in.readLine();
System.out.println(line);
// line = br.readLine();
while (true) {
if (line != null && line.equals("result")) {
writer.println("result:end");
writer.flush();
needSend = true;
System.out.println("收到result");
} else if (line != null) {
writer.println("无效" + line);
writer.flush();
System.out.println("继续接收");
}
line = in.readLine();
if (line != null) {
System.out.println("接收到:" + line);
try {
sleep(1000 * 60);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (line != null && line.equals("asdasd")) {
break;
}
}
writer.close();
in.close();
socket.close();
server.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
package com.zhiwei.readWechat;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.bson.Document;
import com.zhiwei.servlet.RwController;
import com.zhiwei.util.Config;
import com.zhiwei.util.ReadWechatConnect;
import com.zw.entity.ExcelFile;
import com.zw.entity.Excels;
import com.zw.entity.ReadWechat;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import sendmail.SendMailUtil;
public class WechatReadAndWrite {
private final static Log log = LogFactory.getLog(WechatReadAndWrite.class);
public static Excels e;
public static boolean cut = false;
public static String url = Config.getVal("basefile");
public static boolean runStrat = false;
public static int cutCount = 0;
public static String host = Config.getVal("socketIp_wechat");
public static int port = Integer.valueOf(Config.getVal("socketPort_wechat"));
private static ReadWechatConnect m = new ReadWechatConnect();
public static void insert(ExcelFile ef) {
m.insertFileWechat(ef);
}
public static List<ExcelFile> findEf() {
List<ExcelFile> list = m.findFile();
return list;
}
public static String findById(String id) {
return m.findByid(id);
}
public static void writes(List<ReadWechat> list, String mail) throws Exception {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String inurl = url + (int) (Math.random() * 99) + sdf.format(cal.getTime()) + ".xls";
System.out.println(inurl);
File tempFile = new File(inurl);
if (!tempFile.exists()) {
tempFile.createNewFile();
}
WritableWorkbook workbook = Workbook.createWorkbook(tempFile);
WritableSheet sheet = workbook.createSheet("table1", 0);
Label l = null;
WritableFont titleFont = new WritableFont(WritableFont.ARIAL, 14, WritableFont.NO_BOLD, false,
UnderlineStyle.NO_UNDERLINE, jxl.format.Colour.BLACK);
WritableCellFormat titleFormat = new WritableCellFormat(titleFont);
titleFormat.setAlignment(Alignment.CENTRE);
WritableFont urlf = new WritableFont(WritableFont.ARIAL, 11, WritableFont.NO_BOLD, false,
UnderlineStyle.NO_UNDERLINE, Colour.BLUE);
WritableCellFormat urlFormat = new WritableCellFormat(urlf);
urlFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
int seq = 0;
l = new Label(0, seq, "来源");
sheet.addCell(l);
l = new Label(1, seq, "时间");
sheet.addCell(l);
l = new Label(2, seq, "标题");
sheet.addCell(l);
l = new Label(3, seq, "地址");
sheet.addCell(l);
l = new Label(4, seq, "评论数");
sheet.addCell(l);
l = new Label(5, seq, "点赞数");
sheet.addCell(l);
l = new Label(6, seq, "阅读数");
sheet.addCell(l);
for (ReadWechat w : list) {
seq++;
l = new Label(0, seq, w.getSource());
sheet.addCell(l);
l = new Label(1, seq, sdf.format(new Date()));
sheet.addCell(l);
l = new Label(2, seq, w.getTitle());
sheet.addCell(l);
l = new Label(3, seq, w.getUrl());
sheet.addCell(l);
if (w.getComment_num() != null) {
l = new Label(4, seq, w.getComment_num());
sheet.addCell(l);
}
if (w.getZan_num() != null) {
l = new Label(5, seq, w.getZan_num());
sheet.addCell(l);
}
if (w.getRead_num() != null) {
l = new Label(6, seq, w.getRead_num());
sheet.addCell(l);
}
}
int column = 0;
sheet.setColumnView(column++, 20);
sheet.setColumnView(column++, 25);
sheet.setColumnView(column++, 45);
sheet.setColumnView(column++, 25);
sheet.setColumnView(column++, 30);
sheet.setColumnView(column++, 30);
sheet.setColumnView(column++, 30);
workbook.write();
workbook.close();
log.info("内容写入成功");
SendMailUtil.sendMessage(mail, inurl, "ccxe");
ExcelFile ef = new ExcelFile();
ef.setMail(mail);
ef.setUrl(inurl);
insert(ef);
System.out.println("发送完成");
}
public synchronized static void work() {
runStrat = true;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
while (true) {
if (RwController.weChatList.size() > 0) {
try {
e = RwController.weChatList.get(0);
if (e != null) {
e.setStartDate(sdf.format(new Date()));
e.setState("运行中···");
List<ReadWechat> list = ReadExcel.getExcel(e.getUrl());
log.info("数据入库");
m.insertReadWechat(list);// 存储
ServerClient.needSend = false;
while (!ServerClient.needSend) {
Thread.sleep(1000 * 30);
}
Thread.sleep(1000 * 30);
Map<String, ReadWechat> map = new HashMap<>();
for (Document doc : m.findReadWechat()) {
ReadWechat rw = new ReadWechat();
rw.setComment_num(String.valueOf(doc.get("comment_num")));
rw.setUrl(String.valueOf(doc.get("url")));
rw.setRead_num(String.valueOf(doc.get("read_num")));
rw.setZan_num(String.valueOf(doc.get("zan_num")));
map.put(String.valueOf(doc.get("url")), rw);
}
for (ReadWechat rw : list) {
if (map.get(rw.getUrl()) != null) {
ReadWechat rwt = map.get(rw.getUrl());
rw.setComment_num(rwt.getComment_num());
rw.setRead_num(rwt.getRead_num());
rw.setZan_num(rwt.getZan_num());
}
}
writes(list, e.getMail());
m.remove();
RwController.weChatList.remove(RwController.weChatList.get(0));
e = null;
}
} catch (NullPointerException e) {
e.printStackTrace();
RwController.weChatList.remove(RwController.weChatList.get(0));
} catch (Exception e1) {
e1.printStackTrace();
RwController.weChatList.remove(RwController.weChatList.get(0));
}
} else {
try {
Thread.sleep(1000 * 60);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
...@@ -4,19 +4,11 @@ import java.io.File; ...@@ -4,19 +4,11 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketAddress;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Vector; import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -89,7 +81,7 @@ public class MainController { ...@@ -89,7 +81,7 @@ public class MainController {
out.println(JSON.toJSONString(ExcelReadAndWrite.findEf()));// out.println(JSON.toJSONString(ExcelReadAndWrite.findEf()));//
out.flush(); out.flush();
out.close(); out.close();
System.out.println("当前队列长度:"+lists.size()); System.out.println("当前队列长度:" + lists.size());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -220,7 +212,7 @@ public class MainController { ...@@ -220,7 +212,7 @@ public class MainController {
} }
Excels excel = new Excels(); Excels excel = new Excels();
List<Weixin> list = ReaderExcel.getExcel(path); List<Weixin> list = ReaderExcel.getExcel(path);
if (list.size() == 0||list.size()>35000) { if (list.size() == 0 || list.size() > 35000) {
return "error2"; return "error2";
} }
excel.setId((int) (Math.random() * 50000) + "k"); excel.setId((int) (Math.random() * 50000) + "k");
...@@ -230,11 +222,12 @@ public class MainController { ...@@ -230,11 +222,12 @@ public class MainController {
excel.setSite(0); excel.setSite(0);
excel.setSurplusCount(list.size()); excel.setSurplusCount(list.size());
excel.setStartDate("未开始"); excel.setStartDate("未开始");
log.info("数据量"+list.size()); log.info("数据量" + list.size());
System.out.println(list.size()); System.out.println(list.size());
lists.add(excel); lists.add(excel);
if (!ExcelReadAndWrite.runStrat) { if (!ExcelReadAndWrite.runStrat) {
Thread t = new Thread() { Thread t = new Thread() {
@Override
public void run() { public void run() {
try { try {
ExcelReadAndWrite.save2(); ExcelReadAndWrite.save2();
...@@ -250,7 +243,6 @@ public class MainController { ...@@ -250,7 +243,6 @@ public class MainController {
return "error3"; return "error3";
} }
@RequestMapping(value = "/zhNum", produces = "application/json;charset=utf-8") @RequestMapping(value = "/zhNum", produces = "application/json;charset=utf-8")
@ResponseBody @ResponseBody
public String getzhNum() { public String getzhNum() {
......
package com.zhiwei.servlet;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Vector;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSON;
import com.zhiwei.chendong.ExcelReadAndWrite;
import com.zhiwei.readWechat.ReadExcel;
import com.zhiwei.readWechat.WechatReadAndWrite;
import com.zhiwei.util.Config;
import com.zw.entity.Excels;
import com.zw.entity.ReadWechat;
@Controller
public class RwController {
private final static Log log = LogFactory.getLog(RwController.class);
public static Vector<Excels> weChatList = new Vector<Excels>();
@RequestMapping(value = "/rwdownLode")
public void downLode(HttpServletRequest request, HttpServletResponse response) {
System.out.println(ExcelReadAndWrite.findEf());
try {
response.setContentType("text/plain;charset=utf-8");
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Access-Control-Allow-Origin", "*");
PrintWriter out = response.getWriter();
out.println(JSON.toJSONString(WechatReadAndWrite.findEf()));//
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping(value = "/rwdownLodeFile")
public void downFile(HttpServletRequest request, HttpServletResponse response, String id) {
try {
response.setContentType("application/msexcel;");
response.setHeader("Content-Disposition",
new String(("attachment;filename=" + "downLode.xls").getBytes("GB2312"), "UTF-8"));
File f = new File(WechatReadAndWrite.findById(id));
FileInputStream in = new FileInputStream(f);
byte b[] = new byte[1024];
int i = 0;
ServletOutputStream out = response.getOutputStream();
while ((i = in.read(b)) != -1) {
out.write(b, 0, i);
}
out.flush();
out.close();
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping(value = "/weChatup")
public String weChatup(HttpServletRequest req, HttpServletResponse res, MultipartFile file, String mail,
String mail2) throws Exception {
if (!mail.equals(mail2)) {
return "error";
}
log.info(mail);
String fileName = file.getOriginalFilename();
if (fileName.endsWith(".xls") || fileName.endsWith(".xlsx")) {// 是否是excel结尾的
String path = Config.getVal("timefileUrl") + "/" + mail + fileName;
log.info(path);
File targetFile = new File(path);
if (!targetFile.exists()) {
targetFile.mkdirs();
}
// 保存
try {
file.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
Excels excel = new Excels();
List<ReadWechat> list = ReadExcel.getExcel(path);
if (list.size() == 0 || list.size() > 35000) {
return "error2";
}
excel.setId((int) (Math.random() * 5000) + "wechat");
excel.setNeed((list.size() * 50 + 40) / 60);
excel.setMail(mail);
excel.setUrl(path);
excel.setSite(0);
excel.setSurplusCount(list.size());
excel.setStartDate("未开始");
log.info("数据量" + list.size());
weChatList.add(excel);
if (!WechatReadAndWrite.runStrat) {
Thread t = new Thread() {
@Override
public void run() {
try {
WechatReadAndWrite.work();
} catch (Exception e) {
e.printStackTrace();
}
}
};
t.start();
}
return "redirect:rwsh";
}
return "error3";
}
@RequestMapping("/rwsh")
public String readshowPage() {
return "readShow";
}
@RequestMapping("/rwdown")
public String rwdown() {
return "readWechatDown";
}
@RequestMapping("/rwExcel")
public String rwExcel() {
return "readWechat";
}
@RequestMapping(value = "/rwShow")
public void readShows(HttpServletRequest request, HttpServletResponse response) throws IOException {
System.out.println(weChatList.size());
try {
for (int i = 0; i < weChatList.size(); i++) {
Excels e = weChatList.get(i);
e.setSite(i + 1);
}
response.setContentType("text/plain;charset=utf-8");
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Access-Control-Allow-Origin", "*");
PrintWriter out = response.getWriter();
out.println(JSON.toJSONString(weChatList));// 返回jsonp格式数据
out.flush();
out.close();
System.out.println(weChatList.size());
} catch (IOException e) {
e.printStackTrace();
}
}
}
package com.zhiwei.util;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bson.Document;
import org.bson.types.ObjectId;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import com.mongodb.MongoClient;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.MongoDatabase;
import com.zw.entity.ExcelFile;
import com.zw.entity.ReadWechat;
public class ReadWechatConnect {
private MongoClient client;
public ReadWechatConnect() {
client = new MongoClient("192.168.0.11", 27217);
}
public void insertFileWechat(ExcelFile excel) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DB db = client.getDB(Config.getVal("rdbName"));
DBCollection dbCollection = db.getCollection(Config.getVal("rwFileUrl"));
DBObject obj = new BasicDBObject();
obj.put("url", excel.getUrl());
obj.put("mail", excel.getMail());
obj.put("date", sdf.format(new Date()));
dbCollection.insert(obj);
}
public List<ExcelFile> findFile() {
List<ExcelFile> list = new ArrayList<ExcelFile>();
DB db = client.getDB(Config.getVal("rdbName"));
DBCollection dbCollection = db.getCollection(Config.getVal("rwFileUrl"));
DBCursor dbCursor = dbCollection.find().sort(new BasicDBObject("date", -1));
System.out.println("size" + dbCursor.size());
while (dbCursor.hasNext()) {
Map<String, Object> map = (Map<String, Object>) dbCursor.next();
ExcelFile ef = new ExcelFile();
ef.setId(String.valueOf(map.get("_id")));
ef.setUrl(String.valueOf(map.get("url")));
ef.setMail(String.valueOf(map.get("mail")));
ef.setDate(String.valueOf(map.get("date")));
list.add(ef);
}
return list;
}
public String findByid(String id) {
DB db = client.getDB(Config.getVal("rdbName"));
DBCollection dbCollection = db.getCollection(Config.getVal("rwFileUrl"));
DBObject obj = dbCollection.findOne(new BasicDBObject("_id", new ObjectId(id)));
return String.valueOf(obj.get("url"));
}
/**
* 点赞阅读的插入
*/
public void insertReadWechat(List<ReadWechat> list) {
List<Document> saveList = new ArrayList<Document>();
for (int i = 1; i <= list.size(); i++) {
Document doc = new Document();
doc.append("_id", "" + i);
doc.append("url", list.get(i - 1).getUrl());
saveList.add(doc);
}
MongoDatabase db = client.getDatabase(Config.getVal("rdbName"));
MongoCollection<Document> collection = db.getCollection(Config.getVal("insertCol"));
collection.insertMany(saveList);
db.getCollection(Config.getVal("resultCol")).insertMany(saveList);
}
/**
* 从mango获取数据
*
* @return
*/
public List<Document> findReadWechat() {
List<Document> result = new ArrayList<Document>();
MongoDatabase db = client.getDatabase(Config.getVal("rdbName"));
MongoCollection<Document> collection = db.getCollection(Config.getVal("resultCol"));
FindIterable<Document> fit = collection.find();
MongoCursor<Document> cursor = fit.iterator();
while (cursor.hasNext()) {
result.add(cursor.next());
}
return result;
}
public void remove() {
MongoDatabase db = client.getDatabase(Config.getVal("rdbName"));
MongoCollection<Document> collection = db.getCollection(Config.getVal("resultCol"));
collection.drop();
}
public static void main(String[] args) {
ReadWechatConnect rc = new ReadWechatConnect();
Map<String, ReadWechat> map = new HashMap<>();
for (Document doc : rc.findReadWechat()) {
ReadWechat rw = new ReadWechat();
rw.setComment_num(String.valueOf(doc.get("comment_num")));
rw.setUrl(String.valueOf(doc.get("url")));
rw.setRead_num(String.valueOf(doc.get("read_num")));
rw.setZan_num(String.valueOf(doc.get("zan_num")));
System.out.println(rw);
}
}
}
package com.zw.entity;
public class ReadWechat {
private String title;
private String source;
private String url;
private String create_time;
private String zan_num;
private String read_num;
private String comment_num;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getCreate_time() {
return create_time;
}
public void setCreate_time(String create_time) {
this.create_time = create_time;
}
public String getZan_num() {
return zan_num;
}
public void setZan_num(String zan_num) {
this.zan_num = zan_num;
}
public String getRead_num() {
return read_num;
}
public void setRead_num(String read_num) {
this.read_num = read_num;
}
public String getComment_num() {
return comment_num;
}
public void setComment_num(String comment_num) {
this.comment_num = comment_num;
}
@Override
public String toString() {
return "ReadWechat [title=" + title + ", source=" + source + ", url=" + url + ", create_time=" + create_time
+ ", zan_num=" + zan_num + ", read_num=" + read_num + ", comment_num=" + comment_num + "]";
}
}
basefile=/home/nbzhiwei/upload/ #basefile=/home/nbzhiwei/upload/
#basefile=C:/Users/admin/Desktop/ basefile=C:/Users/admin/Desktop/
timefileUrl=/home/nbzhiwei/upload #timefileUrl=/home/nbzhiwei/upload
#timefileUrl=C:/Users/admin/Desktop timefileUrl=C:/Users/admin/Desktop/
#host=106.14.249.240 #host=106.14.249.240
#port=26807 #port=26807
#password=1q2w3e4r #password=1q2w3e4r
...@@ -25,4 +25,15 @@ openid=oTc_rssM56GjwdRgwTD2dfQMq4Rg ...@@ -25,4 +25,15 @@ openid=oTc_rssM56GjwdRgwTD2dfQMq4Rg
pushMail=949131080@qq.com,yuhualong@zhiweidata.com,ligaodie@zhiweidata.com,shenqiao@zhiweidata.com,chenxi@zhiweidata.com pushMail=949131080@qq.com,yuhualong@zhiweidata.com,ligaodie@zhiweidata.com,shenqiao@zhiweidata.com,chenxi@zhiweidata.com
#,oTc_rsju0ZJsEnzFX3WRgZihNWpc,oTc_rsme_NjN1tVh3GSHLdHtq1o8 #,oTc_rsju0ZJsEnzFX3WRgZihNWpc,oTc_rsme_NjN1tVh3GSHLdHtq1o8
######################################## ########################################
##wechat zan点赞阅读
socketPort_wechat=22222
rdbName=WechatHistoryData
rdbHost=192.168.0.11
rdbPort=27217
insertCol=NeedReadLike
resultCol=NeedReadLikeResult
rwFileUrl=rwFiles
######################################
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Table</title>
<link rel="stylesheet"
href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script
src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<style>
body {
background-image: url("./2.jpg");
}
#timeCanvas {
position: absolute;
top: 3%;
right: 3%;
height: 30px;
width: 210px;
}
.table {
position: absolute;
left: 15%;
top: 7%;
width: 70%;
z-index: 100;
}
.table tr {
background-color: transparent !important;
}
.table tr td {
border-color: #000 !important;
}
h5 {
position: relative;
z-index: 2000;
}
</style>
</head>
<body>
<h5>如需下载,请至<a href="/change4weixin/rwdown" target="_blank">下载页</a></h5>
<canvas id="timeCanvas"></canvas>
<canvas id="c_n149" width="1920" height="1080"
style="position: fixed; top: 0px; right: 0px;z-index: -1;"></canvas>
<script src="./time.js"></script>
<script src="./canvas.js"></script>
<h5>如需插队运行,请联系------沈金柱(949131080)</h5>
<table class="table table-striped">
<thead>
<tr>
<td>编号</td>
<td>提交者</td>
<td>运行需要时间(分)</td>
<td>开始时间</td>
</tr>
</thead>
<tbody class="data"></tbody>
</table>
<script>
$(function () {
var tbody = $('.data')
var d = []
function getData() {
$(tbody).empty();
d = []
$.ajax({
type: 'get',
datatype: 'json',
url: '/change4weixin/rwShow',
success: function (data) {
data = JSON.parse(data)
d = data
data.forEach((e, index) => {
tbody.append("<tr class='TR'>"
+"<td class='id'>"+e.site+"</td>"
+"<td>"+e.mail+"</td>"
+"<td>"+e.surplusCount/3+"</td>"
+"<td>"+e.startDate+"</td>"
+"</td></tr>")
})
}
})
}
getData()
})
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet"
href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script
src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous">
</script>
<style type="text/css">
body {
background-image: url("./2.jpg");
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
padding-top: 200px; -
-imgwidth: 0px;
}
form {
margin-top: 3%;
width: 20%;
}
.form-group {
margin-top: 20px;
}
#submit:hover {
color: #66afe9;
}
.example {
position: absolute;
}
.example-title {
display: inline-block;
font-size: 16px;
margin: 20px 5px 10px;
font-weight: bold;
cursor: pointer;
}
.example-title:hover {
color: #66afe9;
}
.ck{
color:red;
}
#imgModal, #fileModal ,#showModal,#errorModal{
padding: 10% calc(50% - 480px);
text-align: center;
}
</style>
</head>
<body>
<form action="/change4weixin/weChatup" enctype="multipart/form-data"
method="post">
<span>文件</span> <input type="file" name="file" />
<div class="form-group">
<label for="email">邮箱号</label> <input type="text" name="mail"
class="form-control" id="email">
</div>
<div class="form-group">
<label for="emailAgain">重复邮箱号</label> <input type="text" name="mail2"
class="form-control" id="emailAgain">
</div>
<div class="form-group">
<input type="submit" value="提交" class="form-control" id="submit" />
</div>
</form>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Table</title>
<link rel="stylesheet"
href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script
src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<style>
body {
background-image: url("./2.jpg");
}
#timeCanvas {
position: absolute;
top: 3%;
right: 3%;
height: 30px;
width: 210px;
}
.table {
position: absolute;
left: 15%;
top: 7%;
width: 70%;
z-index: 100;
}
.table tr {
background-color: transparent !important;
}
.table tr td {
border-color: #000 !important;
}
</style>
</head>
<body>
<canvas id="timeCanvas"></canvas>
<canvas id="c_n149" width="1920" height="1080"
style="position: fixed; top: 0px; right: 0px;"></canvas>
<script src="./time.js"></script>
<script src="./canvas.js"></script>
<h5>如需插队运行,请联系------沈金柱(949131080)</h5>
<table class="table table-striped">
<thead>
<tr>
<td>编号</td>
<td>邮箱</td>
<td>日期</td>
<td>状态</td>
</tr>
</thead>
<tbody class="data"></tbody>
</table>
<script>
$(function () {
var tbody = $('.data')
var d = []
function getData() {
$(tbody).empty();
d = []
$.ajax({
type: 'get',
datatype: 'json',
url: '/change4weixin/rwdownLode',
success: function (data) {
data = JSON.parse(data)
d = data
data.forEach((e, index) => {
tbody.append("<tr class='TR'>"
+"<td>"+e.id+"</td>"
+"<td>"+e.mail+"</td>"
+"<td>"+e.date+"</td>"
+"<td>"+e.state+"</td>"
+"<td><a href='/change4weixin/rwdownLodeFile?id="+e.id+"'>下载</a>"
+"</td></tr>")
})
}
})
}
getData()
})
</script>
</body>
</html>
basefile=/home/nbzhiwei/upload/ #basefile=/home/nbzhiwei/upload/
#basefile=C:/Users/admin/Desktop/ basefile=C:/Users/admin/Desktop/
timefileUrl=/home/nbzhiwei/upload #timefileUrl=/home/nbzhiwei/upload
#timefileUrl=C:/Users/admin/Desktop timefileUrl=C:/Users/admin/Desktop/
#host=106.14.249.240 #host=106.14.249.240
#port=26807 #port=26807
#password=1q2w3e4r #password=1q2w3e4r
...@@ -25,4 +25,15 @@ openid=oTc_rssM56GjwdRgwTD2dfQMq4Rg ...@@ -25,4 +25,15 @@ openid=oTc_rssM56GjwdRgwTD2dfQMq4Rg
pushMail=949131080@qq.com,yuhualong@zhiweidata.com,ligaodie@zhiweidata.com,shenqiao@zhiweidata.com,chenxi@zhiweidata.com pushMail=949131080@qq.com,yuhualong@zhiweidata.com,ligaodie@zhiweidata.com,shenqiao@zhiweidata.com,chenxi@zhiweidata.com
#,oTc_rsju0ZJsEnzFX3WRgZihNWpc,oTc_rsme_NjN1tVh3GSHLdHtq1o8 #,oTc_rsju0ZJsEnzFX3WRgZihNWpc,oTc_rsme_NjN1tVh3GSHLdHtq1o8
######################################## ########################################
##wechat zan点赞阅读
socketPort_wechat=22222
rdbName=WechatHistoryData
rdbHost=192.168.0.11
rdbPort=27217
insertCol=NeedReadLike
resultCol=NeedReadLikeResult
rwFileUrl=rwFiles
######################################
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment