Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
马玮
/
carspider
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6b0c0ace
authored
Sep 04, 2017
by
马玮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add core js
parent
ec631b16
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
20 deletions
+36
-20
README.md
+9
-8
boot.js
+3
-6
lib/core.js
+13
-0
sql/history.sql
+0
-3
test.js
+11
-3
No files found.
README.md
View file @
6b0c0ace
...
@@ -17,8 +17,9 @@ sudo yum install redis
...
@@ -17,8 +17,9 @@ sudo yum install redis
## How to use
## How to use
```
```
1.node accountTool.js -t saveAccount -d 51271 -w autohome -u 河南明志汽车大迈8054 -p hnmz147852.
1.node accountTool.js -t saveAccount -d 51234 -w autohome -u 河南明志汽车大迈8054 -p hnmz147852.
2.LOG_LEVEL='debug' LOG_TYPE='console' node boot.js -t fetchClues -a 1
2.node accountTool.js -t saveAccount -d 51234 -w easypass -u 100074110 -p hnmz147852.
3.LOG_LEVEL='debug' LOG_TYPE='console' node boot.js -t fetchClues -a all
```
```
## To do list:
## To do list:
...
@@ -40,15 +41,15 @@ sudo yum install redis
...
@@ -40,15 +41,15 @@ sudo yum install redis
-
[
]
功能:线索销售映射(不一定做)
-
[
]
功能:线索销售映射(不一定做)
-
[
x
]
功能:线索统计
-
[
x
]
功能:线索统计
-
[
x
]
功能:生成账号记录命令行工具
-
[
x
]
功能:生成账号记录命令行工具
-
[
]
功能:线索增量更新
-
[
x
]
功能:线索增量更新,基本完成,还有5%优化空间
-
[
]
功能:增加日志系统,多进程日志处理50%
-
[
x
]
功能:增加日志系统,多进程日志处理(都写入一个日志文件方便管理)
-
[
]
功能:依赖注入解耦
-
[
]
功能:依赖注入解耦
50%
-
[
]
功能:发现第三方车型和本地不匹配将未知车型入库方便开发爬取同步车型
-
[
x
]
功能:车型不匹配记入日志
-
[
]
功能:线索入库前对数据进行基础校验(如车型不匹配等如何处理)
-
[
x
]
功能:线索入库前对数据进行基础校验
-
[
]
功能:Cluster分布式进程调度
-
[
]
功能:Cluster分布式进程调度
-
[
]
功能:增加随机userAgent
-
[
]
功能:增加随机userAgent
-
[
]
功能:增加测试用例和工具
-
[
]
功能:增加测试用例和工具
-
[
]
功能:通过环境
变量设定根目录
-
[
x
]
功能:通过全局
变量设定根目录
-
[
]
功能:抓取线索一半登录失效需要重新登录
-
[
]
功能:抓取线索一半登录失效需要重新登录
-
[
]
优化:所有forEach用for...of替换,对async/await友好
-
[
]
优化:所有forEach用for...of替换,对async/await友好
-
[
]
优化:cookie使用redis做一级缓存,缓存不存在时再从db读取
-
[
]
优化:cookie使用redis做一级缓存,缓存不存在时再从db读取
...
...
boot.js
View file @
6b0c0ace
...
@@ -3,17 +3,14 @@ User: MaWei
...
@@ -3,17 +3,14 @@ User: MaWei
Date: 2017.7.31
Date: 2017.7.31
*/
*/
'use strict'
;
'use strict'
;
// 初始化环境变量
process
.
env
.
NODE_ENV
=
process
.
env
.
NODE_ENV
||
'production'
;
const
core
=
require
(
'./lib/core'
)
;
process
.
env
.
NODE_CONFIG_DIR
=
__dirname
+
'/config'
;
core
.
init
()
;
const
program
=
require
(
'commander'
);
const
program
=
require
(
'commander'
);
const
Promise
=
require
(
'bluebird'
);
const
Promise
=
require
(
'bluebird'
);
const
readline
=
require
(
'readline'
);
const
readline
=
require
(
'readline'
);
global
.
__basedir
=
__dirname
;
global
.
__libdir
=
__basedir
+
'/lib'
;
const
DI
=
require
(
`./lib/DI`
);
const
DI
=
require
(
`./lib/DI`
);
const
Spider
=
require
(
'./lib/spider'
);
const
Spider
=
require
(
'./lib/spider'
);
const
DealerHelper
=
require
(
`./lib/helpers/Dealer`
);
const
DealerHelper
=
require
(
`./lib/helpers/Dealer`
);
...
...
lib/core.js
0 → 100644
View file @
6b0c0ace
'use strict'
;
const
path
=
require
(
'path'
);
exports
.
init
=
()
=>
{
// 初始化环境变量
global
.
__basedir
=
path
.
dirname
(
__dirname
);
global
.
__libdir
=
__basedir
+
'/lib'
;
process
.
env
.
NODE_ENV
=
process
.
env
.
NODE_ENV
||
'production'
;
process
.
env
.
NODE_CONFIG_DIR
=
__basedir
+
'/config'
;
};
\ No newline at end of file
sql/history.sql
View file @
6b0c0ace
UPDATE
`crm_dd_input_type`
SET
`name`
=
'易车'
WHERE
(
`id`
=
'21'
);
UPDATE
`crm_dd_input_type`
SET
`name`
=
'易车'
WHERE
(
`id`
=
'21'
);
ALTER
IGNORE
TABLE
`crm_clue`
ADD
UNIQUE
INDEX
`customer_car`
(
`shop_id`
,
`clue_input_type`
,
`customer_phone`
,
`intention_des`
(
191
),
`create_time`
);
-- ----------------------------
-- ----------------------------
-- Table structure for crm_dealer_thirdparty_account
-- Table structure for crm_dealer_thirdparty_account
-- ----------------------------
-- ----------------------------
...
...
test.js
View file @
6b0c0ace
...
@@ -2,14 +2,22 @@ const Promise = require('bluebird');
...
@@ -2,14 +2,22 @@ const Promise = require('bluebird');
const
utils
=
require
(
'./lib/utils'
);
const
utils
=
require
(
'./lib/utils'
);
const
_
=
require
(
'./lib/utils/lodash'
);
const
_
=
require
(
'./lib/utils/lodash'
);
process
.
env
.
NODE_ENV
=
process
.
env
.
NODE_ENV
||
'production'
;
process
.
env
.
NODE_ENV
=
process
.
env
.
NODE_ENV
||
'production'
;
process
.
env
.
NODE_CONFIG_DIR
=
__dirname
+
'/config'
;
process
.
env
.
NODE_CONFIG_DIR
=
__dirname
+
'/config'
;
global
.
__basedir
=
__dirname
;
global
.
__basedir
=
__dirname
;
global
.
__libdir
=
__basedir
+
'/lib'
;
global
.
__libdir
=
__basedir
+
'/lib'
;
const
DI
=
require
(
'./lib/DI'
);
// process.env.NODE_PATH = __basedir + '/lib';
DI
.
f
=
'mawei'
;
// require('module').Module._initPaths();
DI
.
LOG_MARK
=
'AID:1'
;
// console.log(process.env.NODE_PATH);
global
.
rootRequire
=
function
(
name
)
{
return
require
(
__dirname
+
'/lib/'
+
name
);
}
// const DI = rootRequire('DI');
// // const DI = require('./lib/DI');
// DI.f = 'mawei';
// DI.LOG_MARK = 'AID:1';
require
(
'./test2'
);
require
(
'./test2'
);
return
;
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment