背景
之前文章 自动登陆并获取订单信息, 通过python脚本已经实现了定时从某企业官网爬取用户数据。接着我们需要做如下几个工作:
将数据写入自己的mysql
通过web客户端查看mysql中的数据
技术选型
用什么语言做http服务器 ? c++、 go、c#、java 都可以,
或者用开源组件来做http服务器 ?
我的选择是使用openrestry,通过lua语言来实现mysql数据的增、删、改查。
优点:
跨平台
开发成本低。搭建好框架后,lua代码只要关心sql语句的实现就可以了。
易维护、易升级、易调试
技术要点
lua 语言学习还是比较快的,因为我只是使用mysql的功能,所以只要熟悉基本的函数、字符串、json对象的使用就可以了。
nginx.conf 上配置 lua
1
2
3
4
5
6
7location /hzjzkj
{
default_type text/html;
content_by_lua_file hzjzkj_mysql.lua;
}hzjzkj_mysql.lua 实现基本功能(见末尾)
web的报表界面使用adminLTE的jsgrid 实现
最终效果
1 |
|