|
@@ -12,7 +12,9 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.lang.reflect.Member;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -45,4 +47,27 @@ public class TeamService {
|
|
|
team.setTid(id);
|
|
team.setTid(id);
|
|
|
return teamRepo.save(team);
|
|
return teamRepo.save(team);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public Team invite(List<String> invitedIds, String tid) {
|
|
|
|
|
+ Team team = teamRepo.findById(Long.valueOf(tid)).orElseThrow(new BusinessException("未找到群聊"));
|
|
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
|
|
+ params.put("tid", tid);
|
|
|
|
|
+ params.put("owner", team.getOwnerid());
|
|
|
|
|
+ params.put("members", JSONObject.toJSONString(invitedIds));
|
|
|
|
|
+ params.put("magree", "0");
|
|
|
|
|
+ params.put("custom", team.getCustom().toString());
|
|
|
|
|
+ params.put("msg", "欢迎加入大厅测试群~~");
|
|
|
|
|
+ String result = neteaseUserService
|
|
|
|
|
+ .httpPost("team/add.action", "application/x-www-form-urlencoded;charset=utf-8", params);
|
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(result);
|
|
|
|
|
+ Integer code = jsonObject.getInteger("code");
|
|
|
|
|
+ if (code != 200) {
|
|
|
|
|
+ throw new BusinessException("注册出错,请核查后重新注册");
|
|
|
|
|
+ }
|
|
|
|
|
+ Long id = jsonObject.getLong("tid");
|
|
|
|
|
+ team.setTid(id);
|
|
|
|
|
+ List<String> members = team.getMembers();
|
|
|
|
|
+ members.addAll(invitedIds);
|
|
|
|
|
+ return teamRepo.save(team);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|