lrf 2 년 전
부모
커밋
5e6a898833
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      app/service/group/group.js

+ 4 - 4
app/service/group/group.js

@@ -56,16 +56,16 @@ class GroupService extends CrudService {
   }
 
   // 检查是否可以加入团
-  async checkGroupCanJoin({ id }) {
+  async checkGroupCanJoin({ id, customer }) {
     const data = await this.model.findById(id);
     if (!data) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到团数据');
     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);
+    const cus = _.get(this.ctx, 'user._id', customer);
+    if (!cus) throw new BusinessError(ErrorCode.NOT_LOGIN, '用户未登录');
+    const r = data.persons.find(f => f.customer === cus);
     if (r) return { result: false, msg: '您已参团' };
 
     // 为0是正常的团员