Authored by huangyi

valid

@@ -138,10 +138,10 @@ const whSurfController = { @@ -138,10 +138,10 @@ const whSurfController = {
138 }, 138 },
139 139
140 prizeCreate: async function(req, res) { 140 prizeCreate: async function(req, res) {
141 - let param = req.body; 141 + let param = req.body && req.body.prizes;
142 142
143 try { 143 try {
144 - if (param instanceof Array) { 144 + if (param && param.length && param instanceof Array) {
145 let arr = param.map((value) => { 145 let arr = param.map((value) => {
146 return valid(value, { 146 return valid(value, {
147 act_id: {type: 'number', empty: false}, 147 act_id: {type: 'number', empty: false},
@@ -179,10 +179,10 @@ const whSurfController = { @@ -179,10 +179,10 @@ const whSurfController = {
179 }, 179 },
180 180
181 prizeUpdate: async function(req, res) { 181 prizeUpdate: async function(req, res) {
182 - let param = req.body; 182 + let param = req.body && req.body.prizes;
183 183
184 try { 184 try {
185 - if (param instanceof Array) { 185 + if (param && param.length && param instanceof Array) {
186 let arr = param.map((value) => { 186 let arr = param.map((value) => {
187 return valid(value, { 187 return valid(value, {
188 id: {type: 'number', empty: false}, 188 id: {type: 'number', empty: false},