alipay.controller.js
676 Bytes
const alipayService = require('./alipay.service');
function submit(req, res, next) {
const { alipayAccount, alipayName } = req.body;
const uid = req.user.uid;
// if (!uid) {
// return res.json({
// code: 401,
// message: '抱歉,您暂未登录!'
// });
// }
if (!alipayAccount || !alipayName) {
return res.json({
code: 404,
message: '用户名或帐号不能为空,请重新填写'
});
}
alipayService.create({ uid, alipayAccount, alipayName }).then(result => {
if (result.error) {
return res.json(result.error);
}
return res.json(result);
}).catch(next);
}
module.exports = {
submit
};