|
@@ -62,6 +62,12 @@ class GroupService extends CrudService {
|
|
|
const { person_limit, persons = [], status } = data;
|
|
|
if (status === '1') return { result: false, msg: '当前团已结束' };
|
|
|
else if (status === '-1') return { result: false, msg: '当前团已关闭' };
|
|
|
+ // 检查是否已经参团
|
|
|
+ const customer = _.get(this.ctx, 'user._id');
|
|
|
+ if (!customer) throw new BusinessError(ErrorCode.NOT_LOGIN, '用户未登录');
|
|
|
+ const r = data.persons.find(f => f.customer === customer);
|
|
|
+ if (r) return { result: false, msg: '您已参团' };
|
|
|
+
|
|
|
// 为0是正常的团员
|
|
|
const realPersons = persons.filter(f => f.status === '0');
|
|
|
if (realPersons.length < person_limit) return { result: true };
|