From 56aa5e620ec06238c1b0b34ed5391b17bf9e3d2b Mon Sep 17 00:00:00 2001 From: gitdq1016 <31494286+gitdq1016@users.noreply.github.com> Date: Fri, 5 Jul 2024 21:22:34 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=91=E7=9A=84?= =?UTF-8?q?=E7=BA=A2=E5=8C=85=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + .../officialsite/common/base/BaseResponse.java | 4 ++++ .../redpacket/RedPacketController.java | 16 +++------------- .../redpacket/RedPacketRepository.java | 6 ++++++ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index ddc9ff44..47e88794 100644 --- a/build.gradle +++ b/build.gradle @@ -39,6 +39,7 @@ dependencies{ // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.0' + implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16' implementation 'mysql:mysql-connector-java:8.0.28' diff --git a/src/main/java/com/dl/officialsite/common/base/BaseResponse.java b/src/main/java/com/dl/officialsite/common/base/BaseResponse.java index d7afaafd..6b7bfe98 100644 --- a/src/main/java/com/dl/officialsite/common/base/BaseResponse.java +++ b/src/main/java/com/dl/officialsite/common/base/BaseResponse.java @@ -37,4 +37,8 @@ public static BaseResponse success(){ public static BaseResponse failWithReason(String code, String msg){ return new BaseResponse(code, msg, null); } + + public static BaseResponse failWithReason(CodeEnums codeEnums){ + return new BaseResponse(codeEnums.getCode(), codeEnums.getMsg(), null); + } } diff --git a/src/main/java/com/dl/officialsite/redpacket/RedPacketController.java b/src/main/java/com/dl/officialsite/redpacket/RedPacketController.java index 2324eba8..085f54f3 100644 --- a/src/main/java/com/dl/officialsite/redpacket/RedPacketController.java +++ b/src/main/java/com/dl/officialsite/redpacket/RedPacketController.java @@ -1,17 +1,10 @@ package com.dl.officialsite.redpacket; import com.dl.officialsite.common.base.BaseResponse; -import com.dl.officialsite.login.Auth; -import com.dl.officialsite.member.Member; import com.dl.officialsite.member.MemberController; -import com.dl.officialsite.member.MemberRepository; -import com.dl.officialsite.member.MemberService; -import com.fasterxml.jackson.core.JsonProcessingException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; @@ -24,11 +17,9 @@ import javax.persistence.criteria.Root; import javax.validation.Valid; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Optional; -import static com.dl.officialsite.common.converter.StringListConverter.SPLIT_CHAR; import static org.hibernate.criterion.Restrictions.in; @RestController @@ -68,13 +59,12 @@ BaseResponse getRedPacketAll(@RequestParam String address, @RequestMapping(value = "/query/user", method = RequestMethod.GET) BaseResponse getRedPacketByAddress(@RequestParam String address, @RequestParam(required = false) Integer status, - @RequestParam String chainId) { + @RequestParam(required = false) String chainId) { List result; if (status == 0) { - result = redPacketRepository.findByUnclaimedPacket("%" + address + "%", 0, chainId); + result = redPacketRepository.findByUnclaimedPacketWithoutChainId("%" + address + "%", 0, chainId); } else { - result = redPacketRepository.findByClaimedPacket("%" + address + "%", chainId); - + result = redPacketRepository.findByClaimedPacketWithoutChainId("%" + address + "%", chainId); } return BaseResponse.successWithData(result); } diff --git a/src/main/java/com/dl/officialsite/redpacket/RedPacketRepository.java b/src/main/java/com/dl/officialsite/redpacket/RedPacketRepository.java index 4bd5f6ef..76924901 100644 --- a/src/main/java/com/dl/officialsite/redpacket/RedPacketRepository.java +++ b/src/main/java/com/dl/officialsite/redpacket/RedPacketRepository.java @@ -20,6 +20,9 @@ public interface RedPacketRepository extends JpaRepository, @Query(value = "select * from red_packet where claimed_address like ?1 and chain_id = ?2 order by create_time desc", nativeQuery = true) List findByClaimedPacket(@Param("address") String address, @Param("chainId") String chainId); + @Query(value = "select * from red_packet where claimed_address like ?1 and if(isnull(?2), 1=1, chain_id = ?2) order by create_time desc", nativeQuery = true) + List findByClaimedPacketWithoutChainId(@Param("address") String address, @Param("chainId") String chainId); + @Query(value = "select * from red_packet where address_list like ?1 and claimed_address not like ?1 and status = 2 and chain_id = ?2 order by create_time desc", nativeQuery = true) List findByUnclaimedTimeOutPacket(@Param("address") String address, @Param("chainId") String chainId ); @@ -28,6 +31,9 @@ public interface RedPacketRepository extends JpaRepository, @Query(value = "select * from red_packet where address_list like ?1 and claimed_address not like ?1 and status = ?2 and chain_id = ?3 order by create_time desc", nativeQuery = true) List findByUnclaimedPacket(@Param("address") String address, @Param("status") Integer status, @Param("chainId") String chainId); + @Query(value = "select * from red_packet where address_list like ?1 and claimed_address not like ?1 and status = ?2 and if(isnull(?3), 1=1, chain_id = ?3) order by create_time desc", nativeQuery = true) + List findByUnclaimedPacketWithoutChainId(@Param("address") String address, @Param("status") Integer status, @Param("chainId") String chainId); + RedPacket findByIdAndStatus(@Param("id") String id, @Param("status") Integer status); From 5459f72eebb49ee323d23cdf2f8deb77693b0989 Mon Sep 17 00:00:00 2001 From: xiaoming <31494286+gitdq1016@users.noreply.github.com> Date: Sat, 6 Jul 2024 21:36:24 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BA=A2=E5=8C=85team?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../officialsite/member/MemberRepository.java | 4 ++++ .../dl/officialsite/member/MemberService.java | 19 +++++++++++++++++++ .../dl/officialsite/team/TeamController.java | 12 ++++++++++++ .../team/vo/TeamMemberAddQueryVO.java | 19 +++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 src/main/java/com/dl/officialsite/team/vo/TeamMemberAddQueryVO.java diff --git a/src/main/java/com/dl/officialsite/member/MemberRepository.java b/src/main/java/com/dl/officialsite/member/MemberRepository.java index ce013e7f..20c1b38a 100644 --- a/src/main/java/com/dl/officialsite/member/MemberRepository.java +++ b/src/main/java/com/dl/officialsite/member/MemberRepository.java @@ -26,4 +26,8 @@ public interface MemberRepository extends JpaRepository, JpaSpecif @Query(value = "update member set github_id=NULL, github_status=0, discord_id=NULL, telegram_user_id=NULL where address = :address", nativeQuery = true) void removeGitHubTgAndDiscordId(@Param("address") String address); + + + @Query(value = "select * from member where address in :addressList", nativeQuery = true) + List findByAddressList(@Param("addressList") List addressList); } diff --git a/src/main/java/com/dl/officialsite/member/MemberService.java b/src/main/java/com/dl/officialsite/member/MemberService.java index c50c7ad5..b140d2e2 100644 --- a/src/main/java/com/dl/officialsite/member/MemberService.java +++ b/src/main/java/com/dl/officialsite/member/MemberService.java @@ -1,5 +1,6 @@ package com.dl.officialsite.member; +import cn.hutool.core.collection.CollUtil; import com.dl.officialsite.common.enums.CodeEnums; import com.dl.officialsite.common.exception.BizException; import com.dl.officialsite.common.utils.UserSecurityUtils; @@ -124,4 +125,22 @@ public void nickNameExists(String nickName){ throw new RuntimeException("Nickname already exists, please change another one.") ; } } + + public List queryMemberInfoByAddress(List addressList){ + if(CollUtil.isEmpty(addressList)){ + return new ArrayList<>(); + } + List memberList = memberRepository.findByAddressList(addressList); + //只保留id、address、nickName字段 + List result = new ArrayList<>(); + for (Member member : memberList) { + Member filteredMember = new Member(); + filteredMember.setId(member.getId()); + filteredMember.setAddress(member.getAddress()); + filteredMember.setNickName(member.getNickName()); + result.add(filteredMember); + } + return result; + } + } diff --git a/src/main/java/com/dl/officialsite/team/TeamController.java b/src/main/java/com/dl/officialsite/team/TeamController.java index a480b2fe..2c9bba60 100644 --- a/src/main/java/com/dl/officialsite/team/TeamController.java +++ b/src/main/java/com/dl/officialsite/team/TeamController.java @@ -6,6 +6,7 @@ import com.dl.officialsite.login.Auth; import com.dl.officialsite.member.Member; import com.dl.officialsite.member.MemberService; +import com.dl.officialsite.team.vo.TeamMemberAddQueryVO; import com.dl.officialsite.team.vo.TeamMemberApproveVO; import com.dl.officialsite.team.vo.TeamMemberBatchJoinVO; import com.dl.officialsite.team.vo.TeamMemberJoinVO; @@ -55,6 +56,17 @@ BaseResponse update(@RequestBody Team team, @RequestParam String address) { return BaseResponse.successWithData(null); } + /** + * 通过地址信息查询member信息 + * @param teamMemberAddQueryVO + * @return + */ + @PostMapping("queryMemberInfoByAddress") + BaseResponse> queryMemberInfoByAddress(@RequestBody TeamMemberAddQueryVO teamMemberAddQueryVO) { + List members = memberService.queryMemberInfoByAddress(teamMemberAddQueryVO.getAddressList()); + return BaseResponse.successWithData(members); + } + /** * 加入团队 */ diff --git a/src/main/java/com/dl/officialsite/team/vo/TeamMemberAddQueryVO.java b/src/main/java/com/dl/officialsite/team/vo/TeamMemberAddQueryVO.java new file mode 100644 index 00000000..50a5ee95 --- /dev/null +++ b/src/main/java/com/dl/officialsite/team/vo/TeamMemberAddQueryVO.java @@ -0,0 +1,19 @@ +package com.dl.officialsite.team.vo; + +import lombok.Data; + +import java.util.List; + +/** + * @Description + * @Author xiaoming + * @Date 2024/7/6 8:59 PM + **/ +@Data +public class TeamMemberAddQueryVO { + + /** + * 地址列表 + */ + private List addressList; +} From 7ec552f5944c817fe639a12ea08140431a2e7c60 Mon Sep 17 00:00:00 2001 From: liberhex Date: Thu, 18 Jul 2024 21:42:11 +0800 Subject: [PATCH 3/4] replace the graph url of arbi and op --- .../distributor/DistributeService.java | 36 +++++++-------- .../redpacket/RedPacketService.java | 45 +++++++++---------- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/dl/officialsite/distributor/DistributeService.java b/src/main/java/com/dl/officialsite/distributor/DistributeService.java index 8ed99170..350f2f20 100644 --- a/src/main/java/com/dl/officialsite/distributor/DistributeService.java +++ b/src/main/java/com/dl/officialsite/distributor/DistributeService.java @@ -232,27 +232,27 @@ private HttpEntity getHttpEntityFromChain(String chainId) throws IOException { HttpPost request = null; switch (chainId) { case Constants.CHAIN_ID_OP: // op - request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/Bfrtk6bLRZoULLzAZ99hZ1Ae8kvFxsUWa4e97XzWJYhG"); - break; - case Constants.CHAIN_ID_SEPOLIA: // sepolia - request = new HttpPost( - "https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/9p6zFejTBC2bLLJRCdrk1A2PXfZkriRMacM5wiCAyh5Z"); - break; - case Constants.CHAIN_ID_SCROLL: // scroll - request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/8HhHjdsXrZ1cjq5qNpksoWfAm1NTDDFhH2Yb8ZkBixjo"); + request = new HttpPost("https://subgraph.satsuma-prod.com/3213d35a17f1/zhes-team--158805/dloptimismdistribute/api"); break; +// case Constants.CHAIN_ID_SEPOLIA: // sepolia +// request = new HttpPost( +// "https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/9p6zFejTBC2bLLJRCdrk1A2PXfZkriRMacM5wiCAyh5Z"); +// break; +// case Constants.CHAIN_ID_SCROLL: // scroll +// request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/8HhHjdsXrZ1cjq5qNpksoWfAm1NTDDFhH2Yb8ZkBixjo"); +// break; case Constants.CHAIN_ID_ARBITRUM: // arbitrum - request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/BbFUyrr7KeB9VjxrSqWFDWAcsyDsGdbinrteLrPK5MVb"); - break; - case Constants.CHAIN_ID_ZKSYNC: // zksync - request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/DzTmBT2V5kFQL6LpjC3iubYkusfj4HLVScCrAcT2DKGK"); - break; - case Constants.CHAIN_ID_POLYGON_ZKEVM: // polygon zkevm - request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/A46TwCAxDy4upqLuS7bgXd14yLQdTjfS4AVPMNwWkZSR"); - break; - case Constants.CHAIN_ID_LINEA: //linea - request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/DatcM6CoN5u79XPx1wYFFnWXpHYcfDodkbycx2vSp25C"); + request = new HttpPost("https://subgraph.satsuma-prod.com/3213d35a17f1/zhes-team--158805/dlarbitrumdistribute/api"); break; +// case Constants.CHAIN_ID_ZKSYNC: // zksync +// request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/DzTmBT2V5kFQL6LpjC3iubYkusfj4HLVScCrAcT2DKGK"); +// break; +// case Constants.CHAIN_ID_POLYGON_ZKEVM: // polygon zkevm +// request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/A46TwCAxDy4upqLuS7bgXd14yLQdTjfS4AVPMNwWkZSR"); +// break; +// case Constants.CHAIN_ID_LINEA: //linea +// request = new HttpPost("https://gateway-arbitrum.network.thegraph.com/api/" + merkleDistributorConfig.getGraphConfig().getKey() +"/subgraphs/id/DatcM6CoN5u79XPx1wYFFnWXpHYcfDodkbycx2vSp25C"); +// break; } if (request == null) diff --git a/src/main/java/com/dl/officialsite/redpacket/RedPacketService.java b/src/main/java/com/dl/officialsite/redpacket/RedPacketService.java index f91525c1..67ee1ba9 100644 --- a/src/main/java/com/dl/officialsite/redpacket/RedPacketService.java +++ b/src/main/java/com/dl/officialsite/redpacket/RedPacketService.java @@ -149,33 +149,32 @@ private HttpEntity getHttpEntityFromChain(String chainId) throws IOException { switch (chainId) { case Constants.CHAIN_ID_OP: // op request = new HttpPost( - "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() + - "/subgraphs/id/G7LuMuUuWUW8UknEx8x2aVSeFtqpNMEKHvka2aKiDzRm"); - break; - case Constants.CHAIN_ID_SEPOLIA: //sepolia - request = new HttpPost( - "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/84hUXdB1qCmn8Du8bDmpLxxFSHjsgFCUKcrbtM4j5tp6"); - break; - case Constants.CHAIN_ID_SCROLL: //scrool - request = new HttpPost( - "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/6Ln5DVxZuYiY4VZzDQ2hzweBMRBpwW1SKRjeUy2YouRC"); + "https://subgraph.satsuma-prod.com/f440a1fb5a7f/caodalong--672935/dloptimismredpacket/api"); break; +// case Constants.CHAIN_ID_SEPOLIA: //sepolia +// request = new HttpPost( +// "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/84hUXdB1qCmn8Du8bDmpLxxFSHjsgFCUKcrbtM4j5tp6"); +// break; +// case Constants.CHAIN_ID_SCROLL: //scrool +// request = new HttpPost( +// "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/6Ln5DVxZuYiY4VZzDQ2hzweBMRBpwW1SKRjeUy2YouRC"); +// break; case Constants.CHAIN_ID_ARBITRUM: //arbitrum request = new HttpPost( - "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/9S1hiM5vzZ3m7o9SBpywHHcC8VZBSRUZTv3R8Npt56gS"); - break; - case Constants.CHAIN_ID_ZKSYNC: //zksync - request = new HttpPost( - "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/ERTqnTVeQKH8CVYwfGnqqZjtNDzgdnJRYQCgD4TY1gUX"); - break; - case Constants.CHAIN_ID_POLYGON_ZKEVM: //polygon zkevm - request = new HttpPost( - "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/5DsufFHE6P7tK7QT1mGCPrQEKURD2E1SSHAyCSzf5CAg"); - break; - case Constants.CHAIN_ID_LINEA: //linea - request = new HttpPost( - "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/958YHrTJturbhR6uwRyPu1wmBNiXivNkLMPY7tUiL4wD"); + "https://subgraph.satsuma-prod.com/f440a1fb5a7f/caodalong--672935/dlarbitrumredpacket/api"); break; +// case Constants.CHAIN_ID_ZKSYNC: //zksync +// request = new HttpPost( +// "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/ERTqnTVeQKH8CVYwfGnqqZjtNDzgdnJRYQCgD4TY1gUX"); +// break; +// case Constants.CHAIN_ID_POLYGON_ZKEVM: //polygon zkevm +// request = new HttpPost( +// "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/5DsufFHE6P7tK7QT1mGCPrQEKURD2E1SSHAyCSzf5CAg"); +// break; +// case Constants.CHAIN_ID_LINEA: //linea +// request = new HttpPost( +// "https://gateway-arbitrum.network.thegraph.com/api/" + redPacketConfig.getGraphConfig().getKey() +"/subgraphs/id/958YHrTJturbhR6uwRyPu1wmBNiXivNkLMPY7tUiL4wD"); +// break; } request.setHeader("Content-Type", "application/json"); From bfd7942527d2f52dd762f551d39034228347e159 Mon Sep 17 00:00:00 2001 From: chengpengxiang <15503679582@163.com> Date: Sat, 20 Jul 2024 20:48:49 +0800 Subject: [PATCH 4/4] feat:1. add send mail for apply bounty 2. cc mail to dapp official mail 3. fix hiring bug when send mail --- .../dl/officialsite/bounty/BountyService.java | 19 +++++++++++++++---- .../application/ApplicationService.java | 2 +- .../dl/officialsite/mail/EmailService.java | 1 + 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/dl/officialsite/bounty/BountyService.java b/src/main/java/com/dl/officialsite/bounty/BountyService.java index c9566b28..dd7d7910 100644 --- a/src/main/java/com/dl/officialsite/bounty/BountyService.java +++ b/src/main/java/com/dl/officialsite/bounty/BountyService.java @@ -2,6 +2,7 @@ import static com.dl.officialsite.common.constants.Constants.BOUNTY_MEMBER_MAP_STATUS_FINISH; import static com.dl.officialsite.common.enums.CodeEnums.NOT_FOUND_BOUNTY; +import static com.dl.officialsite.common.enums.CodeEnums.NOT_FOUND_MEMBER; import com.dl.officialsite.bot.constant.BotEnum; import com.dl.officialsite.bot.constant.ChannelEnum; @@ -14,16 +15,14 @@ import com.dl.officialsite.bounty.vo.MyBountySearchVo; import com.dl.officialsite.common.constants.Constants; import com.dl.officialsite.common.exception.BizException; -import com.dl.officialsite.hiring.application.Application; +import com.dl.officialsite.mail.EmailService; import com.dl.officialsite.member.Member; import com.dl.officialsite.member.MemberRepository; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; -import java.util.stream.Collectors; import javax.persistence.criteria.Predicate; - import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -54,13 +53,16 @@ public class BountyService { private final ApplicationContext applicationContext; + private final EmailService emailService; + public BountyService(BountyRepository bountyRepository, BountyMemberMapRepository bountyMemberMapRepository, MemberRepository memberRepository, - ApplicationContext applicationContext) { + ApplicationContext applicationContext, EmailService emailService) { this.bountyRepository = bountyRepository; this.bountyMemberMapRepository = bountyMemberMapRepository; this.memberRepository = memberRepository; this.applicationContext = applicationContext; + this.emailService = emailService; } @@ -195,6 +197,15 @@ public void apply(Long bountyId, String address) { bountyMemberMap.setMemberAddress(address); bountyMemberMap.setStatus(Constants.BOUNTY_MEMBER_MAP_STATUS_APPLY); bountyMemberMapRepository.save(bountyMemberMap); + String creatorAddress = bounty.getCreator(); + Member createBountyMember = memberRepository.findByAddress(creatorAddress) + .orElseThrow(() -> new BizException(NOT_FOUND_MEMBER.getCode(), NOT_FOUND_MEMBER.getMsg())); + + try { + emailService.sendMail(createBountyMember.getEmail(), "有新人申请bounty", "赶紧去看看吧 https://dapplearning.org/bounty"); + } catch (Exception e) { + throw new RuntimeException(e); + } } public List findBountyMemberMapByBountyId(Long bounty) { diff --git a/src/main/java/com/dl/officialsite/hiring/application/ApplicationService.java b/src/main/java/com/dl/officialsite/hiring/application/ApplicationService.java index e9159c8f..d18b4c6d 100644 --- a/src/main/java/com/dl/officialsite/hiring/application/ApplicationService.java +++ b/src/main/java/com/dl/officialsite/hiring/application/ApplicationService.java @@ -64,7 +64,7 @@ public void apply(ApplyVo applyVo, String address) { throw new BizException(APPLY_REPEAT.getCode(), APPLY_REPEAT.getMsg()); }); try { - emailService.sendMail(member.getEmail(), "有新人投递简历", "有新人投递简历:\n简历地址:\n " + emailService.sendMail(createJDMember.getEmail(), "有新人投递简历", "有新人投递简历:\n简历地址:\n " + "https://dlh-1257682033.cos.ap-hongkong.myqcloud.com/" + applyVo.getFile()); //添加应聘记录 Application application = new Application(); diff --git a/src/main/java/com/dl/officialsite/mail/EmailService.java b/src/main/java/com/dl/officialsite/mail/EmailService.java index 79caca7b..6cf213cb 100644 --- a/src/main/java/com/dl/officialsite/mail/EmailService.java +++ b/src/main/java/com/dl/officialsite/mail/EmailService.java @@ -56,6 +56,7 @@ public void sendMail(String to, String subject, String text) { message.setTo(to); message.setSubject(subject); message.setText(text); + message.setCc("dapplearning@gmail.com"); emailSender.send(message); }