...
|
...
|
@@ -143,7 +143,7 @@ const whSurfController = { |
|
|
},
|
|
|
|
|
|
prizeCreate: async function(req, res) {
|
|
|
let param = req.body && req.body.prizes;
|
|
|
let param = req.body;
|
|
|
|
|
|
try {
|
|
|
if (param && param.length && param instanceof Array) {
|
...
|
...
|
@@ -184,7 +184,7 @@ const whSurfController = { |
|
|
},
|
|
|
|
|
|
prizeUpdate: async function(req, res) {
|
|
|
let param = req.body && req.body.prizes;
|
|
|
let param = req.body;
|
|
|
|
|
|
try {
|
|
|
if (param && param.length && param instanceof Array) {
|
...
|
...
|
@@ -241,6 +241,55 @@ const whSurfController = { |
|
|
code: 200,
|
|
|
data: result
|
|
|
});
|
|
|
},
|
|
|
|
|
|
prizeModify: async function(req, res) {
|
|
|
try {
|
|
|
let data = valid(req.body, {
|
|
|
id: {type: 'number', empty: false},
|
|
|
act_id: {type: 'number', empty: false},
|
|
|
name: {type: 'string', empty: true},
|
|
|
type: {type: 'number', empty: true},
|
|
|
value: {type: 'string', empty: true},
|
|
|
img: {type: 'string', empty: true},
|
|
|
total: {type: 'number', empty: true},
|
|
|
total_left: {type: 'number', empty: true},
|
|
|
chance: {type: 'number', empty: true},
|
|
|
prize_bg: {type: 'string', empty: true},
|
|
|
prize_idx: {type: 'number', empty: true},
|
|
|
});
|
|
|
|
|
|
let result = await req.ctx(wheelSurfModel).prizeModify(data);
|
|
|
|
|
|
return res.json({
|
|
|
code: 200,
|
|
|
data: result
|
|
|
});
|
|
|
} catch (e) {
|
|
|
return res.json({
|
|
|
code: 203,
|
|
|
result: false,
|
|
|
msg: e
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
|
|
|
prizeDelete: async function(req, res) {
|
|
|
let id = req.query.id;
|
|
|
|
|
|
if (!id) {
|
|
|
return res.json({
|
|
|
code: 202,
|
|
|
result: false,
|
|
|
msg: '参数为空'
|
|
|
});
|
|
|
}
|
|
|
let result = await req.ctx(wheelSurfModel).prizeDelete(id);
|
|
|
|
|
|
return res.json({
|
|
|
code: 200,
|
|
|
data: result
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
|