Skip to content

Commit

Permalink
log-->record dir
Browse files Browse the repository at this point in the history
  • Loading branch information
changegogo committed Apr 4, 2018
1 parent c059346 commit 3be81b1
Show file tree
Hide file tree
Showing 9 changed files with 322 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ public/.DS_Store
*.log
.idea
dai
log
record
2 changes: 1 addition & 1 deletion bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var http = require('http');
* make a log directory, just in case it isn't there.
*/
try {
require('fs').mkdirSync('./log');
require('fs').mkdirSync('./record');
} catch (e) {
if (e.code != 'EEXIST') {
console.error("Could not set up log directory, error was: ", e);
Expand Down
6 changes: 3 additions & 3 deletions config/log4js.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
},
"access": {
"type": "dateFile",
"filename": "log/access.log",
"filename": "record/access.log",
"pattern": "-yyyy-MM-dd",
"category": "http"
},
"app": {
"type": "file",
"filename": "log/app.log",
"filename": "record/app.log",
"maxLogSize": 10485760,
"numBackups": 3
},
"errorFile": {
"type": "file",
"filename": "log/errors.log"
"filename": "record/errors.log"
},
"errors": {
"type": "logLevelFilter",
Expand Down
150 changes: 150 additions & 0 deletions log/access.log

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions log/app.log
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,13 @@
[2018-04-04T17:15:04.326] [ERROR] app - Something went wrong: 404
[2018-04-04T17:15:44.575] [INFO] startup - Express server listening on port 8890 with pid 17238
[2018-04-04T17:17:02.592] [INFO] startup - Express server listening on port 8890 with pid 17288
[2018-04-04T17:27:42.035] [ERROR] app - Something went wrong: 404
[2018-04-04T17:27:54.789] [ERROR] app - Something went wrong: 404
[2018-04-04T17:40:38.322] [ERROR] app - Something went wrong: 404
[2018-04-04T17:41:12.699] [ERROR] app - Something went wrong: 404
[2018-04-04T17:41:23.080] [ERROR] app - Something went wrong: 404
[2018-04-04T17:41:35.127] [ERROR] app - Something went wrong: 404
[2018-04-04T18:21:26.793] [INFO] startup - Express server listening on port 8890 with pid 17431
[2018-04-04T18:22:15.386] [INFO] startup - Express server listening on port 8890 with pid 17451
[2018-04-04T18:25:39.865] [INFO] startup - Express server listening on port 8890 with pid 17500
[2018-04-04T18:45:07.329] [ERROR] app - Something went wrong: 404
7 changes: 7 additions & 0 deletions log/errors.log
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@
[2018-04-04T14:39:47.216] [ERROR] app - Something went wrong: 404
[2018-04-04T14:40:32.384] [ERROR] app - Something went wrong: 404
[2018-04-04T17:15:04.326] [ERROR] app - Something went wrong: 404
[2018-04-04T17:27:42.035] [ERROR] app - Something went wrong: 404
[2018-04-04T17:27:54.789] [ERROR] app - Something went wrong: 404
[2018-04-04T17:40:38.322] [ERROR] app - Something went wrong: 404
[2018-04-04T17:41:12.699] [ERROR] app - Something went wrong: 404
[2018-04-04T17:41:23.080] [ERROR] app - Something went wrong: 404
[2018-04-04T17:41:35.127] [ERROR] app - Something went wrong: 404
[2018-04-04T18:45:07.329] [ERROR] app - Something went wrong: 404
146 changes: 146 additions & 0 deletions public/apii.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>接口文档</title>
<style>
* {
padding: 0;
}
span {
display: block;
}
.container {
width: 60%;
margin: 0 auto;
border: 1px solid gray;
padding: 3px;
}
</style>
</head>
<body>
<div class="container">
<span>1.绑定页面获取短信验证码</span>
<span>url:<i>/code/smsapi</i></span>
<span>请求方式:get</span>
请求参数:
<span>
<pre>
{
telphone: "15373738495"
}
</pre></span>
响应数据:
<pre>
{
code: 200,
msg: "短信验证码获取成功"
}
</pre>

<span>2.绑定页面提交绑定数据</span>
<span>url:<i>/code/smsbind</i></span>
<span>请求方式:post</span>
请求参数:
<span>
<pre>
{
identitycode: //用户标识码,从本地存储或者url参数中获取
telphone: "15373738495" // 用户手机号
smscode: // 验证码,上线后会去掉
imtoken: // 以太坊地址
}
</pre>
</span>
响应数据:
<pre>
{
code: 200,
msg: "绑定成功",
identitycode: //新注册用户的识别码,前端存入本地存储中
}
</pre>

<span>3.分享页面根据用户识别码获取用户数据</span>
<span>url:<i>/info</i></span>
<span>请求方式:post</span>
请求参数:
<span>
<pre>
{
identitycode: //用户标识码,从本地存储或者url参数获取
}
</pre>
</span>
响应数据:
<pre>
{
code:200,
msg:"success",
results:[
{
invitcode:"", // 邀请码
isusedinvit:false, // 邀请码是否已经被使用
sharecount:0, // 分享人数
invitcount:0, // 邀请人数
bindip:"::ffff:192.168.1.223", // 绑定时的ip
totalcancount:0, // 累计获得CAN币的数目
haspickupcount:0, // 已经提取币的数目
ispickup:false, // 是否有提币操作
createtime:"2018-03-29T01:54:09.426Z", // 注册时间
_id:"5abc47412cd50e027d114db8", // id
telphone:"15354687946", // 手机号码
imtoken:"ryu", // 以太坊地址
identitycode:"sYnwCui1ganNcUm6Hnc80g==", // 用户识别码
__v:0
}
]
}
</pre>

<span>4.提币界面获取短信验证码接口</span>
<span>url:<i>/apply/smsapi</i></span>
<span>请求方式:post</span>
请求参数:
<span>
<pre>
{
identitycode: //用户标识码,从本地存储或者url参数中获取
}
</pre>
</span>
响应数据:
<pre>
{
code: 200,
msg: "短信验证码获取成功",
smscode: 5632 // 验证码,上线时会去掉
}
</pre>

<span>5.提币界面申请提币接口</span>
<span>url:<i>/apply</i></span>
<span>请求方式:post</span>
请求参数:
<span>
<pre>
{
identitycode: //用户标识码,从本地存储或者url参数中获取
smscode: 5632 // 短信验证码
}
</pre>
</span>
响应数据,成功数据分2种:
<pre>
{code: 200, msg: "提币成功",count: offsetcount}

{code: 201, msg: "未达到188枚,不可提币", count: offsetcount}
</pre>

</div>


</body>
</html>
5 changes: 3 additions & 2 deletions routes/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ router.get('/smsapi', function(req, res, next){
TemplateParam: `{"code": "${code}"}`
};
//初始化sms_client
let smsClient = new SMSClient({accessKeyId, secretAccessKey});
/* let smsClient = new SMSClient({accessKeyId, secretAccessKey});
let promise = new Promise(function(resolve, reject){
smsClient.sendSMS(postData)
.then(function (res) {
Expand All @@ -54,7 +54,8 @@ router.get('/smsapi', function(req, res, next){
res.json(value);
}).catch(function(err){
res.json(err);
});
});*/
res.json({code: 200, msg: "短信验证码获取成功", results: [], code: code, telphone: telphone});
}else if(!telphone){
// 手机号码为空
res.json({code: 201, msg: "手机号码不能为空", results: []});
Expand Down
1 change: 0 additions & 1 deletion views/error.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<h1><%= message %></h1>
<h2><%= error.status %></h2>
<pre><%= error.stack %></pre>
123

0 comments on commit 3be81b1

Please sign in to comment.