Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
东方怂天
cxmooc-tools
提交
91aa8453
C
cxmooc-tools
项目概览
东方怂天
/
cxmooc-tools
通知
11
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cxmooc-tools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
91aa8453
编写于
7月 30, 2019
作者:
C
codfrm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update reward
上级
3f58e1dd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
9 deletion
+20
-9
docs/4-Reward/README.md
docs/4-Reward/README.md
+2
-0
package-lock.json
package-lock.json
+2
-1
src/server/listen.js
src/server/listen.js
+16
-8
未找到文件。
docs/4-Reward/README.md
浏览文件 @
91aa8453
...
...
@@ -14,6 +14,8 @@ title: 捐赠
|金额|渠道|捐赠者|备注|
|----|----|----|----|
|¥ 50.00|QQ红包|陈哲.IT||
|¥ 20.00|QQ红包|鸪||
|¥ 10.00|QQ红包|幻蓝|打赏了一个鸡腿|
|¥ 10.00|微信赞赏码|温瞳_|验证码接口推荐换成若快等,(会考虑增加)|
|¥ 5.00|微信赞赏码|xbei|ᕕ(˵•̀෴•́˵)ᕗ
...
...
package-lock.json
浏览文件 @
91aa8453
{
"name"
:
"cxmooc-tools"
,
"version"
:
"2.
0.8
"
,
"version"
:
"2.
1.0
"
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"dependencies"
:
{
...
...
@@ -7702,6 +7702,7 @@
"resolved"
:
"https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz"
,
"integrity"
:
"sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"safe-buffer"
:
"^5.1.2"
,
"yallist"
:
"^3.0.0"
...
...
src/server/listen.js
浏览文件 @
91aa8453
...
...
@@ -45,7 +45,7 @@ app.use(bodyParser.urlencoded({
}));
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
'
static
'
),
{
maxage
:
'
7
d
'
maxage
:
'
1
d
'
}));
app
.
get
(
'
/
'
,
function
(
req
,
res
)
{
...
...
@@ -61,7 +61,7 @@ app.use(function (req, res, next) {
redis
.
onlineAdd
(
ip
);
res
.
header
(
"
Access-Control-Allow-Origin
"
,
req
.
headers
[
'
origin
'
]);
res
.
header
(
"
Access-Control-Allow-Headers
"
,
"
Content-Type,Content-Length,Authorization,Accept,X-Requested-With
"
);
res
.
header
(
"
Access-Control-Allow-Headers
"
,
"
Content-Type,Content-Length,Authorization,Accept,X-Requested-With
,X-Version
"
);
res
.
header
(
"
Access-Control-Allow-Methods
"
,
"
PUT,POST,GET,DELETE,OPTIONS
"
);
if
(
req
.
method
==
"
OPTIONS
"
)
{
return
res
.
status
(
200
).
send
(
'
success
'
);
...
...
@@ -89,6 +89,7 @@ app.post('/answer', function (req, res) {
});
}
let
num
=
0
;
let
addTokenNum
=
0
;
for
(
let
i
in
req
.
body
)
{
let
topic
=
req
.
body
[
i
];
if
(
topic
.
correct
==
undefined
||
topic
.
type
==
undefined
||
topic
.
topic
==
undefined
||
...
...
@@ -113,6 +114,8 @@ app.post('/answer', function (req, res) {
data
.
platform
=
platform
;
data
.
token
=
token
;
mooc
.
insert
(
'
answer
'
,
data
);
//增加token次数
addTokenNum
+=
10
;
}
else
if
((
type
==
4
&&
result
.
type
==
4
)
||
(
type
==
2
&&
result
.
type
==
2
))
{
//填空多选,答案合并
try
{
...
...
@@ -128,10 +131,15 @@ app.post('/answer', function (req, res) {
}
ret
.
push
(
cond
);
if
(
ret
.
length
==
num
)
{
res
.
send
({
code
:
0
,
msg
:
'
success
'
,
result
:
ret
redis
.
getTokenNum
(
token
,
function
(
num
)
{
redis
.
setToken
(
token
,
parseInt
(
num
)
+
addTokenNum
)
res
.
send
({
code
:
0
,
msg
:
'
success
'
,
result
:
ret
,
token_num
:
parseInt
(
num
)
+
addTokenNum
,
add_token_num
:
addTokenNum
});
});
}
});
...
...
@@ -183,12 +191,12 @@ app.post('/v2/answer', function (req, res) {
let
platform
=
req
.
query
.
platform
||
'
cx
'
;
selectAnswer
(
topic
,
res
,
function
(
i
)
{
let
where
=
{};
let
topic_n
=
dealSymbol
(
topic
[
i
].
replace
(
/
[
-
\/\\
^$*+
?
.|[
\]
{}
]
/g
,
'
\\
$&
'
));
let
topic_n
=
dealSymbol
(
topic
[
i
].
replace
(
/
[
-
\/\\
^$*+.|[
\]
{}
]
/g
,
'
\\
$&
'
));
// topic[i] = topic;
if
(
type
[
i
]
!=
undefined
)
{
where
=
{
type
:
parseInt
(
type
[
i
])
};
}
where
.
topic
=
{
$regex
:
'
^
'
+
topic_n
};
where
.
topic
=
{
$regex
:
'
^
'
+
topic_n
};
return
where
;
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录