Authored by 邱骏

Merge branch 'feature/yohood' of git.yoho.cn:fe/yoho-activity-platform into feature/yohood

... ... @@ -59,12 +59,24 @@ const couponController = {
message: '无码券不允许导入数据'
});
}
if (coupon[0].type === 1 && data.length > 1) {
return res.json({
code: 202,
result: false,
message: '通用券只允许导入一条数据'
});
if (coupon[0].type === 1) {
if (data.length > 1) {
return res.json({
code: 202,
result: false,
message: '通用券只允许导入一条数据'
});
}
let count = await req.ctx(CouponModel).couponNoCid(id);
if (count[0].count) {
return res.json({
code: 203,
result: false,
message: '通用券已有数据'
});
}
}
for (let item of data) {
let param = {couponId: id, couponNo: item.couponNo};
... ...
... ... @@ -99,6 +99,9 @@ class CouponModel extends global.yoho.BaseModel {
);
}
couponNoCid(couponId) {
return mysqlCli.query(`select count(1) as count from ${TABLE_COUPON_NO} where coupon_id = :couponId `, {couponId});
}
couponNoListJoinUser(couponId) {
return mysqlCli.query(
... ... @@ -121,7 +124,6 @@ class CouponModel extends global.yoho.BaseModel {
deleteCouponById(id) {
return mysqlCli.query(`DELETE FROM ${TABLE_COUPON} WHERE id = :id `, {id});
}
}
module.exports = CouponModel;
... ...