alipay.controller.js 547 Bytes
const alipayService = require('./alipay.service');

function submit(req, res, next) {
  const { alipayAccount, alipayName } = req.body;
  const uid = req.user.uid;

  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
};