wheel-surf.js
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* 大转盘活动controller
* @author: leo <qi.li@yoho.cn>
* @date: 26/09/2018
*/
const wheelSurfModel = require('../models/wheel-surf');
const valid = require('../../../utils/validator');
const whSurfController = {
getNowConf: async function(req, res) {
try {
let data = valid(req.body, {
act_id: {type: 'string', empty: false},
uid: {type: 'number', empty: true},
});
let result = await req.ctx(wheelSurfModel).getNowConf(data);
res.json({code: 200, data: result, result: true});
} catch (e) {
res.json(e);
}
},
goPrize: async function(req, res) {
// 校验用户登录
try {
let data = valid(req.body, {
act_id: {type: 'string', empty: false},
uid: {type: 'number', empty: false},
sessionKey: {type: 'string', empty: false},
appVersion: {type: 'string', empty: false},
appSessionType: {type: 'string', empty: true}
});
let result = await req.ctx(wheelSurfModel).goPrize(data);
res.json({code: 200, data: result, result: true});
} catch (e) {
res.json(e);
}
},
getUserPrize: async function(req, res) {
try {
let data = valid(req.body, {
act_id: {type: 'string', empty: false},
uid: {type: 'number', empty: false},
});
let result = await req.ctx(wheelSurfModel).getUserPrize(data);
res.json({code: 200, data: result, result: true});
} catch (e) {
res.json(e);
}
}
};
module.exports = whSurfController;